br0 上的 dhcp 失败,新配置

br0 上的 dhcp 失败,新配置

我正在尝试为 xen 虚拟设备创建一个连接桥。br0 似乎已启动,但它不会获取 IP,并且 br0 上的本地 ipv6 链接也无法访问

root@Inspiron15:/home/# ifconfig
br0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet6 fe80::6087:a7ff:feeb:ae35  prefixlen 64  scopeid 0x20<link>
        ether 62:87:a7:eb:ae:35  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5  bytes 414 (414.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enx4ce173422757: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 4c:e1:73:42:27:57  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1318  bytes 142311 (142.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1318  bytes 142311 (142.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp0s20f3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.123  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::f285:75ec:cbfc:756  prefixlen 64  scopeid 0x20<link>
        ether 40:1c:83:fb:2f:48  txqueuelen 1000  (Ethernet)
        RX packets 30775  bytes 19053551 (19.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 27176  bytes 4228112 (4.2 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@Inspiron15:/home/# nmcli device status
DEVICE             TYPE      STATE                                  CONNECTION  
wlp0s20f3          wifi      connected                              getAjobFool 
br0                bridge    connecting (getting IP configuration)  netplan-br0 
88:36:5F:01:0A:B5  bt        disconnected                           --          
BC:98:DF:6A:17:C1  bt        disconnected                           --          
p2p-dev-wlp0s20f3  wifi-p2p  disconnected                           --          
enx4ce173422757    ethernet  unavailable                            --          
lo                 loopback  unmanaged                              --

我尝试在 netplan 中为其指定一个静态 IP,但这却导致我的 wifi 和 br0 都瘫痪了。

root@Inspiron15:/home/# cat /etc/netplan/01-network-manager-all.yaml 
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
network:
  ethernets:
    wlp0s20f3:
      dhcp4: true
  version: 2

  bridges:
    br0:
      interfaces: [wlp0s20f3]
      dhcp4: yes
      #addresses: [192.168.1.230/24]
      #gateway4: 192.168.1.1

我跑

netplan generate

netplan apply

我也尝试直接在接口上手动启动 dhcp。

dhclient br0

它只是挂了

如何使 dhcp 在我的 br0 上工作?

操作系统:Ubuntu 20.04.2 LTS 桌面

更新:我尝试了另外 2 个无线网卡,只是想看看是否与硬件有关。另外两个也有同样的问题。

桥接驱动程序似乎已加载到内核中。

# find /lib/modules/$(uname -r) -type f -name '*.ko'|grep bridge
/lib/modules/5.8.0-55-generic/kernel/net/bridge/bridge.ko

答案1

您的 netplan 配置中存在一些错误。

  1. 重复的网络部分
  2. 重复的版本密钥
  3. 我认为您不应该在接口 wlp0s20f3 上启用 DHCP,而应该仅在桥上启用 DHCP。

像这样:

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    wlp0s20f3:
      dhcp4: false

  bridges:
    br0:
      interfaces: [wlp0s20f3]
      dhcp4: yes

答案2

我尝试了以太网卡,它立即出现了。然后我发现了这个。

无线领域的坏消息

It doesn't work with my Wireless card!

This is a known problem, and it is not caused by the bridge code. Many wireless cards don't allow spoofing of the source address. It is a firmware restriction with some chipsets. You might find some information in the bridge mailing list archives to help. Has anyone found a way to get around Wavelan not allowing anything but its own MAC address? (answer by Michael Renzmann (mrenzmann at compulan.de))

Well, for 99% of computer users there will never be a way to get rid of this. For this function a special firmware is needed. This firmware can be loaded into the RAM of any WaveLAN card, so it could do its job with bridging. But there is no documentation on the interface available to the public. The only way to achieve this is to have a full version of the hcf library which controls every function of the card and also allows accessing the card's RAM. To get this full version Lucent wants to know that it will be a financial win for them, also you have to sign an NDA. So be sure that you won't most probably get access to this peace of software until Lucent does not change its mind in this (which I doubt never will happen).

相关内容