Single tagged DSA port: functional difference between bridge VLAN and 802.1q device?

It seems there are two ways to tag a single port under DSA, and I'm wondering if one is more suited in certain situations (e.g. for bridging a wireless network to the network interface). Can someone shed any clarity on that?

Since L2/L3 configuration was made more consistent right before releasing 22.03, I'm supposing both solutions operate on different levels, but my knowledge doesn't run deep enough to deduce if both or either are correct. I see both pop up in examples and other people's configurations, and my 'instinct' so to speak was to use the bridge VLAN for the AP and just the 802.1q device on the router, since that needs no bridging to a wireless interface. The 'mixed' setup works, so both seem to be valid solutions.

Setup type #1: Bridge VLAN
On my AP I currently have the trunk port set up with a bridge VLAN, and a WLAN interface associated with it. The port is part of the default 'LAN' bridge VLAN as well (untagged).

config bridge-vlan 'guest_vlan'
	option device 'br-lan'
	option vlan '20'
	list ports 'lan0:t'

[...]

config interface 'guest'
	option proto 'static'                    # I know the interface doesn't need an IP
	option ipaddr '10.0.20.12/24'            # and I can turn it to proto 'none'.
	option device 'br-lan.20'

Setup type #2: 802.1q device
On my router, however, I decided to define a 802.1q device since there's no bridging needed. The port is also part of the default 'LAN' bridge VLAN, just like on the AP (untagged).

config device
	option type '8021q'
	option ifname 'p2'
	option vid '20'
	option name 'guest'

[...]

config interface 'guest'
	option proto 'static'
	option ip6assign '60'
	option ipaddr '10.0.20.1/24'
	option device 'guest'
	option ip6hint '20'

I'm very curious. Thanks!

Yes, they're both perfectly valid. As a rule of thumb, you only need the bridge-vlan flavor if you want to bind something (bridge a wifi) to the (tagged) port or if you want to address multiple ports with the same VLAN ID.

2 Likes

Thanks now! Then my assumption was correct :slightly_smiling_face:.

Edit: @jow Is there a way to define a PVID with a 802.1q device? I didn't find any info on that. I suppose if one would want that one would need to resort to a bridge VLAN as well.

No, there is no way to do that. An 802.1q device always implies tagged operation and only ever sees vlan tagged frames destined to its vlan ID.

1 Like

Thanks! Suspected as much.

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