![nslookup 行为不一致](https://linux22.com/image/171627/nslookup%20%E8%A1%8C%E4%B8%BA%E4%B8%8D%E4%B8%80%E8%87%B4.png)
当我运行时nslookup google.com 192.168.190.81
它有效。
tcpdump -n -vv
上述命令的输出是:
18:12:24.815483 IP (tos 0x0, ttl 64, id 8975, offset 0, flags [none], proto UDP (17), length 56)
192.168.190.85.50601 > 192.168.190.81.53: [bad udp cksum 0xfe2d -> 0xd17b!] 22170+ A? google.com. (28)
18:12:24.816513 IP (tos 0x0, ttl 128, id 42598, offset 0, flags [none], proto UDP (17), length 82)
192.168.190.81.53 > 192.168.190.85.50601: [udp sum ok] 22170- q: A? google.com. 1/0/0 google.com. A 172.217.18.46 (54)
18:12:24.816971 IP (tos 0x0, ttl 64, id 8976, offset 0, flags [none], proto UDP (17), length 56)
192.168.190.85.35152 > 192.168.190.81.53: [bad udp cksum 0xfe2d -> 0x81ff!] 57940+ AAAA? google.com. (28)
18:12:24.817741 IP (tos 0x0, ttl 128, id 42599, offset 0, flags [none], proto UDP (17), length 94)
192.168.190.81.53 > 192.168.190.85.35152: [udp sum ok] 57940- q: AAAA? google.com. 1/0/0 google.com. AAAA 2a00:1450:4006:805::200e (66)
当我运行nslookup google.com
它时超时。
tcpdump -n -vv
上述命令的输出是:
18:12:38.205600 IP (tos 0x0, ttl 64, id 23707, offset 0, flags [DF], proto TCP (6), length 60)
192.168.190.85.39750 > 192.168.190.81.53: Flags [S], cksum 0xfe26 (incorrect -> 0x0fa0), seq 1276672993, win 64240, options [mss 1460,sackOK,TS val 273927086 ecr 0,nop,wscale 7], length 0
18:12:38.205948 IP (tos 0x0, ttl 128, id 42600, offset 0, flags [DF], proto TCP (6), length 40)
192.168.190.81.53 > 192.168.190.85.39750: Flags [R.], cksum 0x4e62 (correct), seq 0, ack 1276672994, win 0, length 0
18:12:38.206190 IP (tos 0x0, ttl 64, id 10801, offset 0, flags [DF], proto TCP (6), length 60)
192.168.190.85.39752 > 192.168.190.81.53: Flags [S], cksum 0xfe26 (incorrect -> 0x7d01), seq 456474464, win 64240, options [mss 1460,sackOK,TS val 273927087 ecr 0,nop,wscale 7], length 0
18:12:38.206488 IP (tos 0x0, ttl 128, id 42601, offset 0, flags [DF], proto TCP (6), length 40)
所以我的问题是:为什么当没有明确指定 DNS 服务器时,它会更改为 TCP(我猜服务器不支持)?
有关环境的一些信息:
- 这是 Windows 10 上 Hyper-V 上的 Ubuntu 18.04 机器
-192.168.190.85
是机器的 IP -192.168.190.81
是 Ubuntu 机器内的默认网关