|
本帖最后由 sunsili 于 2023-7-31 14:23 编辑
【openwrt】dns失效 出现 ping: bad address 错误 解决方法
现象
ping 命令
ping baidu.com
ping: bad address 'baidu.com'
返回找不到主机
尝试
1、重新启动OpenWrt设备:在OpenWrt平台上进行一个简单的重启可能会解决问题。还是末解决
2、执行
ps
查看dns相关服务(默认是dnsmasq)有没有启动,
发现没有启动dns相关服务
手动启动dnsmasq
./etc/init.d/dnsmasq start
发现依然没有启动dnsmasq
判定为配置文件错误
解决方法
编辑dnsmasq配置文件/var/etc/dnsmasq.conf
vim /var/etc/dnsmasq.conf
# auto-generated config file from /etc/config/dhcp
conf-file=/etc/dnsmasq.conf
dhcp-authoritative
domain-needed
localise-queries
read-ethers
bogus-priv
expand-hosts
local-service
domain=lan
server=/lan/
dhcp-leasefile=/tmp/dhcp.leases
resolv-file=/tmp/resolv.conf.auto
addn-hosts=/tmp/hosts
conf-dir=/tmp/dnsmasq.d
stop-dns-rebind
rebind-localhost-ok
dhcp-broadcast=tag:needs-broadcast
手动启动dnsmasq
./etc/init.d/dnsmasq start
测试一下
ping baidu.com
Pinging baidu.com [110.242.68.66] with 32 bytes of data:
Reply from 110.242.68.66: bytes=32 time=33ms TTL=50
Reply from 110.242.68.66: bytes=32 time=32ms TTL=50
Reply from 110.242.68.66: bytes=32 time=32ms TTL=50
问题解决
|
+13 最近谁赞过
|