剛配置好 PPPoE 撥號,想 ping 一下互聯網,就遇到了 DNS 問題:bash
$ ping www.baidu.com ping: bad address 'www.baidu.com'
查看本機的 DNS 配置:服務器
$ cat /etc/resolv.conf search lan nameserver 127.0.0.1
發現使用的是本機 DNS 服務器,即 dnsmasq。rest
查看 dnsmasq 配置:code
$ cat /etc/dnsmasq.conf conf-dir=/etc/dnsmasq.d
查看 dnsmasq.d 文件夾,爲空。server
搜索一番配置,在 dnsmasq.d 文件夾下建立了 dns.conf 文件:dns
# 忽略默認解析文件 /etc/resolv.conf # 默認解析文件即本機的解析設置,多是經過 DHCP 獲取的,不推薦使用 no-resolv # 手動指定上游服務器 server=223.5.5.5 server=223.6.6.6
重啓 dnsmasq 服務:路由
$ /etc/init.d/dnsmasq restart
如今路由器可以成功查到 DNS 了,大功告成。it