V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
OpenWrt 是一个专门面向嵌入式设备的 Linux 发行版。你可以将 OpenWrt 支持的型号的嵌入式设备,比如各种路由器上的系统,换成一个有更多可能性可以折腾的 Linux 系统。
OpenWrt 官方网站
Jobin0528
V2EX  ›  OpenWrt

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

  •  
  •   Jobin0528 · 323 天前 · 1061 次点击
    这是一个创建于 323 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    1. nslookup 找到的是 127.0.0.1
    2. 去上游光猫找到是 移动内网的 DNS
    5 条回复    2023-06-27 17:55:42 +08:00
    neroxps
        1
    neroxps  
       323 天前
    openwrt 是用 dnsmasq 代理的,所以本机 nslookup 就是 127.你得看 dnsmasq 的上游 dns ,命令行是 uci show dhcp
    Jobin0528
        2
    Jobin0528  
    OP
       323 天前
    @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
        3
    titanium98118  
       323 天前
    @Jobin0528 #2 resolvfile='/tmp/resolv.conf.d/resolv.conf.auto'
    Jobin0528
        4
    Jobin0528  
    OP
       323 天前 via iPhone
    @neroxps #1
    @titanium98118 #3

    感谢🙏
    wonderblank
        5
    wonderblank  
       317 天前
    ```
    root@main:~# ifstatus wan | jq -r '."dns-server"[]'
    58.240.57.33
    221.6.4.66
    ```
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   985 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 21:09 · PVG 05:09 · LAX 14:09 · JFK 17:09
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.