运行 Kubuntu 16.04
有时名称解析会变得很慢。在以前的 Ubuntu 版本中,问题通常出在 resolv.conf 中,而且很容易修复。在 16.04 中,所有 DNS 解析都隐藏在 NetworkManager+resolvconf+dsnmasq 迷宫中,我不知道如何找出实际的 DNS(dig
显示为 127.0.1.1)。
有好心人可以解释一下吗:
- NetworkManager、resolvconf 和 dsnmasq 如何协同工作(因为每个文档中都没有解释这一点)
- 如何调试 DNS 性能问题
附加信息
ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 29 Apr 8 2017 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
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 127.0.1.1
dpkg -l *dnsmasq*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
un dnsmasq <none> <none> (no description available)
ii dnsmasq-base 2.75-1ubuntu amd64 Small caching DNS proxy and DHCP/
host -v www.ebay.com
Trying "www.ebay.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46563
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.ebay.com. IN A
;; ANSWER SECTION:
www.ebay.com. 292 IN CNAME slot9428.ebay.com.edgekey.net.
slot9428.ebay.com.edgekey.net. 10094 IN CNAME e9428.b.akamaiedge.net.
e9428.b.akamaiedge.net. 12 IN A 104.80.20.236
Received 122 bytes from 127.0.1.1#53 in 2 ms
Trying "e9428.b.akamaiedge.net"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35831
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;e9428.b.akamaiedge.net. IN AAAA
;; AUTHORITY SECTION:
b.akamaiedge.net. 674 IN SOA n0b.akamaiedge.net. hostmaster.akamai.com. 1564414527 1000 1000 1000 1800
Received 101 bytes from 127.0.1.1#53 in 2 ms
Trying "e9428.b.akamaiedge.net"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16147
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;e9428.b.akamaiedge.net. IN MX
;; AUTHORITY SECTION:
b.akamaiedge.net. 992 IN SOA n0b.akamaiedge.net. hostmaster.akamai.com. 1564414845 1000 1000 1000 1800
Received 101 bytes from 127.0.1.1#53 in 2 ms
cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
cat /etc/hosts | head
127.0.0.1 localhost
127.0.1.1 Xenoid
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq
[ifupdown]
managed=false
cat /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat
group: compat
shadow: compat
gshadow: files
hosts: files mdns4_minimal [NOTFOUND=return] dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis