How to add static DNS in Ubuntu 12.04 LTS

Please refer to this tutorial for adding the static ip address in Ubuntu 12.04.

Ubuntu 12.04 use resolvconf(a set of scripts and hooks) instead of resolv.conf to manage DNS server. The most notable difference for the user is that any change manually done to /etc/resolv.conf will be lost as it gets overwritten next time something triggers resolvconf.

To add the static dns entries in resolv.conf file,edit /etc/resolvconf/resolv.conf.d/base:

sudo nano /etc/resolvconf/resolv.conf.d/base

Add these lines (the example below is OpenDNS’s public name servers):


Run this command to refresh the resolvconf setting:

sudo service resolvconf restart

To view your DNS Servers addresses, use this command:

cat /etc/resolv.conf

Hope this will help you!

Please Remember me in your prayers!


4 responses to “How to add static DNS in Ubuntu 12.04 LTS

  1. Pingback: Setting static DNS servers in Ubuntu « Got the nerd swagger!

  2. February 14, 2013 at 3:41 am

    I was basically searching for points for my personal blog and noticed your article,
    “How to add static DNS in Ubuntu 12.04 LTS Lazy Geek -:)”, do you really
    care in cases where I actually start using many
    of ur tips? Thanks a lot ,Mandy

  3. Joe Aldeguer June 10, 2013 at 7:46 pm

    Thanks for pointing out which file to edit for dns!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: