2.10.2014

How to update DNS in Linux

Install the resolvconf package. (apt-get resolvconf)
Run
cd /etc/resolvconf/resolv.conf.d
sudo cp -p head head.orig  #backup copy, always do this
sudo nano head
The top of the file is a scary warning. The file /etc/resolv.conf is autogenerated from the contents of this file; the warning is there so it will get put in /etc/resolv.conf when /etc/resolv.conf is generated. To the end of the file, add
nameserver <ip_of_nameserver>
Press Ctrl x and answer yes to saving the file. To finish up, regenerate /etc/resolv.conf so the changes are applied right now:
sudo resolvconf -u
Then check the contents of /etc/resolv.conf to see the line you added is now there. Further, it will still be there the next time your machine boots or your network service is restarted, whichever comes first.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.