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

2021-04-09 05:01:30 +08:00
 cathedrel

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

1977 次点击
所在节点    问与答
8 条回复
elfive
2021-04-09 07:30:11 +08:00
Openwrt 如果用的是 dnsmasq 的话,可以直接指定 DNS 转发,转发给你的上游路由器或者 DNS Server 就行了
AllenHua
2021-04-09 08:24:34 +08:00
<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
2021-04-09 09:05:03 +08:00
lan 口可以设置 dns 啊
CatCode
2021-04-09 09:10:48 +08:00
只接 LAN 口你是想做网关服务器用吧(俗称旁路由)
旁路由你得指定网关到你的出口路由器 /光猫上啊
cathedrel
2021-04-09 23:50:40 +08:00
@elfive 现在的 openwrt 都有 dnsmasq,但是这个东西怎么用我完全不懂,怎么设置“指定 DNS 转发”??
cathedrel
2021-04-09 23:52:14 +08:00
@CatCode 我指定了网关的,但是不设置一下 resolv.conf 就是不行
cathedrel
2021-04-10 01:30:05 +08:00
@elfive 解决了,设置里面有个 DNS forwardings,网关地址添加进去就好
ryansvn
2022-10-13 11:58:06 +08:00
@elfive 太感谢了,这个 openwrt 一直 ping 不同域名,导致更新软件都不行,很焦虑,根据你的方法,添加 DNS 转发给到网关,就完全解决了。谢谢!

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

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

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

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

© 2021 V2EX