How to Build your Own Wireless Router
How to Build your Own Wireless Router
How to Build your Own Wireless Router
Wireless Router
Renaud Cerrato
Follow
Oct 22, 2018 · 4 min read
Choosing the hardware (this part)
The Hardware
Among the important pieces of hardware you’ll have to
pick, you must first choose your platform: x86 or ARM?
I’m not going to explain the key differences in details
since that information is available, but long story short:
the former have better performance while the latter is
all about being cost and power effective. Whereas
Raspberry Pi boards (or alike) are extremely cheap and
probably have more horsepower than most wireless
routers you’ll find on commercial off-the-shelf
products, keep in mind that x86-based platforms are
widespreads and benefits of well-standardized form
factors and extension ports.
Bill of Material
Making some personal trade-off on price and power-
consumption, I chose an x86-based platform to benefit
of a modular, upgradable (and relatively beefy) setup.
mPCIe Extender
PicoPSU-90
Hardware Porn
The trickiest part has been the mini-PCIe WiFi
card since the board only supports half-sized cards:
here come the mPCIe Extender to the rescue. I used a
20cm FFC cable (included) to connect both sides of the
adapter and fixed the mini-PCIe side to the chassis
using some double sided tape.
mini-PCIe Extender
The Software
No surprise, Linux is the de-facto choice. Depending on
the hardware you previously picked, it may be an
optimized distribution like Raspbian (for Raspberry Pi)
or any other Linux distro you’re comfortable with.
Since I’m an Ubuntu user for years, I chose Ubuntu
Server 18.04 LTS for a butter smooth experience and
long term support.
The remaining parts of the serie will assume you’re
running a Debian-derived Linux distribution.
Routing
At this point, we need to route packets between the
LAN (enp2s0) and WAN (enp1s0) interfaces, and
enable masquerading on it.
Conclusion
In this part, we learned how to properly setup your
network interfaces using /etc/network/interfaces,
introducing dnsmasq as DHCP server. We
leveraged firehol to declare your firewall and routing
rules before setting-up hostapd. At this point, your router
is accepting and properly routing traffic between its
interfaces, delivering DHCP leases on the LAN and
broadcasting some SSID on the 2.4Ghz channels.
Passive Scan
According to the documentation of the Airetos AEX-
QCA9880-NX, the chipset is fully 802.11ac capable and
we should now be able to move from the crowded 2.4
Ghz channels to the 5 Ghz heaven.
IR flag?
But, wait!
Configuration
Your new hostapd configuration file should be almost
straightforward now: hw_mode=a will enable the 5Ghz
bands while ieee80211ac=1 enable 802.11ac (VHT).
Using ieee80211d=1 along with country_code=US, we’ll advertise
the regulatory domain we’re working on.
Conclusion
In this part, you learned about Linux regulatory
compliance and how to workaround it by patching your
Linux kernel before setting-up hostapd for 5GHz
operations.
Diagram
Based on my current setup, here’s an updated diagram
of what I want to achieve. Assuming wlp5s0 is the
physical wireless interface, the virtual SSID will run on
a virtual wlan0 interface, using its own 192.168.2.0/24 sub-
network:
Preliminary
First of all, let’s check that your wireless device
supports multiple SSID:
$ iw list
...
valid interface combinations:
* #{ AP, mesh point } <= 8,
total <= 8, #channels <= 1, STA/AP BI must match
...
Network interfaces
According to the documentation found in hostapd.conf,
there’s a strong requirement between the MAC
address of the physical interface, and the BSSID of the
virtual interfaces:
hostapd will generate a BSSID mask based on the BSSIDs that are
configured. hostapd will verify that dev_addr & MASK ==
dev_addr. If this is not the case, the MAC address of the radio
must be changed before starting hostapd. If a BSSID is
configured for every secondary BSS, this limitation is not
applied at hostapd and other
masks may be used if the driver supports them (e.g., swap the
locally administered bit)BSSIDs are assigned in order to each
BSS, unless an explicit BSSID is specified using the 'bssid'
parameter.If an explicit BSSID is specified, it must be chosen
such that it:
- results in a valid MASK that covers it and the dev_addr
- is not the same as the MAC address of the radio
- is not the same as any other explicitly specified BSSID
work.
Access point configuration
Now, the easiest part: we’ll add a virtual SSID to the
current hostapd configuration. Simply append, at the
bottom of your existing hostapd.conf, the desired
configuration:
$ cat /etc/hostapd/hostapd.conf
...
### Virtual SSID(s) ###
bss=wlan0
ssid=MyVirtualSSID
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=you_cant_guess