OpenWrt 每次启动都要物理断掉外部网络才能启动 DHCP 服务,否则客户端不会被分配 IP。请问原因是?

2022-05-31 08:19:33 +08:00
 WildCat

表现就是断电重启之后,客户端不会被分配内网 IP 地址了。 必须拔下 eth1 ( WAN )的网线后重启才能恢复正常。

网络配置如下:

root@OpenWrt:~ # cat /etc/config/network

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'xxx'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0'
	list ports 'eth2'
	list ports 'eth3'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.3.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config interface 'wan'
	option device 'eth1'
	option proto 'pppoe'
	option username 'xxx'
	option password 'xxx'
	option ipv6 'auto'

config interface 'wan6'
	option device 'eth1'
	option proto 'dhcpv6'

config interface 'docker'
	option device 'docker0'
	option proto 'none'
	option auto '0'

config device
	option type 'bridge'
	option name 'docker0'
3243 次点击
所在节点    OpenWrt
12 条回复
zhixiao
2022-05-31 08:24:01 +08:00
是外接 tplink 当 ap 的吗
WildCat
2022-05-31 08:29:27 +08:00
@zhixiao 是的,外接 ASUS
WildCat
2022-05-31 08:30:58 +08:00
@WildCat `[Modem] <-> [OpenWrt] <-> [Asus AP] <-> [Clients]`
PhaSelEza
2022-05-31 08:35:49 +08:00
我知道部分路由器的 bootloader (u-boot) 运行的瞬间,WAN 和 LAN 是连在一起的,所以 LAN 下的设备可以通过 DHCP 拿到一个 IP 地址,但这个地址是“外网”地址。

也许在 OpenWrt 启动后,物理重启下交换机可以解决?
/etc/init.d/network restart
kokutou
2022-05-31 08:55:58 +08:00
去掉 asus ap 呢。。。
不会又是自作聪明抢 dhcp 了吧

openwrt 升级最新试试。
op 里 dhcp 里有个此设备为唯一 dhcp 什么的选项,勾上试试。
storyxc
2022-05-31 09:10:19 +08:00
强制 dhcp 开启下
jacy
2022-05-31 09:15:32 +08:00
先看日志
WildCat
2022-05-31 09:20:26 +08:00
@storyxc
@kokutou
@PhaSelEza

感谢!开启强制 DHCP 后解决了这个问题。
jdjingdian
2022-05-31 09:27:54 +08:00
从 op 的描述来看,感觉四楼的说法更像是正确答案
idealhs
2022-05-31 16:36:18 +08:00
感觉是你网络上有别的设备也开了 DHCP ,最好是局域网内只存在一个 DHCP 服务器
sekisui
2022-05-31 16:47:26 +08:00
asus 无线路由器是 ap 模式吗?光猫桥接的话建议关闭光猫的 DHCP
强制 dhcp 有时候会不管用(很少
WildCat
2022-06-01 06:28:03 +08:00
@sekisui
@idealhs

好的,我去光猫看看,担心改动了光猫会导致猫挂掉。。。

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

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

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

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

© 2021 V2EX