I have an ethernet port attached to a bridge:
$ brctl show
bridge name bridge id STP enabled interfaces
eth0_bridge 8000.6a612bcc4723 yes eth0
The bridge is VLAN-aware (ie /sys/class/net/eth0_bridge/bridge/vlan_filtering
is 1
). I want to be able to add other interfaces to that bridge and assign VLANs to them, like this:
ip link set eth1 master eth0_bridge
bridge vlan add dev eth1 vid 10 pvid untagged
This should connect untagged traffic on eth1 to VLAN 10 on eth0. But no traffic gets through until I:
bridge vlan add dev eth0 vid 10
Once I've done this, then everything works as needed. But is there no way to tell it that eth0
is a trunk port on bridge eth0_bridge
that should carry all VLANs and then do the VLAN filtering on egress from the bridge?
Best Answer
When using the
bridge vlan
command, you can add (or delete) a range of VLAN IDs in a single shot. For example:will add all available VLANs to the trunk interface eth0 (0 and 4095 are reserved in the protocol and must not (nor can) be used, 1 is by default set as PVID untagged VLAN ID, so should be avoided or perhaps better, removed).
Here
-c
stands for-c[ompressvlans]
rather than-c[olor]
: the bridge man page (at least up to iproute2-ss191125) completely lacks information about this option.Deleting a range works as one could expect:
Internally all are handled using a (hashed) list of individual VLANs.
Note 1
Cumulus Networks (known to mostly use Linux' native network stack on their network equipments) has some old (and newer) examples about this:
The configuration file used is the interfaces file from ifupdown2 (and its addons), actually developed by Cumulus Networks to replace ifupdown, with a mostly compatible syntax, but much improved bridge and VLAN support.
Note 2
I didn't find any evidence of some special flag automatically flooding all VLANs to a bridge port. This kernel commit tells VID 4095 is documented in IEEE 802.1Q to have restrictions but allowed to be used for management operations as a wildcard match for the VID, but Linux doesn't seem to use such method.