用 ping 绑定奇怪的行为

用 ping 绑定奇怪的行为

我已经在我的局域网上进行了 BIND,并且创建了一个区域:

$ORIGIN example.com.
$TTL 604800 ; 1 week
@       IN SOA  ns1.example.com. max.example.com. (
                2017103151 ; serial
                604800     ; refresh (1 week)
                86400      ; retry (1 day)
                2419200    ; expire (4 weeks)
                604800     ; minimum (1 week)
                )
        IN  NS  ns1.example.com.
        IN  NS  ns2.example.com.
            MX  10 mx1.example.com.

server1         A   192.168.1.100
ns1         A   192.168.1.101
ns2         A   192.168.1.102
mx1         A   192.168.1.100
ftp         CNAME   server1
pop3            CNAME   server1
imap            CNAME   server1

反向区域:

$ORIGIN 1.168.192.in-addr.arpa.
$TTL 604800     ; 1 week
@       IN SOA  ns1.example.com. max.example.com. (
                                2017103136 ; serial
                                604800     ; refresh (1 week)
                                86400      ; retry (1 day)
                                2419200    ; expire (4 weeks)
                                604800     ; minimum (1 week)
                                )
                IN      NS      ns1.example.com.
                IN      NS      ns2.example.com.
100                     PTR     ftp.example.com.
100                     PTR     mx1.example.com.
100                     PTR     www.example.com.
100                     PTR     smtp.example.com.
100                     PTR     mail.example.com.
100                     PTR     pop3.example.com.
100                     PTR     imap.example.com.
101                     PTR     ns1.example.com.
102                     PTR     ns2.example.com.

一切正常,但 ping 命令有一个奇怪的行为:

ping mx1.example.com
64 bytes from www.example.com (192.168.1.100): icmp_seq=1 ttl=64 time=0.102 ms

ping imap.example.com
64 bytes from pop3.example.com (192.168.1.100): icmp_seq=1 ttl=64 time=0.102 ms

答案1

这是正常现象,当您尝试 ping 时会得到类似的结果www.google.com。以下是示例:

khaled@my-server:~$ ping www.google.com
PING www.google.com (216.58.212.100) 56(84) bytes of data.
64 bytes from lhr35s06-in-f4.1e100.net (216.58.212.100): icmp_seq=1 ttl=54 time=94.5 ms
64 bytes from lhr35s06-in-f4.1e100.net (216.58.212.100): icmp_seq=2 ttl=54 time=96.0 ms
64 bytes from lhr35s06-in-f4.1e100.net (216.58.212.100): icmp_seq=3 ttl=54 time=94.5 ms

您可以看到返回的名称与 ping 命令中使用的原始名称不同。这显然是一个反向 DNS 名称。要验证,您可以使用以下命令:

khaled@my-server:~$ host 216.58.212.100
100.212.58.216.in-addr.arpa domain name pointer lhr35s06-in-f100.1e100.net.
100.212.58.216.in-addr.arpa domain name pointer lhr35s06-in-f4.1e100.net.

-n您可以使用以下选项禁用反向查找:

khaled@my-server:~$ ping -n www.google.com
PING www.google.com (216.58.212.100) 56(84) bytes of data.
64 bytes from 216.58.212.100: icmp_seq=1 ttl=54 time=94.6 ms
64 bytes from 216.58.212.100: icmp_seq=2 ttl=54 time=94.6 ms

相关内容