知乎专栏 | 多维度架构 |
目录
# cat -n /etc/hosts 1 # Do not remove the following line, or various programs 2 # that require network functionality will fail. 3 127.0.0.1 development.domain.org development netkiller.localdomain netkiller 4 ::1 localhost6.localdomain6 localhost6
# cat /etc/hostname web1.example.com
查看IP地址
[root@localhost ~]# hostname --ip-address ::1 127.0.0.1
解析顺序配置文件
[root@development bin]# cat /etc/host.conf order hosts,bind
首先在/etc/hosts文件中寻找,如果不存在,再去DNS服务器中寻找
IP地址后面TAB符,然后写主机地址
127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 192.168.1.10 development.example.com development