Skip to content

Changing Name Servers

Mohamed Samy edited this page Jan 20, 2020 · 1 revision

Introduction

The following guides explain how to change DNS Name-Servers on each Operating System in order to point them to SecureDNS Server IP Address.

Note
The following examples assumes SecureDNS Server is running & listening on 127.0.0.1

Windows

Option 1: Network Connections

  1. Open Start Menu.
  2. Type View Network Connections then Click on it.
  3. Right-Click Network Adapter & Click Properties.
  4. Under Networking Tab, Double-Click Internet Protocol Version 4 (TCP/IPv4).
  5. Under General Tab, Select Use the following DNS server addresses.
  6. Type 127.0.0.1 in Preferred DNS Server & Alternate DNS Server.

Option 2: PowerShell

# Setting DNS Servers
Get-NetAdapter -Physical | ForEach-Object { Set-DnsClientServerAddress $_.Name -ServerAddresses ("127.0.0.1") }

# Resetting DNS Servers
Get-NetAdapter -Physical | ForEach-Object { Set-DnsClientServerAddress $_.Name -ResetServerAddresses }

MacOS X

Option 1: System Preferences

  1. Open System Preferences.
  2. Select Network.
  3. Select Advanced.
  4. Select DNS.
  5. Remove all existing Name-Servers.
  6. Add a single Name-Server: 127.0.0.1

Option 2: Terminal

> networksetup listallnetworkservices
# From listallnetworkservices output, choose Adapter Name for next command

> networksetup -setdnsservers [Adapter Name] 127.0.0.1

Linux

Option 1: Shell - resolv.conf

echo 'nameserver 127.0.0.1' | sudo tee /etc/resolv.conf > /dev/null
Note
On Linux, there are a few services which may try to automatically overwrite your resolv.conf, For Example: resolvconf, dhcpcd & NetworkManager.

Option 2: Shell - resolvconf

If you're using resolvconf, /etc/resolvconf.conf must be modified:

$ sudo vi /etc/resolvconf.conf

The name_servers field must be altered in order to truly alter your resolv.conf:

name_servers="127.0.0.1"

Option 3: Shell - dhcpcd

dhcpcd may try to overwrite your resolv.conf with whatever nameservers are advertised by your router (usually your ISP's Name-Servers). To prevent this, /etc/dhcpcd.conf must be modified:

$ sudo vi /etc/dhcpcd.conf

In the default config, you may see a line which looks like:

option domain_name_servers, domain_name, domain_search, host_name

We want to remove domain_name_servers, domain_name, and domain_search.

option host_name

Option 4: Shell - NetworkManager

Likewise, NetworkManager has similar behavior to dhcpcd. To prevent it from tainting your resolv.conf, /etc/NetworkManager/NetworkManager.conf must be altered:

$ sudo vi /etc/NetworkManager/NetworkManager.conf

The default NetworkManager.conf is usually empty, but we need to add a dns option under the [main] section, resulting in a configuration like:

[main]
dns=none