Configure Static DNS with DHCP on Debian

Purpose : configure your system to use your choice of DNS servers.

Why update DNS servers addresses?

  • you wish to use your own private DNS server
  • access your network devices by using a FQDN (fully qualified domain name) instead of an IP address
  • your ISP’s DNS servers are slow, creating a sluggish browsing experience

There are many free/public DNS servers. Here is a small list:

  1. Freenom:,
  2. Google:,
  3. OpenDNS:,
  4. FreeDNS:,
  5. Level3:,
  6. Cloudflare:,
  7. Quad9:,

When updating your DNS servers, always check with the provider to make sure they do not log any private information (e.g. requested IP addresses, ISP, or your geographic location)

To update the DNS servers on Debian you need to:

  1. edit the /etc/dhcp/dhclient.conf file
  2. restart the networking service

Simply adding the DNS servers to theĀ /etc/resolv.conf file is not going to make the changes permanent. They will only last until your restart your dhcp client or reboot your system. This method is useful if you need to temporarily use or test new DNS servers.


1. Edit the /etc/dhcp/dhclient.conf file

To add static DNS servers that are used in addition to the ones provided by DHCP, use prepend

prepend domain-name-servers, bbb.bbb.bbb.bbb

To completely override the DNS servers provided by DHCP, and entirely force the system to use only the ones you provide, use supersede

supersede domain-name-servers, bbb.bbb.bbb.bbb

2. Restart the networking service

sudo /etc/init.d/networking restart

3. Check the /etc/resolv.conf file to make sure the new DNS servers where added.

Leave a Reply