• 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting DNS in Ubuntu
#1
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
[Image: icpn5k.jpg]
Trolls are the last thing you need to be concerned with.

VCD Wrote:// Forever more, count and reply, bitch.
  Reply
#2
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.
[Image: nomnomnom.jpg]
;7$=v?%v%#5>v7v8994
The decrypt code is V, I could not make it any simpler!
  Reply
#3
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.
  Reply
#4
(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
[Image: icpn5k.jpg]
Trolls are the last thing you need to be concerned with.

VCD Wrote:// Forever more, count and reply, bitch.
  Reply
#5
Why thank you, i've never seen the use of chattr before so research was in hand. :tongue
  Reply
#6
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.
[Image: icpn5k.jpg]
Trolls are the last thing you need to be concerned with.

VCD Wrote:// Forever more, count and reply, bitch.
  Reply
#7
Bump! Now that the forum is back up people will actually get to see this.
[Image: icpn5k.jpg]
Trolls are the last thing you need to be concerned with.

VCD Wrote:// Forever more, count and reply, bitch.
  Reply
#8
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


[Image: nomnomnom.jpg]
;7$=v?%v%#5>v7v8994
The decrypt code is V, I could not make it any simpler!
  Reply
#9
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.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Ubuntu KDE? DerpyTurtle1337 1 7,224 11-11-2012, 02:10 PM
Last Post: Mark
  How to use Gnome instead of Unity in Ubuntu 11.04 Mark 1 8,156 13-10-2011, 06:01 PM
Last Post: Drumm
  Newly found skin for Ubuntu bigsharn 6 16,134 30-08-2011, 10:32 PM
Last Post: bigsharn
  HP's $99 / £60 TouchPad can run Ubuntu Mark 1 6,792 29-08-2011, 11:15 AM
Last Post: bigsharn
  Pulling / setting up a Microsoft Exchange account into Mozilla Thunderbird ? Mark 0 4,958 26-08-2011, 02:30 PM
Last Post: Mark

Forum Jump: