The /etc/hosts file

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
           208.164.186.1		deep.openna.com		 deep
           208.164.186.2		mail.openna.com		 mail
           208.164.186.3		web.openna.com		 web
           
The leftmost column is the   IP  address to be resolved. The next column is that host's name. Any subsequent columns are alias for that host. In the second line, for example, the IP  address   208.164.186.1  is for the host   deep.openna.com. Another name for   deep.openna.com  is deep.

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  ]
           
           

ImportantTime 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.

====

http://www.faqs.org/docs/securing/chap9sec95.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值