Raspberry Pi 4B: A working build with VLANs

Hello,
Could someone please demonstrate a working build of openwrt with the newest version on any Raspberry pi 4B?

Please also describe and explain the steps to setup, whether it is on a usb or microSD, and if you are using a USB ethernet, or a VLAN trunked single port.

It's super easy...

You'll use dotted notation. That is, the physical interface followed by a dot followed by the VLAN ID. Examples:

  • eth0 -- this is the untagged network on the physical eth0 port
  • eth0.5 -- this is VLAN 5, tagged on eth0
  • eth1.17 -- this is VLAN 17 tagged on eth1 (if you have a USB ethernet adapter).

A trunk port is one that carries multiple networks. It may be:

  • zero or one untagged network (this is allowed by the 802.1q standard, but there are opinions that an untagged network should never be present on a trunk port)
  • one or many tagged networks

So if you have multiple network interfaces that use, for example, eth0.4, eth0.23, and eth0.95 -- this would be a trunk with 3 VLANs (4, 23, 95), all tagged on eth0.

This works perfectly on the Pi4.

2 Likes

You don't need to create the 802.1q device.

Simply add an interface and set the parameters and use device eth0.10:

config interface 'vlan10'
	option device 'eth0.10'
	option proto 'static'
	...

An interesting effect, after removing the wan interface and vlan 10, I added an interface and set the parameters to use device eth0.10

after checking devices this popped up:

So, what would be the difference if you setup a vlan 80211q device and interface that vs just adding the interface with parameters?

When you create the device directly, it implicitly creates the 802.1q device under the hood. In my experience, I have never personally found a situation where the an explicit 802.1q device was required, although I think there are some specific instances in which it can be useful (when you need to have a 'named' device which can be handy in certain scenarios).

It is possible that the 802.1q stanzas may actually cause conflicts in some situations, but I don't have any specific evidence to back that up... just empirical results to say that they're not actually necessary in the vast majority of cases.

I recommend omitting those stanzas and letting the system implicitly create the 802.1q device for 2 reasons -- it is less error prone (human error) and it is less cluttered in the config file.

All that said, is it working as expected?

I can't say for certain as of yet, as I believe my situation is different.

I intended to make this guide so that the majority including myself would have a reference to build a openwrt router out of a Raspberry pi.

The ability to use SQM for an added edge in competitive video games alone makes the project worthwhile.

The added bonus to make a media server using samba file sharing, or a Pi-hole setup to eliminate unsolicited ads on ones favorite sites is just sweet sweet flavor that makes the argument of why not, arbitrary.

I'm asking only about the VLANs since that is the topic of this thread. Are the VLANs working as expected (i.e. VLAN IDs, tagging, etc.)? SQM and other auxiliary functions should be discussed in another thread.

Fair enough; the VLAN configuration works as intended. With a well configured managed switch it does forward internet traffic with tags, and allows local traffic to work as well via bridge.

Great! Glad to hear it!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.

Here are some pictures demonstrating a working setup:

Managed Switch:

OpenWRT LUCI devices:

OpenWRT LUCI Interface:

A note about Devices: VLAN stanzas aren't necessarily needed, as OpenWRT is able to work without them, for the user that hates CLI (command line interface) you can make VLAN devices in Luci and create the new interfaces in the interfaces tab like so:
Click add interface and choose this one for WAN:
WAN

and another one for LAN:
LAN

Don't forget to set your firewalls for each interface as well.

Any input or commentary is welcome!