Raspberry Pi as a router

bobbyprajan

Disciple
Just finished setting up Raspberry Pi4 as router running Openwrt. The wireless is handled by a proper wifi router. The setup has pi-hole running in lxc as well. For those who have a Pi lying around (Pi3 also will do) can give it a try
 

tech.monk

Disciple
I'll be getting the Pi ETH & USB Hat this weekend; will try it out on my Pi3b. This is for making the upstream and downstream separated.

BTW, how you managed to run it along pi-hole. interested in it.
 

bobbyprajan

Disciple
BTW, how you managed to run it along pi-hole. interested in it.
Pi-hole is running in an lxc container. I was not able to run lxc with the Rpi image from Openwrt provided image. I had to compile Openwrt from sources. Once lxc is functional, you can pipe the pi-hole installation script. Networking is a bit tricky, but can be done. There are lots of resources online which i used for reference
 

tech.monk

Disciple
Yes, I tried it with and without ETH Hat.

Without ETH, I was able to bridge wireless-lan and used Pi as an router but somehow with ETH hat, I'm not getting the network on additional lan port. Need to tweak further. Will proceed with tinkering on the next weekend
 

bobbyprajan

Disciple
Without ETH, I was able to bridge wireless-lan and used Pi as an router but somehow with ETH hat, I'm not getting the network on additional lan port. Need to tweak further. Will proceed with tinkering on the next weekend
You may need to install the kernel modules for the ETH Hat to use it
 

Party Monger

Skilled
What guide did you follow?
Do you have a usb to ethernet adapter for WAN ? More details on the setup.. Cause I've been searching and each time it feels too complicated.
 

bobbyprajan

Disciple
What guide did you follow?
To install the stock image, just write the downloaded image to an sdcard and boot with it. From there it is just standard Openwrt configuration for your needs
Do you have a usb to ethernet adapter for WAN ?
Yes, I use TP-Link UE300
More details on the setup
As I wanted to run lxc, i built from the sources using the guidelines in the image building section. A reasonably powerful computer running linux is required to do this.

I use a Raspberry Pi 4 2GB version. Have dual FTTH connections and both of them are connected to 2 nos. of UE300. The integrated ethernet connects to a managed switch with VLAN configuration. A WiFi access point is connected to the switch. I use mwan3 for failover and loadbalancing over the FTTH connections. SQM is enabled on both wan interfaces for traffic shaping. LXC containers are created for running Pi-hole (DHCP & DNS) and Grafana (monitoring)

The Pi cpu usage is very minimal (typically less than 5%). Memory usage is below 500 MB, so this should work with Pi 3b 1 GB very well. My friend recently migrated to similar setup and he is now able to saturate his 300 Mbps Fiber connection easily
Cause I've been searching and each time it feels too complicated.
Faced the same issue, the resources are scattered all over the place. There is no one guide which explains it all.

It is not too complicated once you get a hang of things. If you have used Openwrt before this should not be difficult

Bobby
 

Party Monger

Skilled
To install the stock image, just write the downloaded image to an sdcard and boot with it. From there it is just standard Openwrt configuration for your needs

Yes, I use TP-Link UE300

As I wanted to run lxc, i built from the sources using the guidelines in the image building section. A reasonably powerful computer running linux is required to do this.

I use a Raspberry Pi 4 2GB version. Have dual FTTH connections and both of them are connected to 2 nos. of UE300. The integrated ethernet connects to a managed switch with VLAN configuration. A WiFi access point is connected to the switch. I use mwan3 for failover and loadbalancing over the FTTH connections. SQM is enabled on both wan interfaces for traffic shaping. LXC containers are created for running Pi-hole (DHCP & DNS) and Grafana (monitoring)

The Pi cpu usage is very minimal (typically less than 5%). Memory usage is below 500 MB, so this should work with Pi 3b 1 GB very well. My friend recently migrated to similar setup and he is now able to saturate his 300 Mbps Fiber connection easily

Faced the same issue, the resources are scattered all over the place. There is no one guide which explains it all.

It is not too complicated once you get a hang of things. If you have used Openwrt before this should not be difficult

Bobby
Good to see someone dabble this deep. Thats an interesting setup. The reason I even thought of this before is cause good routers are very rare. Have to spend 6-9k for an r7000 that launched in 2013 if me or someone else needs good networking.

Didn't think of 2 Gigabit adapters. I saw a discussion where they had no extra adapters. They internet connections connected to a managed gigabit switch, along with RPI. And rest of it was done via Vlans. Considering at some point there will be a gigabit bottleneck. It made sense to save on the cost. But probably increases complexity.

Are you dialing the connection for both through openwrt? Or they do it via the provider's modem? That's another layer of complexity. Currently I dial via a tomato router since the provider's router conks off the moment I use something like torrents with many connections (even with my router doing the internal routing), it cant even handle the internet traffic. I don't suppose that will add much overload on a Pi4.

My friend needed a setup, maybe you can help a bit. His area is big. He has shitty wifi routers right now. Needs something robust as we will be adding cheap wifi cameras all over. The maintenance is pathetic btw so stuff needs to be cheapish and stable. I was thinking of a Raspberry pi as a router with a gigabit dongle for WAN, connected via on board port to an unmanaged switch, which further connects to 5 2.5ghz access points (or maybe a bit more daisy chaining with another switch further on, dont think it should make a difference.)
 

bobbyprajan

Disciple
Good to see someone dabble this deep. Thats an interesting setup. The reason I even thought of this before is cause good routers are very rare. Have to spend 6-9k for an r7000 that launched in 2013 if me or someone else needs good networking.
The same reason forced me to try out this setup
Didn't think of 2 Gigabit adapters. I saw a discussion where they had no extra adapters. They internet connections connected to a managed gigabit switch, along with RPI. And rest of it was done via Vlans. Considering at some point there will be a gigabit bottleneck. It made sense to save on the cost. But probably increases complexity.
You can very well do it without usb adapters if you have vlan capable switch. In typical home network you are not likely to reach the point of bandwidth bottleneck. Even if you do, you can move the interface to a usb adapter then without major changes. No additional complexity if you have a basic understanding of VLANs
Are you dialing the connection for both through openwrt? Or they do it via the provider's modem? That's another layer of complexity. Currently I dial via a tomato router since the provider's router conks off the moment I use something like torrents with many connections (even with my router doing the internal routing), it cant even handle the internet traffic. I don't suppose that will add much overload on a Pi4.
Both my provider modem/routers are bridged and PPoE is configured in Pi
My friend needed a setup, maybe you can help a bit. His area is big. He has shitty wifi routers right now. Needs something robust as we will be adding cheap wifi cameras all over. The maintenance is pathetic btw so stuff needs to be cheapish and stable. I was thinking of a Raspberry pi as a router with a gigabit dongle for WAN, connected via on board port to an unmanaged switch, which further connects to 5 2.5ghz access points (or maybe a bit more daisy chaining with another switch further on, dont think it should make a difference.)
I have not faced any major issues with my setup except for the ext4 fs corruption due to power problems. This should not occur if you have a reliable power source for the Pi. Openwrt on Pi should work well for your requirements. Will be happy to address any queries on the topic
 

Party Monger

Skilled
The same reason forced me to try out this setup

You can very well do it without usb adapters if you have vlan capable switch. In typical home network you are not likely to reach the point of bandwidth bottleneck. Even if you do, you can move the interface to a usb adapter then without major changes. No additional complexity if you have a basic understanding of VLANs

Both my provider modem/routers are bridged and PPoE is configured in Pi

I have not faced any major issues with my setup except for the ext4 fs corruption due to power problems. This should not occur if you have a reliable power source for the Pi. Openwrt on Pi should work well for your requirements. Will be happy to address any queries on the topic
Thanks Bobby. Yes I imagine flexibility would be the core strength of any setup done on Openwrt. I have 2 RPI4s, one of them gathering dust as unused webserver. Will try it soon.

Do you have any suggestions for Access point hardware for my friend's build by any chance? Perhaps any guides you've seen? Getting routers and putting them in access point mode would work well or get one of those ceiling mounted ones.
I've seen tutorials with same setup and Fast roaming enabled on AP and Openwrt. If my friend's thing goes well, Might do it for my own place too..
 

bobbyprajan

Disciple
Do you have any suggestions for Access point hardware for my friend's build by any chance? Perhaps any guides you've seen? Getting routers and putting them in access point mode would work well or get one of those ceiling mounted ones.
I dont have any experience with ceiling mounted APs. I would advise to try re-puposing the existing routers as AP and see if they are good enough. If not try to get pre-owned stuff in reasonably good condition. Instead of getting a high cost single router / AP, buy 2 or 3 and place them strategically to cover the whole area without much overlap
 
Top