using SBC as router with openwrt extending ethernet ports with VLANs... something powerful I realized recently

Hello,
I wanted to share and idea not directly related to dietpi but I guess of interest for people in this community.

I recently tested and proved myself a concept I had pending for many years, the applications of VLANs for extending the ethernet ports of a SBC

Using an SBC as a router (with openwrt installed on it) is much more powerful than most commercial routers to, for example handle way better VPN server, load balancing 2 internet connections, traffic analyzing, downloads, file server… endless options under openwrt, even docker… kindof dietpi…
But the biggest hardware obstacle is that most SBC have only 1 ethernet.
How to solve it? with VLANs and a managed switch supporting VLANs or another openwrt flashed commercial router acting as a managed switch (easy to set up).

The hardware connection is easy: The only ethernet in the SBC to one ethernet in the managed switch, in my case both run openwrt and its very easy to set up once you get the concept.

I will provide more detailed information hopefully tomorrow, I have to go now.

I hope this idea is helpful to someone

Sounds interesting. I have two routers running OpenWRT and two Pi3s lying around. Maybe I could do something fun or even useful with them :wink:

Looking forward to further information!

There is interesting SBC hardware available for this purpose " NanoPi R2S"


https://www.friendlyarm.com/index.php?route=product/product&path=69&product_id=282

Totally. Here you have more info.

Wow that’s a cool tiny quite powerful board, and very cheap! 22 USD or 25 case included. Thanks for sharing! It did not exist in friendlyarm catalog when I was up to date…
Add a usb wifi supported by openwrt and you have also AP functionality (or wireless client if that fits your needs better).
And if 2 ethernet ports are not enough they can be increased with the method shown here.

Back to the VLANs thing here there is more info.

Some links:

concept VLAN - Wikipedia
Most routers use VLANs functionality to “detach” one port from the switch and being able to “attach” it to WAN interface: https://openwrt.org/docs/guide-user/network/vlan/creating_virtual_switches
similar use case: Using Router as just AP and Managed Switch - Network and Wireless Configuration - OpenWrt Forum
extensive info, maybe confusing: https://openwrt.org/docs/guide-user/network/vlan/managed_switch

In my case I’m using an old Buffalo router (WZR-HP-G300NH, Gigabit) with 3 VLANs:

  1. for WAN (DHCP client, using LAN 4 port of the switch)
  2. for my LAN (192.168.7.X using LAN 3 port)
  3. for the neighbors LAN (192.168.1.X using LAN 2).

LAN 1 port is for the trunk, the only ethernet cable between SBC and the managed switch.

With Luci (the web interface of openwrt) I have the following setup for the router acting as managed switch
Menu Network → Switch

VLAN ID			CPU (eth0)	LAN 1		LAN 2		LAN 3		LAN 4
102			tagged		tagged		untagged	off		off
103			tagged		tagged		off		untagged	off
104			tagged		tagged		off		off		untagged

I also use the buffalo as an AP

Then in the SBC, under menu Network → Interfaces more interfaces can be added and attached to vlans, in the example eth0.104 for WAN

With this info I guess it’s not enough to understand how VLANs work but I hope you see the possibilities, let’s say being able to carry different networks through a single cable at the same time.

NanoPi R2S looks good, had I known its existence a month ago I would prefer it over the RPi4 for internet router at home with OpenWrt.
Might as well buy one just for fun.

@femispam I was going to implement this, but ended up just picking a 802.11ax consumer wireless router instead.

I was planning to use Rock Pi 4 (though any other RK3399 board with PCIe would do, e.g. RockPro64 or NanoPi M4v2) with 4-port RTL8811 PCIe network adapter, for 1x WAN + 4x LAN ports with VLAN tagging and all. OpenWRT doesn’t support any of these boards; I was going to run Armbian and build on top of that.

Hope you’ll find this information useful.

sound like a good option (with a pcie adapter I guess) but only if openwrt would be supported, thanks for the idea.

I have the setup mentioned now working but I am also considering a new router because of the faster generation wifi