If you want to configure a network connection manually, you also need to specify what DNS name server should be used. This is the DNS resolver. On Linux you do this by modifying the file /etc/ resolv.conf. Typically in this file you will find the IP address of at least two DNS name servers and a search domain. The nameserver specification indicates what DNS name server should be contacted to translate DNS names to IP addresses, and vice versa. The search domain specifies what domain name should be appended if an incomplete host name is used. Listing 13-2 shows an example of the content of /etc/resolv.conf.
Listing 13-2. Example of/etc/resolv.conf nameserver 192.168.1.10 nameserver 22.214.171.124 search sandervanvugt.com
In Listing 13-2, you see that name server 192.168.1.10 is used as the default name server. All DNS requests will be sent to that name server. Only if this server doesn't respond to DNS queries is the second server in the list contacted. Make sure always to specify the addresses of two name servers. You can use a third name server as well, but you probably will never use one; this is because it is contacted only if the first and the second name servers are unavailable. The third line of Listing 13-2 specifies the search domain. So if a user, for example, uses the command ping ftp, which uses an incomplete host name, then the name of the domain specified with the search option in resolv.conf is added automatically to it; therefore, with resolv.conf in Listing 13-2, the command ping ftp would cause the server ftp.sandervanvugt.com to answer.
Was this article helpful?