Extending a Wireless Network with Linux (the simple way)

28 Jul 2015


Boat (27) 
Not the Boat (12) 


Recent articles

25 Apr 2017

Ubuntu 16.10 LXC host on ZFS Root, with EFI and Time Machine

Still completely unrelated to boats, but I needed somewhere to put this. Here is a blow-by-blow guide to installing a minimal Ubuntu 16.10 to a ZFS root, booted from EFI, which as used as a LXC host to act as an Apple "Time Machine" destination.
mike 25 Apr 2017 at 17:20
14 Mar 2017

How to connect any serial device to the internet

A completely generic script that will proxy serial devices over HTTP, turning USB-things into internet-things.
mike 14 Mar 2017 at 23:00

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:

  1. 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.
  2. 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 (eth0, a 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 appropriate device. This is on Ubuntu but there's nothing distribution-specific here.

  1. Install bridge-utils and hostapd
            aptitude install hostapd bridge-utils
  2. 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 stop
    So 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 wlan0 doesn't configure any network settings, it's just there to bring up hostapd when it's started.
  3. Configure hostapd. For debian-based systems this means editing /etc/default/hostapd to 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:
             wpa_key_mgmt=WPA-PSK WPA-PSK-SHA256
    This will give you an 802.11g/n network with WPA2 encryption only. The bridge br0 is 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 WDS. The two interfaces will simply forward packets between eachother as required - this includes DHCP broadcast requests from the any devices which connect to the wireless network created on wlan0 by 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.