我有一些 Qemu KVM 虛擬機器(主要是 CentOS 和 Debian),我的主機是 Ubuntu。我使用 virtio virbr0 配置了虛擬機器網絡,還透過建立虛擬介面、將虛擬機連接到該虛擬介面(使用 dnsmasq 分配 IP)以及透過主機進行 NAT 流量來使其工作。
現在,出於學習的目的,我真的很想創建一個橋接器,將我的 wifi 介面新增為連接埠之一並將我的虛擬機連接到橋接器中,但我沒有成功。如同上面提到的,我也使用了 Debian 的橋接教學試著讓 ebtables「偽裝」我的 VM MAC 位址(因為 AP 不會接受與先前驗證的 MAC 位址不同的 MAC 位址)。但我的問題是我什至無法將我的 wifi 添加為橋接端口。
我的/etc/network/interfaces:
auto lo
iface lo inet loopback
# this is my wifi card (god knows why udev gave this name)
auto wlx44334c371663
iface wlx44334c371663 inet manual
# of course I added my wifi real MAC in bridge_hw option
auto br0
iface br0 inet dhcp
pre-up iwconfig wlx44334c371663 essid myESSID
bridge_hw 11:11:11:11:11:11
bridge_ports wlx44334c371663
bridge_stp off
bridge_waitport 0
bridge_fd 0
bridge_maxwait 0
當我啟動它時:
$ sudo ifup br0
Waiting for a max of 0 seconds for wlx44334c371663 to become available.
can't add wlx44334c371663 to bridge br0: Operation not supported
Internet Systems Consortium DHCP Client 4.3.3
Copyright 2004-2015 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/br0/11:11:11:11:11:11
Sending on LPF/br0/11:11:11:11:11:11
Sending on Socket/fallback
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 3 (xid=0xe1868a4f)
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 8 (xid=0xe1868a4f)
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 8 (xid=0xe1868a4f)
...
上面的通知:
無法將 wlx44334c371663 新增至橋 br0:不支援操作
當然,當我檢查網橋時,我的wifi不是br0的一個介面:
$ brctl show
bridge name bridge id STP enabled interfaces
br0 8000.44334c371663 no
virbr0 8000.000000000000 yes
當我啟動 br0 時,我的 wifi 是打開還是關閉似乎並不重要,它只是不會將其添加為一個接口
如果我嘗試使用 brctl 新增 wifi,也會發生相同的情況:
$ sudo brctl addif br0 wlx44334c371663
can't add wlx44334c371663 to bridge br0: Operation not supported
PS:這是一個外部 wifi 設備(rt2800usb),我也有筆記型電腦板載 wifi(ath10k_pci),但似乎都不起作用。雖然乙太網路可以工作(但我所在的地方沒有乙太網路電纜)。那麼,我做錯了什麼?