我无法通过ping来解析域,但是DIG,NSLOOKUP和HOST可以很好地解析域。
[root@xxx ~]# cat /etc/resolv.conf | grep nameserver
nameserver 127.0.0.1
nameserver 114.114.114.114
nameserver 8.8.8.8
[root@xxx ~]# cat /etc/nsswitch.conf | grep hosts
hosts: files dns myhostname mdns
[root@xxx ~]# ping 8.8.8.8 -c 1
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.<br/>
64 bytes from 8.8.8.8: icmp_seq=1 ttl=117 time=71.1 ms
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 71.173/71.173/71.173/0.000 ms
[root@xxx ~]#
[root@xxx ~]# ping google.com
ping: google.com: Name or service not known
[root@xxx ~]# host google.com
google.com has address 216.58.223.110
google.com has IPv6 address 2a00:1450:401a:804::200e
google.com mail is handled by 40 alt3.aspmx.l.google.com.
google.com mail is handled by 50 alt4.aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.
google.com mail is handled by 10 aspmx.l.google.com.
google.com mail is handled by 20 alt1.aspmx.l.google.com.
[root@xxx ~]# nslookup google.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
Name: google.com
Address: 216.58.223.110
[root@xxx ~]# dig google.com
; <<>> DiG 9.9.4-RedHat-9.9.4-51.el7 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64421
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 9
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 290 IN A 216.58.223.110
;; AUTHORITY SECTION:
google.com. 172790 IN NS ns3.google.com.
google.com. 172790 IN NS ns4.google.com.
google.com. 172790 IN NS ns2.google.com.
google.com. 172790 IN NS ns1.google.com.
;; ADDITIONAL SECTION:
ns2.google.com. 172790 IN A 216.239.34.10
ns2.google.com. 172790 IN AAAA 2001:4860:4802:34::a
ns1.google.com. 172790 IN A 216.239.32.10
ns1.google.com. 172790 IN AAAA 2001:4860:4802:32::a
ns3.google.com. 172790 IN A 216.239.36.10
ns3.google.com. 172790 IN AAAA 2001:4860:4802:36::a
ns4.google.com. 172790 IN A 216.239.38.10
ns4.google.com. 172790 IN AAAA 2001:4860:4802:38::a
;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Oct 19 12:13:50 CAT 2018
;; MSG SIZE rcvd: 303
[root@xxx ~]#