V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
cathedrel
V2EX  ›  问与答

家中路由器 openwrt 只接 lan 口用, ping 不通域名无法自动安装 opkg,编辑/etc/resolv.conf 把 nameserver 指定为局域网网关可解(默认配置是 127.0.0.1),但是...

  •  1
     
  •   cathedrel · 2021-04-09 05:01:30 +08:00 · 1932 次点击
    这是一个创建于 1085 天前的主题,其中的信息可能已经有所发展或是发生改变。

    但是重启机器后设置就没了,需要重新来一遍,请问怎么固化这个操作?

    8 条回复    2022-10-13 11:58:06 +08:00
    elfive
        1
    elfive  
       2021-04-09 07:30:11 +08:00 via iPhone   ❤️ 1
    Openwrt 如果用的是 dnsmasq 的话,可以直接指定 DNS 转发,转发给你的上游路由器或者 DNS Server 就行了
    AllenHua
        2
    AllenHua  
       2021-04-09 08:24:34 +08:00   ❤️ 1
    <a href="https://hellodk.cn/post/124" target="_blank">使用 DNSmasq 部署家庭网络的公共 dns 和个性化的局域网内的 dns 域名服务</a> 分享一下我的做法,楼主可以参考一下

    这个文件的内容 重启后就没了?会不会是你本地的 dnsmasq 服务没有启动 或缺少配置

    resolv.conf is the name of a computer file used in various operating systems to configure the system's Domain Name System (DNS) resolver. The file is a plain-text file usually created by the network administrator or by applications that manage the configuration tasks of the system. The resolvconf program is one such program on FreeBSD or other Unix machines which manages the resolv.conf file. (来自维基百科)
    LiYanHong
        3
    LiYanHong  
       2021-04-09 09:05:03 +08:00
    lan 口可以设置 dns 啊
    CatCode
        4
    CatCode  
       2021-04-09 09:10:48 +08:00
    只接 LAN 口你是想做网关服务器用吧(俗称旁路由)
    旁路由你得指定网关到你的出口路由器 /光猫上啊
    cathedrel
        5
    cathedrel  
    OP
       2021-04-09 23:50:40 +08:00
    @elfive 现在的 openwrt 都有 dnsmasq,但是这个东西怎么用我完全不懂,怎么设置“指定 DNS 转发”??
    cathedrel
        6
    cathedrel  
    OP
       2021-04-09 23:52:14 +08:00
    @CatCode 我指定了网关的,但是不设置一下 resolv.conf 就是不行
    cathedrel
        7
    cathedrel  
    OP
       2021-04-10 01:30:05 +08:00
    @elfive 解决了,设置里面有个 DNS forwardings,网关地址添加进去就好
    ryansvn
        8
    ryansvn  
       2022-10-13 11:58:06 +08:00
    @elfive 太感谢了,这个 openwrt 一直 ping 不同域名,导致更新软件都不行,很焦虑,根据你的方法,添加 DNS 转发给到网关,就完全解决了。谢谢!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3797 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 10:21 · PVG 18:21 · LAX 03:21 · JFK 06:21
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.