DNS Nameserver entries in network interfaces using resolvconf Program

 Usually we make DNS nameserver entries in the configuration file resolv.conf at /etc/resolv.conf .But, when multiple programs need to dynamically modify the resolv.conf configuration file they can step on each other and the file can become out-of-sync. To overcome this we can make the DNS nameserver entries in the network interface itself using resolvconf program.

The resolvconf program keeps track of system information about the currently available nameservers. It should not be confused with the configuration file resolv.conf .

When resolvconf is properly installed , the resolv.conf configuration file at /etc/resolv.conf is replaced by a symbolic link to /etc/resolvconf/run/resolv.conf and the resolver instead uses the configuration file that is dynamically generated by resolvconf at /etc/resolvconf/run/resolv.conf .

If the resolvconf program is installed, you can manually define the nameservers (as with a static interface ), add a line something like the following to the interface configuration file at /etc/network/interfaces :

dns-nameservers  8.8.8.8  4.2.2.2

 Place the line indented within an iface stanza, e.g., right after the gateway line . Enter the IP addresses of the nameservers you need to use after dns-nameservers. Put all of them on one line separated by spaces. Dont forget the “s ” on the end of  dns-nameservers.

Steps to follow:

Install resolvconf package by the command

 sudo apt-get install resolvconf

Manually enter the  DNS nameserver in the interface as previously mentioned in the article.

dns-nameservers 8.8.8.8 4.2.2.2

Add the nameserver information record for the network interface  by the command

resolvconf  -a eth0

Update the record by the command

resolvconf -u

Thats it … The system is able to resolve names into addresses..

you can able to delete the record by the command

resolvconf   -d  eth0

NOTE:

      These things are applicable to Ubuntu 10.04 server. Configuration in Ubuntu 12.04 server is very much simple . The steps to be followed in Ubuntu 12.04 server  are given below

By default it comes with resolvconf package that means no need to install.

Just make an entry in the  network interface similiar to 10.04 .

then restart the network services.

Thats it .. It will resolve names into addresses

 

 

 

Leave a Reply