|
|
本帖最后由 syj0925 于 2024-9-21 00:15 编辑
硬件设备:N1盒子
操作系统:Armbian 20.10 Bullseye with Linux 5.9.0-arm-64
需求描述:把N1作为一个无线桥接器,N1的WiFi连接到路由器,N1的以太网口连接PC,为PC提供上网服务,PC、N1和路由器处于同一个局域网。
设计方案:移植OpenWrt的relayd开源组件到N1盒子。运行relayd,命令:<relayd -I wlan0 -I eth0 -D -B -d -d>,把 eth0 和 wlan0 加入到realyd实现伪桥接。
- git clone https://git.openwrt.org/project/libubox.git # relayd 依赖 libubox
- git clone https://git.openwrt.org/project/relayd.git # 编译成功,生成可执行文件:relayd
复制代码 问题描述:WiFi连接到路由器,DHCP成功,运行"relayd -I wlan0 -i eth0 -D -B"后,PC DHCP成功,从路由器分配到IP地址,但是PC无法上网,ping <网关IP> 也失败。
问题分析:relayd的Log信息查看,ARP请求成功,但是PC又定期发起ARP请求,猜测是路由设置问题,导致eth0 没有转发到 wlan0。
以上,麻烦帮忙看下什么原因导致的无法上网,非常感谢!
relayd的部分Log信息:
MAC地址:
PC: e8:6a:64:80:97:9b
eth0: f2:d3:33:cd:c8:09
wlan0: b8:27:eb:74:f2:6c
router: 90:de:80:91:a4:51
- $ ./relayd
- Usage: ./relayd <options>
- Options:
- -d Enable debug messages
- -i <ifname> Add an interface for relaying
- -I <ifname> Same as -i, except with ARP cache and host route management
- You need to specify at least two interfaces
- -G <ip> Set a gateway IP for clients
- -R <gateway>:<net>/<mask>
- Add a static route for <net>/<mask> via <gateway>
- -t <timeout> Host entry expiry timeout
- -p <tries> Number of ARP ping attempts before considering a host dead
- -T <table> Set routing table number for automatically added routes
- -B Enable broadcast forwarding
- -D Enable DHCP forwarding
- -P Disable DHCP options parsing
- -L <ipaddr> Enable local access using <ipaddr> as source address
复制代码eth0: ARP who-has 192.168.137.1, tell 192.168.137.24 (e8:6a:64:80:97:9b)
wlan0: sending ARP who-has 192.168.137.1, tell 192.168.137.24 (b8:27:eb:74:f2:6c)
wlan0: received ARP reply for 192.168.137.1 from 90:de:80:91:a4:51, deliver to 192.168.137.24
eth0: sending gratuitous ARP: 192.168.137.1 is at (f2:d3:33:cd:c8:09)
eth0: sending ARP reply to 192.168.137.24, 192.168.137.1 is at (f2:d3:33:cd:c8:09)
eth0: sending ARP who-has 192.168.137.24, tell 1.1.1.1 (f2:d3:33:cd:c8:09)
wlan0: sending ARP who-has 192.168.137.24, tell 192.168.137.47 (b8:27:eb:74:f2:6c)
eth0: received ARP reply for 192.168.137.24 from e8:6a:64:80:97:9b, deliver to 1.1.1.1
wlan0: sending gratuitous ARP: 192.168.137.24 is at (b8:27:eb:74:f2:6c)
eth0: ARP who-has 192.168.137.1, tell 192.168.137.24 (e8:6a:64:80:97:9b)
wlan0: sending ARP who-has 192.168.137.1, tell 192.168.137.24 (b8:27:eb:74:f2:6c)
wlan0: received ARP reply for 192.168.137.1 from 90:de:80:91:a4:51, deliver to 192.168.137.24
eth0: sending gratuitous ARP: 192.168.137.1 is at (f2:d3:33:cd:c8:09)
eth0: sending ARP reply to 192.168.137.24, 192.168.137.1 is at (f2:d3:33:cd:c8:09)
eth0: ARP who-has 192.168.137.1, tell 192.168.137.24 (e8:6a:64:80:97:9b)
wlan0: sending ARP who-has 192.168.137.1, tell 192.168.137.24 (b8:27:eb:74:f2:6c)
wlan0: received ARP reply for 192.168.137.1 from 90:de:80:91:a4:51, deliver to 192.168.137.24
eth0: sending gratuitous ARP: 192.168.137.1 is at (f2:d3:33:cd:c8:09)
eth0: sending ARP reply to 192.168.137.24, 192.168.137.1 is at (f2:d3:33:cd:c8:09)
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|