无法使用主机名 ping 并且无法使用主机名进行 ssh

无法使用主机名 ping 并且无法使用主机名进行 ssh

我已经在 Centos6.5 中设置了一个 DNS 服务器,它可以与除 ubuntu 之外的所有客户端计算机配合使用,但现在我在使用 ubuntu 时遇到了问题。当我尝试从台式机 ping 到 DNS 服务器时,ping masterdns.arrivu.local 无法 ping 通,它返回的结果为

sysadmin@localhost:~$ ping masterdns.arrivu.local
ping: unknown host masterdns.arrivu.local

但当我用 IP 地址 ping 时,它正常工作

sysadmin@localhost:~$ ping 192.168.1.15 -c 3
PING 192.168.1.15 (192.168.1.15) 56(84) bytes of data.
64 bytes from 192.168.1.15: icmp_seq=1 ttl=64 time=0.450 ms
64 bytes from 192.168.1.15: icmp_seq=2 ttl=64 time=0.445 ms
64 bytes from 192.168.1.15: icmp_seq=3 ttl=64 time=0.265 ms

--- 192.168.1.15 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.265/0.386/0.450/0.089 ms

我已经使用主机检查过它返回的 IP

sysadmin@localhost:~$ host masterdns.arrivu.local
masterdns.arrivu.local has address 192.168.1.15

我的问题是我想使用主机名而不是 ip 来 ping 和 ssh,如下所示

ping masterdns.arrivu.local ssh[电子邮件保护]

使用装有 Ubuntu 的台式机进行即时通讯

sysadmin@localhost:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04 LTS
Release:    14.04
Codename:   trusty

我的桌面 IP 是 192.168.1.99

当我从我的桌面进行挖掘时,我得到了 DNS 的回复

sysadmin@localhost:~$ dig masterdns.arrivu.local

; <<>> DiG 9.9.5-3-Ubuntu <<>> masterdns.arrivu.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3101
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;masterdns.arrivu.local.        IN  A

;; ANSWER SECTION:
masterdns.arrivu.local. 86400   IN  A   192.168.1.15

;; AUTHORITY SECTION:
arrivu.local.       86400   IN  NS  secondarydns.arrivu.local.
arrivu.local.       86400   IN  NS  masterdns.arrivu.local.

;; ADDITIONAL SECTION:
secondarydns.arrivu.local. 86400 IN A   192.168.1.51

;; Query time: 3 msec
;; SERVER: 192.168.1.15#53(192.168.1.15)
;; WHEN: Mon May 12 10:45:42 IST 2014
;; MSG SIZE  rcvd: 124

NSlookup 也有效

sysadmin@localhost:~$ nslookup arrivu.local

Server:     192.168.1.15
Address:    192.168.1.15#53

Name:   arrivu.local
Address: 192.168.1.15
Name:   arrivu.local
Address: 192.168.1.51
Name:   arrivu.local
Address: 192.168.1.155
Name:   arrivu.local
Address: 192.168.1.84
Name:   arrivu.local
Address: 192.168.1.99
Name:   arrivu.local
Address: 192.168.1.50
Name:   arrivu.local
Address: 192.168.1.145

我的桌面界面信息

sysadmin@localhost:~$ cat /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual

auto br0
iface br0 inet static
        address 192.168.1.99
        network 192.168.1.0
        netmask 255.255.255.0
        broadcast 192.168.1.255
        gateway 192.168.1.1
    dns-nameservers 192.168.1.15 192.168.1.51
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0

sysadmin@localhost:~$ 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 192.168.1.15
nameserver 192.168.1.51
search arrivu.local

台式机或我用作 DNS 服务器的计算机上没有部署 iptables

[root@masterdns ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

DNS 正向条目

[root@masterdns named]# cat forward.arrivu 
$TTL 86400
@   IN  SOA     masterdns.arrivu.local. root.arrivu.local. (
        2014051001  ;Serial
        3600        ;Refresh
        1800        ;Retry
        604800      ;Expire
        86400       ;Minimum TTL
)
@       IN  NS          masterdns.arrivu.local.
@       IN  NS          secondarydns.arrivu.local.
@       IN  A           192.168.1.15
@       IN  A           192.168.1.51
@       IN  A           192.168.1.155
@       IN  A           192.168.1.84
@       IN  A           192.168.1.99
@       IN  A           192.168.1.50
@   IN  A       192.168.1.145
masterdns       IN  A   192.168.1.15
secondarydns    IN  A   192.168.1.51
client          IN  A   192.168.1.155
sukumar         IN  A   192.168.1.84
babin           IN  A   192.168.1.99
server      IN  A   192.168.1.50
test        IN  A   192.168.1.145

DNS 反向条目

[root@masterdns named]# cat reverse.arrivu 
$TTL 86400
@   IN  SOA     masterdns.arrivu.local. root.arrivu.local. (
        2014051001  ;Serial
        3600        ;Refresh
        1800        ;Retry
        604800      ;Expire
        86400       ;Minimum TTL
)
@       IN  NS          masterdns.arrivu.local.
@       IN  NS          secondarydns.arrivu.local.
@       IN  PTR         arrivu.local.
masterdns       IN  A   192.168.1.15
secondarydns    IN  A   192.168.1.51
client          IN  A   192.168.1.155
sukumar     IN  A   192.168.1.84
babin       IN  A   192.168.1.99
server      IN  A   192.168.1.50
test        IN  A   192.168.1.145
15      IN  PTR         masterdns.arrivu.local.
51      IN  PTR         secondarydns.arrivu.local.
155     IN  PTR         client.arrivu.local.
84  IN  PTR     sukumar.arrivu.local.
99  IN  PTR     babin.arrivu.local.
50  IN  PTR     server.arrivu.local.
145 IN  PTR     test.arrivu.local.

指导我找到修复伙伴

相关内容