「WLAN」- 无线网卡桥接问题

无线网卡有八种工作模式:Master (AP), Managed (Station), Ad hoc, Repeater, Mesh, Wi-Fi Direct, TDLS, Monitor mode:

「AP MODE」:路由器的无线网卡通常处于「AP MODE」,可以被连接,提供无线热点。

「STATION MODE」:手机的无线网卡通常出于「STATION MODE」,可以连接别的热点,发送数据。

其他模式先不介绍,它们不是本文的重点。

本文的重点是:处于「STATION MODE」的无线网卡无法加入桥接。

很多文章都在说出于「STATION MODE」的无线网卡无法桥接:

我也是在做“使用ETH0接口,使其使用WLAN0连接的外部网络”时遇到了无线网卡无法桥接的问题。

为什么无法桥接?

下面内容出自「 It’s no longer possible to add an interface in the managed mode to a

bridge. You should run hostapd first to pure the interface to the

master mode.

Bridging doesn’t work on the station side anyway because the 802.11

header has three addresses (except when WDS is used) omitting the

address that would be needed for a station to send or receive a packet

on behalf of another system.

下面内容出自DebianWiki的说明:

However, most Access Points (APs) will reject frames that have a source address that didn’t authenticate with the AP.

当然解决办法也是有的……

有没有解决办法呢?

还有一些旁门左道的解决办法:

我没有深入研究,目前还没有遇到这方面的需求。

例如,如果是向共享WLAN0的外部网络,可以考虑使用SNAT网络,将主机作为路由来共享网络。

另外,或者使用ebtabls工具,像iptables一样,它作用于“在OSI模型中的数据链路层”的“MAC子层”,用于修改帧的MAC地址。

可能还有其他的方法吧。

参考文献

关于WIFI的工作模式–AP MODE/STATION MODE
Bridging wlan0 to eth0
How to bridge a wireless interface with another wireless interface (both on the same computer)?