Linux Ethernet/wireless bridging

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


Such configuration will work perfectly fine for brdging two network interfaces

# The primary network interface
allow-hotplug eth0

iface eth0 inet static
        address 192.168.0.10
        network 192.160.0.0
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        dns-nameservers 212.27.39.2
        dns-search home
        auto eth0

iface wlan0 inet static
        address 192.168.0.9
        network 192.160.0.0
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        dns-nameservers 212.27.39.2
        dns-search home
        wireless_keymode open
        wireless_mode managed
        wireless_nick srvolivier
        wireless-essid SMC2870
        wireless-key wepkey
        auto wlan0

iface br0 inet static
        address 192.168.0.8
        network 192.160.0.0
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        dns-nameservers 212.27.39.2
        dns-search home
        bridge_ports eth0 wlan0
        auto br0