In Linux, the networking related services could be set up in three different ways:
1) /etc/hosts to /etc/hosts mapping based networking
2) DNS based networking
3) NIS/NIS+ based networking which in turn can take the help of DNS or /etc/hosts file
For network-based services the actual network daemon reads some file for communication.
The first file that it reads is /etc/host.conf. Over here one may generally find two lines as
Order hosts, bind, Nis
The first line tells what would the network-related services like httpd, sendmail, nfsd, ypserv etc, which gets invoked at the time of booting from /etc/rc.d/init.d read, before doing remote communication. It also tells whether the /etc/hosts file mapping where the host entries for each machine is present on each machine or it should read a DNS implemented by BIND software or a nis/nis+ based networking which is dependent on either of the above setup.
The second line says whether one machine can have multiple IPaddresses attached with same machine name or not as a Linux platform allows a machine name to have multiple IPaddresses.
Example: Let’s say a system administrator wants to setup 3 IPaddresses with the same machine name associated with one Ethernet card with 126.96.36.199
#ifconfig eth0 188.8.131.52
#ifconfig eth0:1 184.108.40.206
#ifconfig eth0:2 220.127.116.11
Now in /etc/hosts if we write
That means any another machine can access the services of kshounish1 machine by writing any of the ipaddress. Remember that the order means the searching order if it’s like Order hosts, bind.
That means all the services which need to read something before getting served or get requested will first see the mapping of the hosts in /etc/hosts file. If it gets that file it would work or else it will search for the DNS through BIND software. For DNS setup it should be Order bind, hosts.
And note that once you change the order you need to start
# /etc/rc.d/init.d/network restart
This is the first step before you start configuring DNS
What is DNS?
DNS means Domain Name Service. It is actually a service that can keep large number of machines’ ipaddresses for huge network communication. Now the question arises why is this needed. Lets understand this with the help of an illustration.