无法通过无线到有线桥接获得 DHCP 租用

无法通过无线到有线桥接获得 DHCP 租用

我正在尝试在嵌入式板上桥接 wlan0 和 eth0。该板将通过 wifi 连接到我的家庭 AP,我希望将我的笔记本电脑连接到网桥的有线支路并访问我的家庭 LAN 和互联网。整个设置如下所示:


  • 笔记本电脑 -> eth0 -> 带网桥的嵌入式板 (Khadas VIM3L) -> wlan0 -> LAN *

到目前为止,我已经能够使用以下命令成功在嵌入式板的 wlan0 和 eth0 接口之间设置桥接:

# WIFI Connection on the khadas board
sudo nmcli device wifi connect ${MY-AP-SSID} password ${MY-AP-PASSWORD}

# Setting up the bridge on the khadas board
sudo iw dev wlan0 set 4addr on
sudo ip link set dev wlan0 up;
sudo ip link set dev eth0 up;
sudo ip addr flush wlan0;
sudo ip addr flush eth0;
sudo ip link add name br0 type bridge nf_call_iptables 0;
sudo brctl addif br0 eth0;
sudo brctl addif br0 wlan0;
sudo brctl stp br0 on;
sudo ip link set dev br0 up;

sudo dhclient -v br0;

嵌入式板上的桥似乎已启动并正在运行:

khadas@Khadas:~$ sudo brctl show
bridge name bridge id             STP enabled   interfaces
br0           8000.70f754e4b567 yes           eth0
                                                        wlan0

khadas@Khadas:~$ sudo ip addr
...
10: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 70:f7:54:e4:b5:67 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.248/24 brd 10.0.0.255 scope global dynamic br0
       valid_lft 14194sec preferred_lft 14194sec
    inet6 2001:1308:2830:6b00:85a1:a05c:6bf9:a94d/64 scope global temporary dynamic 
       valid_lft 86165sec preferred_lft 86117sec
    inet6 2001:1308:2830:6b00:72f7:54ff:fee4:b567/64 scope global dynamic mngtmpaddr 
       valid_lft 86165sec preferred_lft 86165sec
    inet6 fe80::72f7:54ff:fee4:b567/64 scope link 
       valid_lft forever preferred_lft forever

尽管桥显然可以工作,但我无法为通过以太网连接到开发板的笔记本电脑获得 IP 租用。

从我的笔记本电脑的角度来看:

❯ sudo dhclient -v enp0s31f6
[sudo] password for gabriel:
Internet Systems Consortium DHCP Client 4.4.3
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/enp0s31f6/6c:24:08:a9:86:8c
Sending on   LPF/enp0s31f6/6c:24:08:a9:86:8c
Sending on   Socket/fallback
xid: warning: no netdev with useable HWADDR found for seed's uniqueness enforcement
xid: rand init seed (0x6435e938) built using gethostid
DHCPDISCOVER on enp0s31f6 to 255.255.255.255 port 67 interval 3 (xid=0x39f0361d)
...

从嵌入式板与桥的角度来看:

khadas@Khadas:~$ sudo tcpdump -i br0 -vv -n -e  port 67 or port 68
tcpdump: listening on br0, link-type EN10MB (Ethernet), capture size 262144 bytes
17:25:13.340635 6c:24:08:a9:86:8c > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 342: (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
    0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 6c:24:08:a9:86:8c, length 300, xid 0x39f0361d, Flags [none] (0x0000)
      Client-Ethernet-Address 6c:24:08:a9:86:8c
      Vendor-rfc1048 Extensions
        Magic Cookie 0x63825363
        DHCP-Message Option 53, length 1: Discover
        Requested-IP Option 50, length 4: 10.0.0.88
        Hostname Option 12, length 12: "ThinkPad-E15"
        Parameter-Request Option 55, length 13: 
          Subnet-Mask, BR, Time-Zone, Default-Gateway
          Domain-Name, Domain-Name-Server, Option 119, Hostname
          Netbios-Name-Server, Netbios-Scope, MTU, Classless-Static-Route
          NTP
...

DHCP 请求正在到达网桥,但显然没有转发到我的家庭 AP。

关于可能出现什么问题的任何想法吗?

相关内容