我的地址:
user@pc1:~$ ifconfig eth0 |grep "inet "
inet addr:192.168.2.10 Bcast:192.168.2.255 Mask:255.255.255.0
我可以 ping 这个地址
user@pc1:~$ ping -c 1 192.168.2.11
PING 192.168.2.11 (192.168.2.11) 56(84) bytes of data.
64 bytes from 192.168.2.11: icmp_req=1 ttl=64 time=0.686 ms
--- 192.168.2.11 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.686/0.686/0.686/0.000 ms
但 ping 其主机名似乎可以解析 IP 地址,但它没有返回 ping。
user@pc1:~$ ping -c 1 pc2.dtvg.nix
PING pc2.dtvg.nix (192.128.2.11) 56(84) bytes of data.
--- pc2.dtvg.nix ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
而 ping 同一网络上的另一个主机名则工作正常。
user@pc1 ~$ ping -c1 gw.dtvg.nix
PING gw.dtvg.nix (192.168.2.1) 56(84) bytes of data.
64 bytes from gw.dtvg.nix (192.168.2.1): icmp_req=1 ttl=64 time=0.220 ms
--- gw.dtvg.nix ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.220/0.220/0.220/0.000 ms
我的 /etc/resolv.conf
user@pc1:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
search dtvg.nix
我的名称服务器 (gw) 上的 named.conf
root@gw:/var/cache/bind# cat /etc/bind/named.conf.local
zone "dtvg.nix" {
type master;
file "/var/cache/bind/db.dtvg.nix";
allow-update { key dhcpupdate; };
};
zone "2.168.192.in-addr.arpa" {
type master;
notify no;
file "/var/cache/bind/db.2.168.192.in-addr.arpa";
allow-update { key dhcpupdate; };
};
在我的名称服务器 gw 上进行反向查找,并删除不必要的主机
root@gw:/var/cache/bind# cat db.2.168.192.in-addr.arpa
$ORIGIN .
$TTL 604800 ; 1 week
2.168.192.in-addr.arpa IN SOA dtvg.nix. root.dtvg.nix. (
140 ; serial
604800 ; refresh (1 week)
86400 ; retry (1 day)
2419200 ; expire (4 weeks)
604800 ; minimum (1 week)
)
NS gw.dtvg.nix.
$ORIGIN 2.168.192.in-addr.arpa.
1 PTR gw.dtvg.nix.
$TTL 604800 ; 1 week
10 PTR pc1
11 PTR pc2
我的名称服务器 gw 上的正向查找区域文件,删除了不必要的主机
root@phoenix:/var/cache/bind# cat db.dtvg.nix
$ORIGIN .
$TTL 604800 ; 1 week
dtvg.nix IN SOA dtvg.nix. root.dtvg.nix. (
140 ; serial
604800 ; refresh (1 week)
86400 ; retry (1 day)
2419200 ; expire (4 weeks)
604801 ; minimum (1 week 1 second)
)
NS gw.dtvg.nix
$ORIGIN dtvg.nix.
$TTL 604800 ; 1 week
gw A 192.168.2.1
pc1 A 192.128.2.10
pc2 A 192.128.2.11
答案1
在区域文件中, 的 IP 地址与您成功 ping 的IP 地址不同pc2.dtvg.nix
:。192.128.2.11
192.168.2.11
您确认区域文件中的 IP 地址/var/cache/bind/db.dtvg.nix
有误,请更正:
$ORIGIN .
$TTL 604800 ; 1 week
dtvg.nix IN SOA dtvg.nix. root.dtvg.nix. (
140 ; serial
604800 ; refresh (1 week)
86400 ; retry (1 day)
2419200 ; expire (4 weeks)
604801 ; minimum (1 week 1 second)
)
NS gw.dtvg.nix
$ORIGIN dtvg.nix.
$TTL 604800 ; 1 week
gw A 192.168.2.1
pc1 A 192.168.2.10
pc2 A 192.168.2.11