Grabber Softwares : Enhance Your Computing
Configuring Linux To Use Another Nameserver

Simpler than configuring a Unix nameserver

By default, Linux uses its own hosts file for IP-to-hostname mapping and does not use other systems as nameservers. However, just tweaking two files is usually enough to enable it to pick up hostnames from another machine. While using any Unix system as a nameserver is somewhat tedious and difficult process, configuring the system to pick up its host names from another machine is a simple, relatively painless procedure. Basically one just has to configure two files.

First, open the file /etc/resolv.conf. Usually, you’ll find just two lines there, specifying your domain and your nameserver. All you have to do is specify the IP address of your nameserver. If your domain is pcqlabs.com and your nameserver's IP address is 192.168.1.131, then your file should contain only the following two lines:

domain pcqlabs.com
nameserver 192.168.1.131

In case you have more than one nameserver for your network, you must specify all of them and each must have its own separate nameserver line in this file. Once this is done, edit the file /etc/hosts.conf. Usually, this contains the following lines:
order hosts, bind
multi on


Here, first line specifies the search order for hostname look-up. In this case the system is going to look up the hosts file first and go on to the nameserver. If you want it the other way round, simply replace the line with the following:
order bind, hosts

The statement multi on simply states that we are allowed to have multiple IP addresses for a given machine in the hosts file.
Once this is done, your configuration of Linux to enable it to use another machine as nameserver is complete. After this, the machine will search for hostnames on the defined name server and if that fails, it will look for it in the /etc/hosts file.

The easy way

There’s an even simpler way to configure Linux as a client for a nameserver. Many distributions of Linux come with a small utility called netconfig, which can be used to configure Linux as a client for a DNS server. The netconfig is a straightforward and easy-to-use program which is run by simply typing netconfig at the command prompt. The program asks you for your machine’s hostname, the domain to which it belongs, the netmask, and a couple of other basic questions, and then makes the requisite changes in the system scripts and the network configuration files after which it quietly exits.

One of the questions the netconfig asks is whether you shall be using a nameserver. If you are, then it asks you for the IP address of your nameserver and that’s it. Your machine is ready to work as a client for a DNS server. Note that if you are running the machine being configured, as a nameserver, then the address to be given is 127.0.0.1.
Try it on your machine. It does make things easier.