1.
Where to set hostname and how to get IP info
/etc/sysconfig/network
/etc/hosts
*/etc/hosts 文件
当机器启动时,在可以查询DNS以前,机器需要查询一些主机名到IP地址的匹配。这些匹配信息存放在/etc/hosts文件中。在没有域名服务器情况下,系统上的所有网络程序都通过查询该文件来解析对应于某个主机名的IP地址。
下面是一个“/etc/hosts”文件的示例:
IP Address Hostname Alias
127.0.0.1 Localhost Gate.openarch.com
208.164.186.1 gate.openarch.com
Gate
………… ………… ………
最左边一列是主机IP信息,中间一列是主机名。任何后面的列都是该主机的别名。一旦配置完机器的网络配置文件,应该重新启动网络以使修改生效。使用下面的命令来重新启动网络:/etc/rc.d/init.d/network restart
Note: 网络重启后,有可能机器的IP会发生变化,用ifconfig来查看现在的IP地址。
Note: If we had set DNS in windows2000 system, we maybe also need to set the file C:/WINNT/system32/drivers/etc/hosts
另外,在命令行下运行>hostname –v [newhostname]可以设置新的hostname
2.
Where to set DNS info
/etc/resolv.conf
like following:
search localdomain
nameserver 202.96.104.18
nameserver 202.96.209.133
nameserver 64.68.122.120
Another important file:
/etc/hosts.conf
We can use nslookup or dig to test dns
# nslookup hostname
# dig hostname