Setting DNS in Ubuntu
This is how to change your DNS setting in Ubuntu to use said Google DNS server using gedit as a text editor(substitute your editor of choice where gedit is used):
In a terminal:
sudo gedit /etc/resolve.conf
In order to use the Google DNS you will need to add two entries into the file as such:
nameserver 8.8.8.8
nameserver 8.8.4.4
Save the file
Now the only problem is the next time you reboot or restart your networking interface(s) your DNS servers will be reset by the system to use the settings given by the DHCP server. Since this is counter-productive to the task at hand we will write-protect the resolve.conf file using the following command in terminal
sudo chattr +i /etc/resolv.conf
This gives your resolv.conf file an immutable file attribute preventing anything from modifying it.
In turn if you ever decide you would like to change DNS servers again remember to use the following command before attempting to edit the file again:
sudo chattr -i /etc/resolv.conf
0 条评论。