域名解析的问题

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
罗非鱼
帖子: 980
注册时间: 2008-04-12 12:44

域名解析的问题

#1

帖子 罗非鱼 » 2016-04-07 15:30

我的/etc/hosts设置如下

127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 hwy.local/wp
127.0.0.1 hwy.local/test

本机ip是192.168.1.101。
ping hwy.local/wp
PING hwy.local/wp (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.029 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.035 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.035 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.034 ms
64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.037 ms
^C
--- hwy.local/wp ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.029/0.034/0.037/0.002 ms
root@hwy:/home/debian8# ping hwy.local/test
PING hwy.local/test (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.114 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.031 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.040 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.038 ms
64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.041 ms
64 bytes from localhost (127.0.0.1): icmp_seq=6 ttl=64 time=0.036 ms
^C
--- hwy.local/test ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5000ms
rtt min/avg/max/mdev = 0.031/0.050/0.114/0.028 ms
root@hwy:/home/debian8# ping hwy.local
PING hwy.local (192.168.1.101) 56(84) bytes of data.
64 bytes from 192.168.1.101: icmp_seq=1 ttl=64 time=0.026 ms
64 bytes from 192.168.1.101: icmp_seq=2 ttl=64 time=0.028 ms
64 bytes from 192.168.1.101: icmp_seq=3 ttl=64 time=0.032 ms

为何 ping hwy.local 不会解析成 127.0.0.1 ?
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

Re: 域名解析的问题

#2

帖子 oneleaf » 2016-04-07 16:06

127.0.0.1 hwy.local 才会将 hwy.local 解析为 127.0.0.1

后面的域名必需完整和规范,你上面的配置带路径,是错的。
罗非鱼
帖子: 980
注册时间: 2008-04-12 12:44

Re: 域名解析的问题

#3

帖子 罗非鱼 » 2016-04-07 17:27

为何 ping hwy.local 被解析成 192.168.1.101?
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

Re: 域名解析的问题

#4

帖子 oneleaf » 2016-04-07 18:00

需要去查你的上一级dns服务器。
罗非鱼
帖子: 980
注册时间: 2008-04-12 12:44

Re: 域名解析的问题

#5

帖子 罗非鱼 » 2016-04-08 8:47

谢谢,上层绑定。
回复