环境是 VMware 虚拟机装的 Linux Mint ,在 VMware 软件的 NAT 网络模式里面设置了 DNS: 10.x 的公司内网 DNS 两个公开 DNS 223.5.5.5 8.8.8.8
为啥要在 VMware 里面设置 DNS 是由于出差在外面用 4G 连公司 VPN 的时候,老是解析不了公司内网的 API 接口,于是把公司内网 DNS 直接设置到了 VMWare 的 NAT 模式下的 DNS 配置中。
然后我回到公司接入网线,发现 dig 不好使了,nslookup 倒是没有问题。
nslookup
> www.baidu.com
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 220.181.38.150
Name: www.a.shifen.com
Address: 220.181.38.149
dig 的话,指定 dns 服务器均提示 connection timed out
# mint @ mint-virtual-machine in ~ [14:30:23] C:9
$ ping 114.114.114.114
PING 114.114.114.114 (114.114.114.114) 56(84) bytes of data.
64 bytes from 114.114.114.114: icmp_seq=1 ttl=128 time=20.8 ms
64 bytes from 114.114.114.114: icmp_seq=2 ttl=128 time=21.7 ms
^C
--- 114.114.114.114 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 20.898/21.313/21.728/0.415 ms
(base)
# mint @ mint-virtual-machine in ~ [14:41:22]
$ dig @114.114.114.114 www.baidu.com
; <<>> DiG 9.11.3-1ubuntu1.15-Ubuntu <<>> @114.114.114.114 www.baidu.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
(base)
# mint @ mint-virtual-machine in ~ [14:41:48] C:9
$ dig @114.114.114.114 +notrace www.baidu.com
; <<>> DiG 9.11.3-1ubuntu1.15-Ubuntu <<>> @114.114.114.114 +notrace www.baidu.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
不指定的话显示是从 127.0.0.53 获取的解析记录,但是不指定的情况下+trace 参数失效。
(base)
# mint @ mint-virtual-machine in ~ [14:42:38] C:9
$ dig www.baidu.com
; <<>> DiG 9.11.3-1ubuntu1.15-Ubuntu <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6883
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;www.baidu.com. IN A
;; ANSWER SECTION:
www.baidu.com. 5 IN CNAME www.a.shifen.com.
www.a.shifen.com. 4 IN A 220.181.38.150
www.a.shifen.com. 4 IN A 220.181.38.149
;; Query time: 331 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Thu Jan 20 14:42:53 CST 2022
;; MSG SIZE rcvd: 101
(base)
# mint @ mint-virtual-machine in ~ [14:42:53]
$ dig +trace www.baidu.com
; <<>> DiG 9.11.3-1ubuntu1.15-Ubuntu <<>> +trace www.baidu.com
;; global options: +cmd
;; Received 51 bytes from 127.0.0.53#53(127.0.0.53) in 0 ms
1
liuxu 2022-01-20 19:08:41 +08:00
内部和外部用 tcpdump 抓个 53 的包看看
|