使用命令time dig google.com
看到域名解析需要1秒多
real 0m1.037s
user 0m0.016s
sys 0m0.012s
查看文件/etc/resolv.conf内容
现在这是一个链接文件
lrwxrwxrwx 1 root root 29 Nov 20 07:55 /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 192.168.1.1
nameserver 8.8.8.8
nameserver 8.8.4.4
search localdomain
在域名解析的时候会根据nameserver的顺序去查询
因为服务器是LAN和WAN都通过dhcp获取地址
resolvconf在设置naneserver的时候把内网的IP设置在最前面了
导致第一次查询失败
通过修改文件/etc/resolvconf/interface-order来调整nameserver的顺序
查看文件/etc/resolvconf/interface-order原始的内容