找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 115415|回复: 51

解决:指定openwrt的lan端DNS服务器的方法

 火.. [复制链接]
发表于 2011-3-21 10:52 | 显示全部楼层 |阅读模式
本帖最后由 dosar 于 2011-3-23 14:32 编辑

想对lan设置自己的dns解析,但总是取到路由的IP作为dns。求解。

--找了两天,在这里找到答案。
https://forum.openwrt.org/viewtopic.php?id=22624
4楼

  1. list 'dhcp_option' '6,87.216.1.65,87.216.1.66'
复制代码
完成后的/etc/config/dhcp应该有一段是这样子的:
config 'dhcp' 'lan'
        option 'interface' 'lan'
        option 'start' '100'
        option 'limit' '150'
        option 'leasetime' '12h'
        list 'dhcp_option' '6,87.216.1.65,87.216.1.66'

这里的6是指dns 服务器,这个数字代码的含义可以用dnsmasq --help dhcp命令查询。
我的恩山、我的无线 The best wifi forum is right here.
 楼主| 发表于 2011-3-22 22:48 | 显示全部楼层
人工置顶。就是想解决怎样才能使用自己设置的dns,试过种种方式均以失败告终,包括:
修改dnsmasq.conf参数--导致无法正常dhcp使用
启用resolv-file,严格顺序--无果
自作聪明加了点东西--无效
root@OpenWrt:/etc/config# cat dhcp

config 'dnsmasq'
        option 'interface' 'lan'
        option 'domainneeded' '1'
        option 'boguspriv' '1'
        option 'localise_queries' '1'
        option 'rebind_protection' '1'
        option 'rebind_localhost' '0'
        option 'local' '/lan/'
        option 'domain' 'lan'
        option 'expandhosts' '1'
        option 'authoritative' '1'
        option 'readethers' '1'
        option 'leasefile' '/tmp/dhcp.leases'
        option 'resolvfile' '/tmp/resolv.conf.auto'
        list interface         br-lan
        option 'strictorder' '1'

config 'dhcp' 'lan'
        option 'interface' 'lan'
        option 'start' '100'
        option 'limit' '150'
        option 'leasetime' '12h'

config 'dhcp' 'wan'
        option 'interface' 'wan'
        option 'ignore' '1'
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2011-3-23 00:00 | 显示全部楼层
是不是加最后一行,明天试试
config 'dnsmasq'
        option 'domainneeded' '1'
        option 'boguspriv' '1'
        option 'localise_queries' '1'
        option 'rebind_protection' '1'
        option 'rebind_localhost' '0'
        option 'local' '/lan/'
        option 'domain' 'lan'
        option 'expandhosts' '1'
        option 'authoritative' '1'
        option 'readethers' '1'
        option 'leasefile' '/tmp/dhcp.leases'
        option 'resolvfile' '/tmp/resolv.conf.auto'
        option 'strictorder' '1'
        option 'notinterface' 'lan'
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2011-3-24 11:24 | 显示全部楼层
WEB界面里就能直接设置吧

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2011-3-24 13:14 | 显示全部楼层
收藏 了 ,前段有遇到 这个问题。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2011-3-24 19:00 | 显示全部楼层
本帖最后由 dosar 于 2011-3-24 19:02 编辑
WEB界面里就能直接设置吧
40605
zdcps 发表于 2011-3-24 11:24

这个不行的,你试试就知道了。在你图上设置的dns值不会出现在下图中的位置,不知道是不是bug。


不过正如你所言,在图形界面确实有设置的地方。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

点评

我参考这样设置了三个DNS, 截图发现只出现了192.168.1.1 这样一个地址,怎么弄。谢谢  详情 回复 发表于 2016-1-17 10:29
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2011-5-19 13:40 | 显示全部楼层
学习了,dns果然从网关改为设置的ip了。用的6楼的web设置大法。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2011-5-20 17:11 | 显示全部楼层

null

我这里自己用国外的dns服务器会给断网呢,为了河蟹啊
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2012-5-24 22:47 | 显示全部楼层
总算找到这了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2012-5-24 23:00 | 显示全部楼层
本帖最后由 4331324 于 2012-5-25 07:01 编辑

果然 有效

我的HG255D LAN口连上级路由的LAN口 当下载机和 UPnP/DLNA 用

HG255D 的LAN口设置192.168.1.5 255.255.255.0 默认分配出去的网关是192.168.1.5 这下好了

在那个DHCP服务器——高级设置——DHCP额外设置里填上 6,192.168.1.1 就可以了

万分感谢
============================================================

今天断电了一次貌似又不行了,拿到的又是

192.168.1.202
255.255.255.0
192.168.1.5

啥情况
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2012-5-25 07:10 | 显示全部楼层
不过 网络里貌似多了个 标签页 “DHCP和DNS”

Dnsmasq是一个拥有DHCP服务和DNS转发的软件,用于NAT防火墙

怎么设置才能是DHCP分配的网关是自定义的192.168.1.1
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2012-5-25 07:20 | 显示全部楼层
zdcps 发表于 2011-3-24 11:24
WEB界面里就能直接设置吧

这张图里的 IPV4 广播 是什么意思

一般填什么
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2012-5-25 08:08 | 显示全部楼层
系统 --- shell终端  

dnsmasq --help dhcp 命令查询了下

原来6是指dns服务器

3才是 router

附加设置 再加一行 3,192.168.1.1 终于搞定了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2012-5-25 08:19 | 显示全部楼层


上个图吧

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2012-5-25 08:22 | 显示全部楼层
顺便把 dnsmasq --help dhcp 贴出来

/www# dnsmasq --help dhcp
--------------------------------------------

Known DHCP options:
  1 netmask
  2 time-offset
  3 router
  6 dns-server
  7 log-server
  9 lpr-server
13 boot-file-size
15 domain-name
16 swap-server
17 root-path
18 extension-path
19 ip-forward-enable
20 non-local-source-routing
21 policy-filter
22 max-datagram-reassembly
23 default-ttl
26 mtu
27 all-subnets-local
31 router-discovery
32 router-solicitation
33 static-route
34 trailer-encapsulation
35 arp-timeout
36 ethernet-encap
37 tcp-ttl
38 tcp-keepalive
40 nis-domain
41 nis-server
42 ntp-server
44 netbios-ns
45 netbios-dd
46 netbios-nodetype
47 netbios-scope
48 x-windows-fs
49 x-windows-dm
60 vendor-class
64 nis+-domain
65 nis+-server
66 tftp-server
67 bootfile-name
68 mobile-ip-home
69 smtp-server
70 pop3-server
71 nntp-server
74 irc-server
77 user-class
93 client-arch
94 client-interface-id
97 client-machine-id
119 domain-search
120 sip-server
121 classless-static-route
125 vendor-id-encap
255 server-ip-address
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-3-28 18:10

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表