如何正确的找到 openwrt wan 口获取的 dns?

2023-06-21 08:57:19 +08:00
 Jobin0528

目前是光猫桥接软路由播号, 试过以下方案:

  1. nslookup 找到的是 127.0.0.1
  2. 去上游光猫找到是 移动内网的 DNS
1250 次点击
所在节点    OpenWrt
5 条回复
neroxps
2023-06-21 09:29:38 +08:00
openwrt 是用 dnsmasq 代理的,所以本机 nslookup 就是 127.你得看 dnsmasq 的上游 dns ,命令行是 uci show dhcp
Jobin0528
2023-06-21 09:35:17 +08:00
@neroxps #1
```
root@OpenWrt:~# uci show dhcp
dhcp.@dnsmasq[0]=dnsmasq
dhcp.@dnsmasq[0].localise_queries='1'
dhcp.@dnsmasq[0].rebind_localhost='1'
dhcp.@dnsmasq[0].local='/lan/'
dhcp.@dnsmasq[0].domain='lan'
dhcp.@dnsmasq[0].expandhosts='1'
dhcp.@dnsmasq[0].authoritative='1'
dhcp.@dnsmasq[0].readethers='1'
dhcp.@dnsmasq[0].leasefile='/tmp/dhcp.leases'
dhcp.@dnsmasq[0].localservice='1'
dhcp.@dnsmasq[0].resolvfile='/tmp/resolv.conf.d/resolv.conf.auto'
dhcp.@dnsmasq[0].rebind_protection='1'
dhcp.@dnsmasq[0].domainneeded='1'
dhcp.lan=dhcp
dhcp.lan.interface='lan'
dhcp.lan.start='100'
dhcp.lan.limit='150'
dhcp.lan.leasetime='12h'
dhcp.lan.dynamicdhcp='0'
dhcp.lan.ignore='1'
dhcp.wan=dhcp
dhcp.wan.interface='wan'
dhcp.wan.start='100'
dhcp.wan.leasetime='12h'
dhcp.wan.limit='150'
dhcp.wan.dynamicdhcp='0'
dhcp.wan.ignore='1'
dhcp.odhcpd=odhcpd
dhcp.odhcpd.maindhcp='0'
dhcp.odhcpd.leasefile='/tmp/hosts/odhcpd'
dhcp.odhcpd.leasetrigger='/usr/sbin/odhcpd-update'
dhcp.odhcpd.loglevel='4'
dhcp.@domain[0]=domain
dhcp.@domain[0].name='openwrt.local'
dhcp.@domain[0].ip='10.110.0.1'
```
titanium98118
2023-06-21 09:40:24 +08:00
@Jobin0528 #2 resolvfile='/tmp/resolv.conf.d/resolv.conf.auto'
Jobin0528
2023-06-21 09:47:33 +08:00
@neroxps #1
@titanium98118 #3

感谢🙏
wonderblank
2023-06-27 17:55:42 +08:00
```
root@main:~# ifstatus wan | jq -r '."dns-server"[]'
58.240.57.33
221.6.4.66
```

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/950512

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX