Linux – Arch Linux Ethernet to WiFi bridge

arch linuxbridgenetworkingraspberry piwifi

I want to use a Raspberry Pi running Arch Linux to extend my WiFi network. My situation is that I have a spare WiFi router that I want to use to expand my WiFi reception range as well as give me a few extra Ethernet connections to my network. I have tried setting up the router itself to create a bridge to my existing router but it seems the two different types of routers that I have to not really mesh but that's another story. What I want to do is connect my Pi to my existing WiFi network and then bridge its WiFi adapter with its Ethernet adapter and connect the Ethernet adapter to my second router. I will then disable DHCP and NAT on the second router allowing it function only as an access point and a switch. I would prefer if devices connected to the second router could be on the same subnet as those on the first but I that's not possible I guess they could be on a different subnet and then the Pi would just have to be set up as a gateway.

My problem is that I cannot find any instructions for setting up either of these systems on Arch Linux. All I can find are seemingly promising instructions for Debian and ways of setting up Arch as an internet gateway.

I would prefer to use Arch because I have an image for it and downloading a Raspbian one will take an eternity on my connection, I also believe that Arch has a much smaller footprint and will run faster on the Pi.

PS. I have tried brctl but it tells me that adding a wlan adapter to the bridge is not supported.

Best Answer

I'm not absolutely certain, but if you have both network connections up and running, I think all you really need is a magic iptables configuration.

This will allow NAT from anywhere, to anywhere:

iptables -t nat -A POSTROUTING -j MASQUERADE

You could add a -o flag to control which interface is routed to where, but I don't think it's necessary.

I use this for sharing my network connection with LXC guests. You'll probably also need to set up a DHCP server for the devices behind the Pi (dnsmasq will do the job -- don't forget to bind the interface or you'll end up dishing out addresses to both networks!). DHCP is not necessary if you use static IPs, so I'd do that first.

Obviously, this isn't a full bridge, but I don't know how to help with that. :)

Related Question