howtothings.co.uk
Setting DNS in Ubuntu - Printable Version

+- howtothings.co.uk (https://www.howtothings.co.uk)
+-- Forum: Computing (https://www.howtothings.co.uk/forumdisplay.php?fid=4)
+--- Forum: Operating System and Software Support (https://www.howtothings.co.uk/forumdisplay.php?fid=17)
+--- Thread: Setting DNS in Ubuntu (/showthread.php?tid=362)



Setting DNS in Ubuntu - Pack3t SynAck3r - 14-09-2010

As has been mentioned here on several occasions using Google's Open DNS servers is a much better solution than using the DNS server provided by your ISP.

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

:tux


RE: Setting DNS in Ubuntu - Drumm - 14-09-2010

chattr? That some kind of chmod?

Good guide, most people never have any idea of where most config files for Linux are. Good that you know your stuff.


RE: Setting DNS in Ubuntu - Mark - 14-09-2010

chattr is a command in the Linux operating system that allows a user to set certain attributes on a file residing on an ext2-based filesystem. If it's only ex2 that could be a problem as it's mostly ext3 on Linux installs now.

Nice tutorial none the less. I'm still getting complaints that people can't get on.


RE: Setting DNS in Ubuntu - Pack3t SynAck3r - 15-09-2010

(14-09-2010, 11:43 PM)The Wing Wrote: chattr is a command in the Linux operating system that allows a user to set certain attributes on a file residing on an ext2-based filesystem. If it's only ex2 that could be a problem as it's mostly ext3 on Linux installs now.

Nice tutorial none the less. I'm still getting complaints that people can't get on.

Lol, nice quoting Wikipedia Mark, but have no fear. chattr was first implemented on ext2 because the file system had new "special" attributes added. chattr has worked on every iteration of ext since. Therefore there is NO problem using chattr if you have ext3 or ext4(which comes standard with Ubuntu 10.04.) That makes this tutorial widely applicable. :thumbs


RE: Setting DNS in Ubuntu - Mark - 15-09-2010

Why thank you, i've never seen the use of chattr before so research was in hand. :tongue


RE: Setting DNS in Ubuntu - Pack3t SynAck3r - 17-09-2010

You would be surprised how many tricks you learn when you have been using Linux based OSes for the last 14 years, and *nix for about twice that. Although I think based on the amount of activity on here that it is probably falling on deaf ears. Mark I think your Web Server's DNS or Web Server's ISP's DNS is having issues. There are A LOT of other websites on your server's IP address. If the web server isn't getting rdns proper for all the websites on that server then it is going to continue to be an issue. I think it is time to move again, unless someone at the web server gets off their ass and fixes it.


RE: Setting DNS in Ubuntu - Pack3t SynAck3r - 22-09-2010

Bump! Now that the forum is back up people will actually get to see this.


RE: Setting DNS in Ubuntu - Drumm - 20-12-2010

I've just been setting up an Arch Linux box, and I was alerted of a new method to the chattr. If you append the following lines to your "/etc/dhcpcd.conf" file, you can tell your dhcpcd DHCP client not to overwrite the file.

Code:
nohook resolv.conf





RE: Setting DNS in Ubuntu - pat778mal - 30-08-2011

Thanks for the guide. Setting up DNS can be tricky. I played around with open DNS, but have not set one up on my box. Do you guys think that running one locally is better than open DNS? If you are dealing with a large database, like www.myshipinfo.com, you may want to consider using multiple DNS servers, or going with a professional service.