Linux Ethernet/wireless bridging

bridgeethernetlinuxwireless-bridge

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.

Best Answer

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 use 192.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.

Related Topic