Lesson 6 | Using DNS to resolve hostnames into IP addresses |
Objective | Configure your network interface to use DNS. |
Using DNS to resolve hostnames into IP Addresses using Linux Network Integration
In large networks, the disadvantages of Host Tables become apparent: there are simply too many hosts constantly connecting and disconnecting from the network. You would have to edit the Host Table constantly, leaving no time for useful computing.
DNS
The solution is a large database that is spread among many computers. The most common system is the Domain Name System (DNS).
Each DNS machine keeps a database of names and addresses. The database is updated constantly to reflect the current state of the network.
When requests are made, the server searches for the hostname and, if found, returns the IP address. If the server does not find the IP address, it asks other DNS servers to try and find the hostname.
Likewise, if the DNS server receives an IP address, it will return the hostname, if found, or ask other servers to look up the IP address.
Configuring client-side DNS
In order to use DNS, you must specify at least the primary DNS server's IP address. If the primary DNS fails to resolve the hostname, Linux consults any backup DNS servers you specified.
The DNS configuration information is stored in two files, /etc/host.conf
and /etc/resolv.conf
. The /etc/host.conf
file describes how your Linux machine connects to DNS. The default configuration is adequate.
However, you must manually configure the /etc/resolv.conf
file, as described in the Slide Show below.
Using dns resolve
Linux contacts the nameservers in the /etc/resolv.conf file in the order you list them. Put your primary DNS as the first entry, and all backup DNS servers afterward.