我的拓扑:NAT->NetGear 路由器(192.168.1.1 + 有线机器)-> TP-Link(192.168.0.1 [在 NetGear LAN 192.168.1.2 中],其中一些机器是无线的,一些是有线的)。
我的问题是我无法从 TP-Link LAN 中的 Ubuntu 12.10 机器的 DNS 获得响应:
dig @8.8.8.8 wp.pl
; <<>> DiG 9.9.2-P2 <<>> @8.8.8.8 wp.pl
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
但是它可以与 +tcp 选项一起使用:
dig @8.8.8.8 wp.pl +tcp
; <<>> DiG 9.9.2-P2 <<>> @8.8.8.8 wp.pl +tcp
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64773
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;wp.pl. IN A
;; ANSWER SECTION:
wp.pl. 1951 IN A 212.77.100.101
;; Query time: 35 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sun May 5 20:27:42 2013
;; MSG SIZE rcvd: 50
我的配置是:
nm-tool | tail -n 8 地址:192.168.0.100 前缀:24 (255.255.255.0) 网关:192.168.0.1
DNS: 8.8.8.8 DNS: 62.179.1.60
问题:这是否与路由器之一不允许 udp 流量有关?我禁用了防火墙,在 NetGear 中设置了 TP-Link DMZ,在 TP-Link 中设置了我的计算机 DMZ,因此所有安全性都已关闭,+tcp 仍然可以工作,但没有它就无法工作。那么我如何才能搜索网络?Tcp 是浏览器使用的后门?但我有 sendmail 并且需要解析域。
现在我将 TP-Link 主 DNS 设置为 192.168.0.1,将辅助 DNS 设置为 192.168.1.1,并且 dig google.com 运行正常,而 +tcp 给出:
nm-tool | tail -n 8
Address: 192.168.0.100
Prefix: 24 (255.255.255.0)
Gateway: 192.168.0.1
DNS: 192.168.0.1
DNS: 192.168.1.1
dig google.com +tcp
;; Connection to 192.168.0.1#53(192.168.0.1) for google.com failed: connection refused.
;; Connection to 192.168.1.1#53(192.168.1.1) for google.com failed: connection refused.
; <<>> DiG 9.9.2-P2 <<>> google.com +tcp
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 30305
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;google.com. IN A
;; Query time: 2 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Sun May 5 21:21:28 2013
;; MSG SIZE rcvd: 28
dig @192.168.1.1 wp.pl
; <<>> DiG 9.9.2-P2 <<>> @192.168.1.1 wp.pl
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
root@mycomp:# dig @192.168.0.1 wp.pl
; <<>> DiG 9.9.2-P2 <<>> @192.168.0.1 wp.pl
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
独自挖掘:
dig wp.pl
; <<>> DiG 9.9.2-P2 <<>> wp.pl
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29863
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;wp.pl. IN A
;; ANSWER SECTION:
wp.pl. 2308 IN A 212.77.100.101
;; Query time: 3 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Sun May 5 21:48:12 2013
;; MSG SIZE rcvd: 50
更新:在这里我确实挖掘了 cf16.eu,并在终端响应中注意到来自 127.0.1.1
sudo tcpdump udp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
01:03:11.451045 IP ubuntuamd.local.33228 > 192.168.1.1.domain: 37219+ [1au] A? cf16.eu. (36)
01:03:11.452092 IP ubuntuamd.local.43741 > 192.168.1.1.domain: 33781+ PTR? 1.1.168.192.in-addr.arpa. (42)
01:03:11.490142 IP 192.168.1.1.domain > ubuntuamd.local.33228: 37219 1/0/1 A 89.75.41.50 (52)
01:03:11.491794 IP 192.168.1.1.domain > ubuntuamd.local.43741: 33781 NXDomain 0/0/0 (42)
01:03:11.592530 IP6 fe80::d63d:7eff:fe4b:47dc.mdns > ff02::fb.mdns: 0 PTR (QM)? 1.1.168.192.in-addr.arpa. (42)
01:03:11.592582 IP ubuntuamd.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 1.1.168.192.in-addr.arpa. (42)
在这里我确实挖掘了@192.168.1.1 cf16.eu 并且在终端中没有响应:
01:03:19.834587 IP ubuntuamd.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 251.0.0.224.in-addr.arpa. (42)
01:03:20.287162 IP ubuntuamd.local.50346 > 192.168.1.1.domain: 44668+ [1au] A? cf16.eu. (36)
01:03:21.734093 IP ubuntuamd.local.56600 > 192.168.1.1.domain: 1574+ PTR? 255.1.168.192.in-addr.arpa. (44)
01:03:21.768017 IP 192.168.1.1.domain > ubuntuamd.local.56600: 1574 NXDomain 0/0/0 (44)
01:03:21.868586 IP6 fe80::d63d:7eff:fe4b:47dc.mdns > ff02::fb.mdns: 0 PTR (QM)? 255.1.168.192.in-addr.arpa. (44)
01:03:21.868662 IP ubuntuamd.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 255.1.168.192.in-addr.arpa. (44)
01:03:22.870220 IP6 fe80::d63d:7eff:fe4b:47dc.mdns > ff02::fb.mdns: 0 PTR (QM)? 255.1.168.192.in-addr.arpa. (44)
01:03:22.870299 IP ubuntuamd.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 255.1.168.192.in-addr.arpa. (44)
01:03:24.871850 IP6 fe80::d63d:7eff:fe4b:47dc.mdns > ff02::fb.mdns: 0 PTR (QM)? 255.1.168.192.in-addr.arpa. (44)
01:03:24.871930 IP ubuntuamd.local.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 255.1.168.192.in-addr.arpa. (44)
01:03:25.292325 IP ubuntuamd.local.50346 > 192.168.1.1.domain: 44668+ [1au] A? cf16.eu. (36)
01:03:30.292679 IP ubuntuamd.local.50346 > 192.168.1.1.domain: 44668+ [1au] A? cf16.eu. (36)
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 18134/sendmail: MTA
tcp 0 0 192.168.1.3:25 0.0.0.0:* LISTEN 18134/sendmail: MTA
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1337/mysqld
tcp 0 0 127.0.0.1:587 0.0.0.0:* LISTEN 18134/sendmail: MTA
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN 1456/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1131/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 992/cupsd
tcp 0 0 192.168.1.3:53096 173.194.70.102:80 ESTABLISHED 2534/chrome
tcp 0 0 192.168.1.3:56894 208.117.224.54:443 ESTABLISHED 2534/chrome
tcp 0 0 192.168.1.3:39479 212.58.244.130:80 ESTABLISHED 2534/chrome
tcp 0 0 127.0.0.1:3306 127.0.0.1:34975 ESTABLISHED 1337/mysqld
tcp 0 0 127.0.0.1:3306 127.0.0.1:35189 ESTABLISHED 1337/mysqld
tcp 0 0 192.168.1.3:45269 208.117.224.114:443 ESTABLISHED 2534/chrome
tcp 1 0 192.168.1.3:41464 91.189.94.25:80 CLOSE_WAIT 2520/ubuntu-geoip-p
tcp 0 0 192.168.1.3:42429 46.28.246.119:443 ESTABLISHED 2534/chrome
tcp 0 0 192.168.1.3:55689 92.122.210.38:80 TIME_WAIT -
tcp 0 0 127.0.0.1:3306 127.0.0.1:35191 ESTABLISHED 1337/mysqld
tcp 0 0 127.0.0.1:3306 127.0.0.1:34978 ESTABLISHED 1337/mysqld
tcp 0 0 192.168.1.3:57867 173.194.70.154:443 ESTABLISHED 2534/chrome
tcp 0 0 127.0.0.1:3306 127.0.0.1:34977 ESTABLISHED 1337/mysqld
tcp 0 0 192.168.1.3:33444 198.252.206.25:80 ESTABLISHED 2534/chrome
tcp 0 0 192.168.1.3:55585 173.194.70.19:443 ESTABLISHED 2534/chrome
tcp 0 0 192.168.1.3:37296 217.119.79.24:443 ESTABLISHED 2534/chrome
tcp 0 0 192.168.1.3:60732 198.252.206.25:80 ESTABLISHED 2534/chrome
tcp 0 0 192.168.1.3:38625 192.168.0.101:445 ESTABLISHED -
tcp 0 0 127.0.0.1:3306 127.0.0.1:35188 ESTABLISHED 1337/mysqld
tcp 0 0 127.0.0.1:3306 127.0.0.1:34976 ESTABLISHED 1337/mysqld
tcp 0 0 127.0.0.1:3306 127.0.0.1:35190 ESTABLISHED 1337/mysqld
tcp 0 0 192.168.1.3:55687 92.122.210.38:80 ESTABLISHED 2534/chrome
tcp 0 0 192.168.1.3:60704 198.252.206.25:80 ESTABLISHED 2534/chrome
tcp 0 0 192.168.1.3:36650 74.125.136.125:5222 ESTABLISHED 2534/chrome
tcp 0 0 192.168.1.3:60176 23.61.248.91:80 ESTABLISHED 2534/chrome
tcp 0 0 192.168.1.3:58835 91.189.89.114:443 ESTABLISHED 2755/python
tcp 0 0 192.168.1.3:55688 92.122.210.38:80 TIME_WAIT -
tcpdump:
sudo tcpdump -nv src 192.168.1.1 and udp port 67 and udp port 68
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
22:22:50.106632 IP (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto UDP (17), length 576)
192.168.1.1.67 > 192.168.1.3.68: BOOTP/DHCP, Reply, length 548, xid 0x3f6fa026, Flags [none]
Your-IP 192.168.1.3
Client-Ethernet-Address d4:3d:7e:4b:47:dc
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: ACK
Server-ID Option 54, length 4: 192.168.1.1
Lease-Time Option 51, length 4: 86400
Subnet-Mask Option 1, length 4: 255.255.255.0
Default-Gateway Option 3, length 4: 192.168.1.1
Domain-Name-Server Option 6, length 4: 192.168.1.1
Domain-Name Option 15, length 9: "chello.pl"
答案1
当您执行此操作时dig @8.8.8.8 wp.pl
,请求将发送到 Google 的名称服务器。Google 的名称服务器对域名 wp.pl 没有权威性。(无论您在搜索域中设置了什么);(最后一点可能会带来麻烦;dig @8.8.8.8 wp.pl.
将来请这样做以停止额外的搜索。),如果它没有缓存记录可以提供给您,它会告诉您哪个名称服务器对该域具有权威性;然后第二个请求将被发送到 Google 为您提供的服务器……
但是……对于名称服务器,您可能希望使用 DHCP 为您分配的名称服务器;我怀疑 192.168.1.1 和 0.1 都没有分配给您。我从 DHCP 获得的唯一 DNS 服务器对应于我的 DSL 调制解调器/路由器的网关,这意味着在我的本地配置中只有一个解析器是完美的:如果我无法访问我的网关,或者我的网关无法与它从其配置 DHCP 服务器(我无法查看)获得的任何 DNS 服务器通信,那么我添加的任何手动添加都不太可能提供任何额外的实用性,但可能会降低 DNS 查询的性能,从而降低我对我的互联网活动的感知响应能力。
当我使用以下 tcpdump 语句查看 DHCP 数据时:
mini-nevie:~ root# tcpdump -i en1 -nv udp port 67 and udp port 68
我从 DCHP 服务器获得的最后一个数据包,ACK(确认)数据包包含我的主机的配置参数:
13:45:15.065227 IP (tos 0x71,ECT(1), ttl 64, id 42740, offset 0, flags [none], proto UDP (17), length 576)
192.168.2.1.67 > 192.168.2.12.68: BOOTP/DHCP, Reply, length 548, xid 0x3392bc07, Flags [none]
Your-IP 192.168.2.12
Client-Ethernet-Address 68:a8:6d:58:5b:f3
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: ACK
Subnet-Mask Option 1, length 4: 255.255.255.0
Lease-Time Option 51, length 4: 259200
Default-Gateway Option 3, length 4: 192.168.2.1
Domain-Name-Server Option 6, length 8: 192.168.2.1,192.168.2.1
Domain-Name Option 15, length 20: "no-domain-set.aliant"
Server-ID Option 54, length 4: 192.168.2.1
Hostname Option 12, length 10: "mini-nevie"
在“域名服务器选项 6”字段中,DHCP 服务器为我提供了 2 个 IP 地址;在本例中,它们是相同的。它们恰好与我的网关 192.168.2.1 匹配。虽然我查看了 DSLmodem 的所有配置页面,但我看不到它正在使用哪些服务器。在我之前的服务中,我直接在 Mac 上执行了 PPOE,如果我没记错的话,这两个服务器是我所在省份的本地解析器。
我的建议是使用通过 DHCP 提供给您的名称服务器。