nickpegg.com
Building My Own Home Router, Part 2 - 802.11 Posted on 2014-08-22

In my last post I talked about getting my home router up and forwarding packets from nothing and getting my computers connected via Ethernet. The next step is to get 802.11 (WiFi) working.

Hardware Caveats

In my last post, I mentioned that I got the Intel 7260-ac card, which I've had some problems with. Intel decided to code into the EEPROM that the card can only use channels that make it compliant with every country's laws, and the firmware and Linux driver dutifully read this information and comply. This means that the card can only work in AP mode on channels 1-11, and will NOT in the 5GHz band. This means that you're stuck to the noisy 2.4 GHz band and can't even use 802.11ac (since it requires 5GHz).

I've seen some various blog and forum posts where the OpenWRT people have gotten around this on cards with atheros chipsets since it's just a check in the driver. However, in the small amount of kernel driver hacking I've done, I've been unsuccessful.

Long story short, watch which card you pick up and make sure people have had luck making it do what you want to, preferrably without having to patch kernel drivers.

Network Changes

Since you're turning your router into a wireless access point, you have two options to connect clients to your network: split them off into their own network segment in a different subnet, or bridge the wireless interface in with your inside network and let wireless users mingle with your wired users. I chose the latter, since it was simpler.

The basic idea is that you create a bridge device (br0) and bridge in your eth1 and wlan0 interfaces. My updated config shows the changes you need to make to /etc/network/interfaces:

Note that br0 has pretty much taken the place of eth1 in the config. Also, we don't bridge in wlan0 since our access point daemon will take care of that.

Along with this change in /etc/network/interfaces, don't forget to also change your dnsmasq settings so that it listens on br0 instead of eth1.

Install the bridge-utils package if you haven't already and restart networking. Congrats, your router is now a one port network switch!

Firewall Changes

Since our inside interface is now br0, we have to tweak our firewall rules a bit.

HostAPd Config

Thanks to hostapd, getting your wireless card running in AP mode is a cinch! It's just a package install away in most cases, and the configuration isn't too terrible. Below is my config, annotated to make it easier to understand.

The things to watch out for are the settings that are ORs of bits, like auth_algs and wpa. When setting up your own AP, it's a good idea to check out the example config to see what each setting does and what the defaults are.

My config doesn't include any 5 GHz settings, so you'll have to figure those out on your own if you're lucky enough to have a card that supports it. If I get mine working, I'll make another post with those settings.

Once you're done with configuration, fire up hostapd with service hostpad start. If everything was successful, you should see wlan0 bridged in (use the brctl show command to check) and the network should be joinable by one of your wireless devices. If you don't see that, you'll want to check /var/log/syslog to see what hostapd is complaining about.

And there you have it, a router with wireless! Next up is IPv6 support, so stay tuned for part 3.

blog comments powered by Disqus