Router baked from a Raspberry Pi

I have two routers for networking with both wired and wireless connections. Both are easy to plug in and both fail to do what I require. How can I get the ideal router to do what I need today and in the future? Bake my own!

Who needs a better router?

Everyone I know with a router has replaced the router at least once and most have given up on finding the one router to do what they need. Many have multiple devices to perform parts of the routing. Some have multiple expensive broadband accounts to service different devices because none of their routers handle the right range.

What is a Raspberry Pi router?

A router is a device containing a computer to direct the flow of network messages. A Raspberry Pi is a computer you can use for a range of things with models from pico up to regular size. The regular size Pi can run a router.

A router has network connections, either wired or wireless or both. The medium and large Raspberry Pi computers have both a wired connection and WiFi for wireless connections.

A router might have a USB socket for storage and other uses. The Pi range includes lots of models with USB sockets. You can add USB to other models. As examples, the Pi 3B has four USB 2 ports and the Pi 4 has two USB 3 ports plus two USB 2 ports.

A WiFi router might have regular WiFi or MIMO WiFO. The Pi range has several models with better regular WiFi than my best router with regular WiFi. You can plug in MIMO WiFi adaptors to all the USB equipped Pi models. When you start with a Pi, you can get the same or better WiFi range today and can replace the WiFi at any time with anything new, all without throwing out a whole router then buying a complete new router.

A router has the Linux operating system inside. A Pi has Linux.

A router has simple or complex administration software with, usually, a pretty Web interface. A Pi based router starts without the pretty Web stuff and you can add that later if you feel the need. You would mostly use a Pi router on a stable network without the need for continuous online reconfiguration.

For a very busy network a regular router will not handle the workload, you will need a server based router, something outside the current range of Pi computers.

A router might have an Ethernet hub or switch built in. You can add an external Ethernet hub or switch to a Pi router and change the hub or switch at any time to fit changing requirements.

A Raspberry Pi router can run any other software you want up to the CPU and memory limit of that model Pi. Most importantly, you can move the whole configuration from one Pi to a bigger Pi at any time by just moving the microSD card.

You now have a router with the flexibility to replace any component at any time without replacing the whole router plus the ability to add anything at any time.

When did I decide to upgrade to a Raspberry Pi based router?

I have two routers from both ends of the price range you might buy for a home or an office. Nether let me add my current broadband Internet connection. I would have to pay every month for a second Internet connection, doubling my cost. In fact, looking at the current cost of a connection with the same speed and in a form acceptable for one of the routers, that other connection by itself would be close to double the cost.

There are routers up to thousands of dollars without the connectivity of my Pi router.

Where would you use a Pi router?

Any device you build yourself will need support from you or someone with similar skills. Most corporate offices lack Raspberry Pi experience and any router used there should be a mainstream pre packed bland router. The Pi router fits the tens of thousands of educational institutions running Pi based code clubs. The Pi fits anyone with Linux experience.

The Pi router is quiet enough (absolutely silent) for use in your home. There are lots of small routers with no fans but the bigger ones with flexibility often have fans. Based on flexibility, the Pi is the only fully flexible router without a fan.

The built in Pi WiFi has a limited range compared to fancy MIMO routers. For my setup, I added a fancy MIMO WiFi adaptor. I could have also reused the MIMO router as just an access point but then I would lose control over that part of the setup and be back to trying to make prepacked software do what I want.

The Pi hardware and support is available in almost every country. Most brands of routers have support in only a few countries. There are many countries where the Pi is the better choice for hardware and software and support.

Why choose Raspberry Pi?

The Raspberry Pi is popular which means there are lots of how-to pages you can read. Just make sure they are specifically written for the hardware and OS combination you use.

The Pi range includes models from way to small for this project to up above what you need. I recommend for multiple projects, start with one top of the line models for development then downsize the result to the minimum hardware required. The top machine will make development faster and can be reused across many projects.

The Pi range in Australia is the most cost effective device at each size and is beaten only by reusing a notebook computer left over after an upgrade.

The Pi does not have or need a fan. No noise. Superb! You can add heat sinks to the Pi 4 in hot countries. Use a case with good ventilation as anything else will hold in too much heat, forcing you to add a fan.

Many Pi models are actually available in multiple forms for different uses. For example, many models of Pi have GPIO pins. The Pi Zero is available with our without the pins. The Zero is also available with or without WiFi. The Zero is also available as the Zero 2 with a faster processor.

The Raspberry Pi support forums are excellent.

The only current problem is supply of some models due to chip shortages but that supply shortage is hitting most of the alternatives.

Way?

Routing is connecting one network to another. In this case it is connecting the Internet to your local network. The Internet might be a wired connection from a modem and you route to your Ethernet network. You might use WiFi for your home network and route from the Ethernet Internet connection to WiFi. In my case, I route from a WiFi hostspot Internet connection to both Ethernet and WiFi. Routing from one connection to one other connection is well documented.

In my case, I want to route to both Ethernet and WiFi. Inside Linux, you first have to bridge Ethernet to WiFI. Bridging is well documented. Routing to a bridge is almost never mentioned. That was the main speed bump I hit.

Inside the Raspberry Pi OS, the built in Ethernet is named eth0. The built in WiFi is named wlan0. I used wlan0 for the connection to the WiFi hotspot and plugged in a WiFi adaptor to provide the local WiFi network. The plugged in WiFi a high range MIMO WiFi adaptor equivalent to or better than the best of my ordinary routers. The extra WiFi connection is named wlan1.

I tested routing wlan0 to eth0 then tried to connect in wlan1 but that failed and diagnosing problems was difficult. I then switched to an easier way. I bridged eth0 to wlan1 to create something named br1 then routed wlan0 to br1. Easy.

Read up on bridged. Read up on routing. If you need both, create and test the bridge first then add the routing to the bridge.

If you need a local WiFi network, read up on Access Points. Access Point or AP is the mode of operation for a WiFi device when broadcasting a local network. The built in Raspberry Pi WiFi works in AP mode. Some USB WiFi adaptors work in AP mode and some so not. Check before you buy anything. If you already own a WiFi adaptor, you can plug it in to any Linux computer and list exactly what it can do.

WiFi devices use chips from Atheros, Mediatek, or Realtek. Atheros and Mediatek support Linux. Realtek does not. Realtek based devices can be painful. If you have not yet purchased something, check the chip.

Raspberry Pi devices can be powered from a variety of USB sources. Always start with a genuine Raspberry Pi Power supply designed for the model of Pi you use. If you then buy several Pi computers of the same model, you can test other sources of power. Always use the genuine thing for reference. In our region, there is only a tiny difference between the cost of the real thing and the alternatives.

Choose a good microSD card for your Raspberry Pi projects. Look for the A1 or A2 application speed rating. For the Pi 4, also look for V30 as the Pi 4 can write faster than V10.

Take small steps then test until you are confident that step works. You can make an image backup of the microSD card at any time then revert to that point if something does not work the way you expect.

Worth?

My Pi router cost me a lot of time learning stuff about Linux network software I have not worked with before. If you count every hour on this project, the result is expensive. In my case, I need most of the experience for other projects I am planning. If the router was project 20 instead of project 10, I would already know everything and setting up the Pi router would be the same time as setting up an ordinary router.

There is a stack of well written how-to information online to make your router build easy. Just read of the official documentation and some forum posts to start from the right point and to head in the right direction. (And read this page first!)

Based on prices in Australia in Australian dollars. Here is my Pi router replacement cost compared to my $150 router that cannot do what I need.

Raspberry Pi 4 2GB $73.80
Official power $14.35
microSD card A1 $8.95
Ethernet switch $15.90
MIMO WiFi adaptor $43.00

Total $156.00