Windows
- C:\Windows\System32\drivers\etc\hosts
Linux
- cat /etc/hosts
- cat /etc/resolv.conf
Debian
- /etc/hostname
格式介绍
第一部分:网络IP地址;
第二部分:主机名或域名;
第三部分:主机名别名;
一般/etc/hosts的内容一般有如下类似内容:
127.0.0.1 localhost.localdomain localhost
192.168.1.100 linumu100.com linumu100
192.168.1.120 ftpserver ftp120
用意解释
比如文件中有这样的定义
192.168.1.100 linumu100 test100
假设192.168.1.100是一台网站服务器,在网页中输入http://linumu100或http://test1000就会打开192.168.1.100的网页。