Change DNS servers for a Debian server

Edit the file

vim /etc/dhcp/dhclient.conf

Uncomment the line starting with #prepend domain-name-servers and set your dns servers. Below is an example using the Google Public DNS.

prepend domain-name-servers 8.8.8.8, 8.8.4.4;

(Note removal of hash sign at beginning and two comma-separated DNS servers.)

Reboot and you should be set. You can verify the servers in use by running

dig google.com

The IP for the DNS server will be at the bottom of the output, like this:

;; SERVER: 8.8.4.4#53(8.8.4.4)

Leave a Reply

Your email address will not be published. Required fields are marked *

Markdown is allowed in comments.