|Securing and Optimizing Linux: RedHat Edition -A Hands on Guide|
|Prev||Chapter 9. Files -Networking Functionality||Next|
As your machine gets started, it will need to know the mapping of some hostnames to IP addresses before DNS can be referenced. This mapping is kept in the /etc/hosts file. In the absence of a name server, any network program on your system consults this file to determine the IP address that corresponds to a host name.
Following is a sample /etc/hosts file:
IPAddress Hostname Alias 127.0.0.1 localhost deep.openna.com 22.214.171.124 deep.openna.com deep 126.96.36.199 mail.openna.com mail 188.8.131.52 web.openna.com web
After you are finished configuring your networking files, don't forget to restart your network for the changes to take effect.
[root@deep] /# /etc/rc.d/init.d/network restart
Setting network parameters [ OK ] Bringing up interface lo [ OK ] Bringing up interface eth0 [ OK ] Bringing up interface eth1 [ OK ]
: Time out problems for telnet or ftp connection are often caused by the server trying to resolve the client IP address to a DNS name. Either DNS isn't configured properly on your server or the client machines aren't known to DNS. If you intend to run telnet or ftp services on your server, and aren't using DNS, don't forget to add the client machine name and IP in your /etc/hosts file on the server or you can expect to wait several minutes for the DNS lookup to time out, before you get a login: prompt.