Extending a Wireless Network with Linux (the simple way)
The walls in my house, like most walls, are unfriendly to wireless. I was expecting this so I ran a wired network, and have a couple of computers dotted around the house plugged into the LAN. However I also want to be able to connect to wireless from anywhere in the house, seamlessly.
There are a lot of over-complex guides describing how to do this but most are missing some key points:
- You can have two, or more, wireless networks with the same SSID and password broadcast from different nodes. Your computer (or, at least, my computer) will pick the strongest one automatically. You don't need any mesh networking for this, it's just how 802.11 works.
- You don't need any fancy DHCP or DNS setup - if all you want is every computer on the one subnet, no matter where they come in from, then all you need to do is bridge the networks.
To that end here's what I did to turn a computer with two network connections (
wired connection, and
wlan0, a wireless one) into a "wireless extender" - packets received
on its wireless network are (essentially) re-broadcast on the wired network to the
This is on Ubuntu but there's nothing distribution-specific here.
- Install bridge-utils and hostapd
aptitude install hostapd bridge-utils
Configure the network interfaces as part of a bridge - easily done by editing
/etc/network/interfaces. Here's mine:
auto lo br0 iface lo inet loopback iface br0 inet dhcp bridge_ports eth0 wlan0 iface eth0 inet manual allow-hotplug wlan0 iface wlan0 inet manual up service hostapd start down service hostapd stopSo the bridge will get its network configuration via DHCP over either of it's two interfaces (which in practice is
eth0, the wired connection). The block for
wlan0doesn't configure any network settings, it's just there to bring up
hostapdwhen it's started.
Configure hostapd. For debian-based systems this means editing
/etc/default/hostapdto set the path to the configuration file you're about to create - I added the line
DAEMON_CONF="/etc/hostapd/hostapd.conf". Then create the file to look something like this:
interface=wlan0 driver=nl80211 bridge=br0 hw_mode=g ieee80211n=1 ssid=yourssid wpa=2 wpa_passphrase=secret wpa_key_mgmt=WPA-PSK WPA-PSK-SHA256 wpa_pairwise=TKIP rsn_pairwise=CCMPThis will give you an 802.11g/n network with WPA2 encryption only. The bridge
br0is the bridge you set up in the previous step. Change the ssid and wpa_passphrase to the same values as your existing wireless network.
That's it. There's no DHCP, no DNS forwarding, no
sysctl settings, no
iptables, no half-baked
The two interfaces will simply forward packets between eachother as required - this
broadcast requests from the any devices which connect to the wireless network created
hostapd, so your IP address will remain the same as you move
around the network. I've confirmed this by switching off one of the routers, my
Mac didn't even blink - network connections were uninterrupted.
There's no limit that I'm aware of on the number of access points - so long as they all have the same SSID and Password (and, I suspect, encryption) then it should work, although putting them all on different wireless channels seems like a good idea.