我面临的问题如下:
我已经配置了一个虚拟机 Ubuntu,但该机器无法使用我的内部 DNS 服务器解析 DNS 记录。“DNS 服务器是 windows_server_2008_R2 AD/DNS 组合”
Ubuntu 配置:
root@rboshmaf-ubuntu:~# 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 static
address 192.168.1.12
netmask 255.255.255.0
dns-nameservers 172.16.1.11 144.254.71.184
gateway 192.168.1.1
root@rboshmaf-ubuntu:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
root@rboshmaf-ubuntu:~# 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 172.16.1.11
nameserver 144.254.71.184
与Ubuntu处于同一网络“使用同一个DNS服务器”的vm wimdows_7机器能够得到结果。
ASA 配置“流量从高安全性 > 低安全性,需要进行检查”
在 ASA 上捕获了信息以查看发生了什么,我发现奇怪的是,在 Ubuntu“不工作的情况下”,查询将转到 1.1.168.192.in-addr.arpa
在 Windows“工作情况”下,查询将转到 1.1.16.172.in-addr.arpa
请记住,Windows 服务器 IP 是 172.16.1.11,DNS 记录都在那里
从 windows_7 ping\nslookup
C:\Users\administrator>ping 172.16.1.11
Pinging 172.16.1.11 with 32 bytes of data:
Reply from 172.16.1.11: bytes=32 time=1ms TTL=128
Ping statistics for 172.16.1.11:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 1ms, Average = 1ms
Control-C
^C
C:\Users\administrator>nslookup rboshmaf-ubuntu 172.16.1.11
Server: win-o33saf37ksq.raedlab.local
Address: 172.16.1.11
Name: rboshmaf-ubuntu.raedlab.local
Address: 192.168.1.12
从 Ubuntu ping\nslookup
root@rboshmaf-ubuntu:~# ping 172.16.1.11
PING 172.16.1.11 (172.16.1.11) 56(84) bytes of data.
64 bytes from 172.16.1.11: icmp_seq=1 ttl=128 time=1.25 ms
^C
--- 172.16.1.11 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.258/1.258/1.258/0.000 ms
root@rboshmaf-ubuntu:~# nslookup rboshmaf-ubuntu 172.16.1.11
Server: 172.16.1.11
Address: 172.16.1.11#53
** server can't find rboshmaf-ubuntu: SERVFAIL
我不喜欢捕获的内容是,Ubuntu 查询将转到 1.1.168.192.in-addr.arpa,而这不是 DNS 服务器,实际上 192.168.1.1 是 Ubuntu 的网关,位于“ASA 的内部接口”
对于该情况有任何想法或建议吗?
谢谢!
编辑#1
为了从图片中删除 ASA,我重新配置了拓扑,如下所示:
新的 Ubuntu 配置:
root@rboshmaf-ubuntu:~# 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 static
address 172.16.1.12
netmask 255.255.255.0
dns-nameservers 172.16.1.11 144.254.71.184
gateway 172.16.1.1
root@rboshmaf-ubuntu:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:99:3c:b3
inet addr:172.16.1.12 Bcast:172.16.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20756 errors:0 dropped:0 overruns:0 frame:0
TX packets:6959 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:29614255 (29.6 MB) TX bytes:480744 (480.7 KB)
root@rboshmaf-ubuntu:~# 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 172.16.1.11
nameserver 144.254.71.184
root@rboshmaf-ubuntu:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface
default 172.16.1.1 0.0.0.0 UG 0 0 0
eth0
link-local * 255.255.0.0 U 1000 0 0
eth0
172.16.1.0 * 255.255.255.0 U 0 0 0
eth0
从 Ubuntu 执行 ping/nslookup
root@rboshmaf-ubuntu:~# ping 172.16.1.11
PING 172.16.1.11 (172.16.1.11) 56(84) bytes of data.
64 bytes from 172.16.1.11: icmp_seq=1 ttl=128 time=1.23 ms
64 bytes from 172.16.1.11: icmp_seq=2 ttl=128 time=0.811 ms
64 bytes from 172.16.1.11: icmp_seq=3 ttl=128 time=0.981 ms
^C
--- 172.16.1.11 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.811/1.007/1.231/0.176 ms
root@rboshmaf-ubuntu:~# nslookup rboshmaf-ubuntu 172.16.1.11
Server: 172.16.1.11
Address: 172.16.1.11#53
** server can't find rboshmaf-ubuntu: SERVFAIL
捕获 ASA 确认没有流量到达 ASA
rboshmaf-asa# capture cap1 interface dmz match ip h 172.16.1.12 h 172.16.1.11
rboshmaf-asa# show capture
capture cap1 type raw-data interface dmz [Capturing - 0 bytes]
match ip host 172.16.1.12 host 172.16.1.11
我在 ubuntu 上使用 tcpdump
root@rboshmaf-ubuntu:~# tcpdump -n -i eth0 | grep 172.16.1.11.53
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
10:17:07.417553 IP 172.16.1.12.54685 > 172.16.1.11.53: 43282+ A? rboshmaf-ubuntu. (33)
10:17:07.418939 IP 172.16.1.11.53 > 172.16.1.12.54685: 43282 ServFail 0/0/0 (33)
10:17:27.270067 IP 172.16.1.12.56675 > 172.16.1.11.53: 50648+ A? ntp.ubuntu.com. (32)
10:17:27.270803 IP 172.16.1.11.53 > 172.16.1.12.56675: 50648 3/0/0 A 91.189.89.198, A 91.189.89.199, A 91.189.91.157 (80)
谢谢!
答案1
我的猜测是:
- DNS 服务器不接受端口 53 上的请求。请尝试使用
telnet
端口53
来测试。 - 如果流程正常,请检查您的
/etc/hosts
Ubuntu,可能有一个可能产生冲突的本地记录。 - 如果以上方法没有给你答案,那么可能是 DNS 服务器的配置有问题。确保你已配置 A 记录以及用于授权的 NS 记录。
答案2
问题是机器不知道在哪个 FQDN 中搜索,我编辑了 /etc/network/interfaces 以包含“dns-search raedlab.local”
rboshmaf@rboshmaf-ubuntu:~$ 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 static
address 192.168.1.12
netmask 255.255.255.0
dns-nameservers 172.16.1.11 144.254.71.184
gateway 192.168.1.1
dns-search raedlab.local < this was missing in my configuration
rboshmaf@rboshmaf-ubuntu:~$ nslookup rboshmaf-ubuntu 172.16.1.11
Server: 172.16.1.11
Address: 172.16.1.11#53
Name: rboshmaf-ubuntu.raedlab.local
Address: 192.168.1.12
你也可以查看 askubuntu 上的这篇文章,了解有关 dns-search 功能的信息/etc/network/interfaces 中的 dns-search 选项含义是什么?