One of our new requirements for a product I work on is to support Ethernet-to-wireless bridging. Suppose we have two network interfaces: eth0 and ath0 (we're using the Madwifi driver). What sort of options do I have to allow computers hooked into eth0 to be able to access the wireless network?
The first thing I tried was the brctl
utility. This seemed to be exactly what I want. And, on wired networks, it is. But on wireless networks, it didn't quite work. Some Wiresharking revealed that the source MAC of the bridged packet was (correctly) set to a computer behind the bridge. However, the AP, having never seen that MAC associate, would drop the packet. If I enable WDS packets (iwpriv ath0 wds 1
), then the packet is sent with the transmitter and receiver addresses, but doesn't seem to be allowed by the AP (it is very old, and we can't change it). Not all APs have to accept WDS, right?
Thus, I'm wondering if we have to do some sort of Ethernet NATing or the like. However, I don't see how it can work -- how can one MAC address be shared amongst n computers? ebtables
appears too low level. Simply rewriting MAC addresses on the way out and the way back in makes it so the bridge computer cannot use the network. Plus, how would it know the ultimate destination for an incoming packet? You'd need details from the IP and TCP/UDP layers, at least.
Right, bridging doesn't work with wifi. The easiest solution is to use routing. You can setup a 'transparent router', that feels like a bridge, but in fact it is routing packets. For this, make one network a subset of the other.
for example, if your wired LAN is
192.168.183.0/24
, you could make the wireless LAN use192.168.183.192/26
.You might also have to turn on the 'proxy arp'. Just add a
echo 1 > /proc/sys/net/ipv4/conf/all/proxy_arp
to some startup script.Such configuration will work perfectly fine for brdging two network interfaces
I wrote a repeater program that reads one side and sends it to the others, learning the MAC of the PC behind the bridge and using it to rewrite src/dst MACs as necessary, but this strikes me as laden with unforeseen consequences.
Here is what we have working (hope it helps):
Network1 ---wireless(WDS bridging) ) ) ) ( ( ( wireless(WDS bridging)---Network2
Network1 and Network2 utilize common IP adress space ( 192.168.1.0/24) It works like charm.
Don't know with "normal" desktop distros, but on dd-wrt on netgear routers i can easily bridge wireless (virtual) interfaces with ehternet and vlan interfaces. Like
so i have a wireless "WAN" bridged to the wan eth port and a wireless "LAN" bridged to the 4 port switch (eth0).