الجمعة، 28 مايو 2010

Linux Networking Configuring /etc/hosts file

Configuring /etc/hosts file:


The /etc/hosts file is just a list of IP addresses and their corresponding server names. The server will typically check this file before referencing DNS. If the name is found with a corresponding IP address then DNS won't be queried at all. Unfortunately, if the IP address for that host changes, you also have to also update the file. This may not be much of a concern for a single server, but can become laborious if it has to be done companywide. For ease of management, it is often easiest to limit entries in this file to just the loopback interface and also the server's own hostname, and use a centralized DNS server to handle most of the rest. Sometimes you might not be the one managing the DNS server, and in such cases it may be easier to add a quick /etc/hosts file entry till the centralized change can be made.

The contents of the file should be as follows.
-------
192.168.1.101 Basil
-------

In the example above server Basil has an IP address of 192.168.1.101. You can access 192.168.1.101 using the ping, telnet or any other network aware program by referring to it as smallfry. Here is an example using the ping command to see whether smallfry is alive and well on the network:
-------
root@Basil15099/~# ping Basil

PING zero (192.168.1.101) 56(84) bytes of data.
64 bytes from Basil (192.168.1.101): icmp_seq=0 ttl=64 time=0.197 ms
-------

ليست هناك تعليقات:

إرسال تعليق