Masq31 - Benjamin Giordano
11 min readMay 7, 2023

Building a wireless AP and 2.5Gbps router in Netplan, Hostapd and Ubuntu.

Greetings Folks. I’ve passed my college classes and certification courses with Juniper Networks. I would highly recommend the platform for both their swathe of learning materials and videos, as well as the vlab which when compared to packet tracer uses real cloud based environments for getting hands on with the test materials. Today I’m here to share the success with my readers in the best way I know how; a networking centric project. I set my sights on building a router from scratch. My problem statement for doing so comes from my positive impression with the use of Linux as a router operating system. The network as code separation that takes place in the proprietary juniper system caught my attention as something I wanted to accomplish with a home made device. [https://jlabs.juniper.net/vlabs/]

I also have a router which is less than reliable which runs dd-wrt. The device is a relatively prolific and affordable 802.11 ac antenna but has a bug where the device runs too hot. A backup is available in case this fails, but I felt it was time to have something more modular and robust as to better plan for upgrades as needed. I also know that link aggregation isn’t used on consumer grade routers, and 2.5G ethernet is only available for high end unmanaged wireless routers ranging from the same price point as an enterprise managed router. Speaking on price…

Juniper devices aren’t cheap, and my pocket book is strapped as a student. Other networking equipment can be had that is much larger, bulkier, but comes with issues like lacking licenses, faulty ports, expansion card issues, power consumption, and so on. The biggest thing I was afraid of with juniper routers is getting a srx300 from 2017 or earlier, where a firmware bug was present which essentially renders the device useless for modern network capabilities. This and the lack of prolific availability led me to look around at other devices in the neighborhood, from Ubiquiti to Cisco and TP-link at some points. Managed routers typically start at $150 used and $300-$3000 new. They have a great feature set for businesses and standards for getting things done. Unmanaged routers lack features I would need to utilize in the aforementioned link aggregation. With these capabilities in mind, I set a budget and went looking for supported parts to build. Probably the best router for the money would have been a TPlink archer ax5400. [https://www.bestbuy.com/site/tp-link-archer-ax5400-pro-dual-band-wi-fi-6-router-black/6532370.p?skuId=6532370] With 1 2.5g lan port, it would have made a great choice for those without the access to resources and hardware this project requires. It however requires much more to use link aggregation, so my specific use case is still valid.

A thorough w5h could be done on all kinds of network storage data link speeds and connectivity, from advances in USB-C and Thunderbolt 4 to current standards and how limiting most file sharing is over a LAN environment. There is a reason why demanding workloads such as games are played on ‘someone else’s computer’ AKA through the cloud. Using a storage device over the internet is an impractical practice on modern connectivity protocols. Cloud to local write speeds aren’t great without something like a hybrid cloud networking plan, or products like Azure Ark, which are both way outside the scope of this article. Although that said, the best thing for the local datacenter which has been relegated to cloud technologies for the current time is the use of SR-IOV. I hope to look more into this technology as time goes on. Speed potential is supposedly followed by webDAV and trailed behind by SMB which has massive hardware requirements to get sufficient speeds for file transfers. SMB gets a lot better with other devices added onto the NAS, but with just 2 drives and lock at 7200 rpm HDD’s I expect a bottlenecked 110 MBPS.

I wanted to use my NAS at a faster speed than I had been, the end goal would be to make the share perform similar to onboard storage: running applications off of the NAS share without being restricted by slow boot times or storage. I wanted to be able to run blender at usable speeds, and play games ranging from over hundreds of gigs from the NAS itself without too much loading. My new PC has a 2.5 GBPS network port and using link aggregation on my NAS to merge 2 single gigabit ports into a 802.11ad port would seem doable. I had to understand how there were few practical implications of this without having access to 2 gigabit fiber internet. I investigated my current NAS configuration and found there is a need for upgrading from spinning HDD’s to SSD’s and even M2 drives for readability. In theory most m2 drives can get 3500 MBPS read/write speeds, and most SAS drives can also get speeds above most rated systems. Spinning hard drives when paired up to 4 can get around 220 MBPS in a typical SMBv3 configuration, with 2 backup drives and 2 striped drives.

As a start to the project it looked like we would need a Wi-Fi 6 PCIE card as well as a 4 port 2.5 GBPS ethernet card. Compatibility was the first issue I ran into. This happened before I had any of the network cards in hand. While you can get a lot of different wi-fi cards from Intel at affordable prices, Linux support is nonexistent. Looking at forum posts, I found that support often lags for major OS builds like Debian. I settled on a MediaTek mt8921e wifi6 card to start since it supports host AP mode and advanced features key to most Wi-Fi routers. For the network card, a new product was launched on amazon from a Shenzhen manufacturer. The card boasts 4 Realtek modules capable of handling 2.5G as well as link aggregation. Compared to a QNAP card with the same capabilities, the $50 price difference was enough to purchase this card.

I already had a PSU, motherboard, CPU, ram, display card on hand from a disassembled system. This was going to be the host for this project. However, after fixing an issue with the shipped Wi-Fi card, plugging it into the motherboard caused a CPU overvoltage warning to appear and the system to subsequently shut down. It ceased operation completely at this point, failing to power on and output a display with 2 different computers. I tried everything for the board, but this was not meant to be. I got a replacement board sourced from a 2005 prebuilt dell XPS and after a firmware upgrade to 2010, it was able to boot BIOS based ubuntu not a problem.

I also had some trouble with a graphics card made for the motherboard in a PCIe x16 riser. It would just lose power at random, so I used my existing card which worked. If this pc had an additional PCIE slot, that would have proven useful. However, the form factor was locked at microATX from the first board failure, so retooling for a different board, mPCIe or other capabilities was not on the agenda.

This was also a learning experiment in PCIe cards. I had not realized that some board makers included an open-ended bracket at the ends of their cards allowing for less channel width to be used. Essentially a pcie4x card can be slotted into a 16x slot, and a 16x card can be slotted to work in a 1x extended slot. Adapters worked off the same principle, and because of the crypto mining craze of the mid 2020’s, these are relatively affordable. The overall cost to build this device was $222, with the board failure costing $40 MSRP, but coming to me as a freebie from another project means it wasn’t a huge loss. Having the power supply already also saved me a good deal of money.

Setting up an OS was interesting as well. I had read about OpenWRT and had my sights set on that for the beginning of the project. However, with the board change and bios over EFT focused, resources were poured into getting ubuntu up and running first. Getting that, I decided to test the network manager access point speeds. Both windows and most modern user-friendly Linux distros have a network sharing feature baked in, though testing the windows features may make for a curious project, as the rise of windows IoT through ARM might be something to watch for in embedded devices. Also, a wireless LAN controller might be a better use of the extra ports available on the devices once all is said and done.

I had encountered an issue with using the LTS version of ubuntu. As advances allowed for 802.11x access points to be used in the last year, the channel only received the update from the apt-get maintainer to do so in the past 3 months. This update was not available for the LTS version. Downloading and compiling it on my own system was defeating the purpose of making an easy to pick up and run router system. I had no choice but to upgrade versions.

The viability must be in scope for something like this as well. Meeting the goal of using a router with a target throughput may not always match your ideal expectations. If that viability drops during project discoveries, well that’s not good and you have to reconsider if your investment cost was worth the potential return. Wi-Fi 6 on AX is rated for notably fast transmission speeds over 1600 MBPS, and it works great on the current routers on the market starting at over $150. However, the open-source community is the burden to getting good software to go with the hardware. Most consumer grade notebook cards don’t have the potential to perform well if the support for both the Os and community features are abscent. Here more than most places were what I found to be a test of patience with the available technologies.

Access point sharing is how we get traditional notebook cards to act as routers. Hostapd software covers the wireless features of the router interface. Bing a cli tool, commands must be entered as documented in the manual file, for example beamforming for ax connections. Making a working hostapd file is an experience requiring some specifications in the config file. These range from router configs, to beacon intervals, to channel offsets for some more advanced cards using features in parallel. The writeup I would recommend is to check the output of the “iw list” command and compare your chipset’s features side by side with the check list. hostapd runs alongside a network bridge to establish internet connectivity. It also requires a DHCP server to work with your devices. In lieu of this, network manager can act as a Wi-Fi hotspot, albeit with less features. Dnsmasq covers the address reservation server portion but can cause issues if your network isn’t effectively set up.

I did stumble upon a Hackaday article detailing the availability of a tool for sharing Wi-Fi connections. However, this app gimps your devices upload speeds due to lax configuration. It does open other radios for use, but these are not tweaked for optimal chipset features. Perhaps the devs of the tool could establish a compatibility list sometime. I’ll leave a link here for those curious. [https://hackaday.com/2023/02/22/linux-fu-sharing-your-single-wifi/]

Having something of a setup with these tools allowed me to create a script to test connectivity speeds before bridging. 802.11 AX speeds as reported by my google pixel 6 pro were rated at 266 MBPS up and 133 MBPS down, while speed tests reported much slower connectivity. This was much better than the 56 MBPS download of the other antennas of this card. These slow speeds aren’t uncommon in the Linux ecosystem. The card in question being a MediaTek 7921k lacks advanced features like beamforming. This absence is notable for the slow connectivity. What also led to slow connectivity was a slew of setbacks locking me out of router upgrades. The board I was using before supported PCIe 3.0 and had USB-c ports. The current motherboard lacks usb3 and has pcie2 slots, which are bandwidth limited to 500 MBPS as opposed to 1 GBPS. Ouch. Having the numbers here, I moved onto testing with OpenWRT.

My experience with OpenWRT was plagued with software incompatibility with the hardware, even with the driver integration completed. I plan to revisit this area after finding it reorganized based on a downloaded file, but with a lack of support for my other wireless card, I doubt that there will be useful implications here. The bottom line is that OpenWRT is great for custom router OS firmware, but not as great if you are trying to build your own system from x86 compatible parts. For existing router technologies, this and DDWRT are quite useful, and I would recommend them for ease of use.

After wrestling with conflicts, I decided to continue being stubborn and go back to the ubuntu environment for networking. I was disgruntled at the options from the ip command and was hoping to find something that resembled the more advanced network as code features, I’ve been taught in my degree program. I found something that paralleled it through Canonicals’ Netplan. Netplan uses yaml json files to apply networking configurations and has something of a checks and trials system before implementing. It applies configurations similar to juniper networks devices in such a way that I quickly found myself at home writing out connections to a bridge for the access point. I was dumbfounded, this was the solution I was looking for to lift this project up.

Implementing 802.11ad interfaces when configuring through Truenas SCALE’s netCLI and Netplan was a breeze. I observed a 15% speed gain as opposed to using a single link. Reading up on Netplan, I noticed the common recommendations were to disable the feature for Linux wireless card compatibility. [https://github.com/morrownr/USB-WiFi/blob/3ddf574d1e35d8bfa40db8f2e0684a241615f60c/home/AP_Mode/Bridged_Wireless_Access_Point.md] What the guides did not mention was how hostapd or other clients can be cited to use Netplan as a module, making the tool a portable resource for all things Linux networking. I hope more attention is brought to this area in the future. If I were to expand upon this plan, I could play with the tx/rx rates as well as Wi-Fi 6e which allows for more advanced features that cards have built in. I’ll be leaving some resource links to the best parts I found as a part of this blog post. [https://github.com/morrownr/USB-WiFi/blob/15883b987338672c194e38e02ca534729bb2ff1b/home/AP_Mode/hostapd-WiFi6.conf]

I kept working on the router, I couldn’t help myself. The amount of work I put into this thing was too much to abandon at this point. I also found how networking as code was such a boon to my workflow, it reinvigorated my need to push forward, this is in part thanks to all the advances found in the ubuntu operating system and its community. I think what I was most overall impressed by was the ubuntu and canonical community. This is a distro that people value their time to turn in for hobby projects and even daily driving. I was impressed by their ingenuity when compared to the competition. There has been much consideration made to the design of how users interact with the Debian underlayer through gnome. This sort of thing is a welcome familiarity to me. Sure, I’ve used ubuntu for as long as I can remember, but having the minimal install options, the convenience right out of the box, the ability to check on packages for versions and revisions, emails, and bug reports for compatibility. The ecosystem around ubuntu is still astoundingly friendly. Windows could learn a thing or two from this level of involvement and support for its various branches.

In conclusion, there’s much to look forward to with viable homemade Wi-Fi routing over wireless as well as general router configuration made as complex or simple as the user wants. to look at how a router can be managed and utilized for various purposes on a network. Be it a small network or a larger scale one. I hope this inspires my readers to try out their wi-fi hotspot and question whether they could do better making their own.

Masq31 - Benjamin Giordano
Masq31 - Benjamin Giordano

Written by Masq31 - Benjamin Giordano

Web security blogger, Lifelong IT learner, Community first

No responses yet