Following up my other question I'd like to clarify the following:
To configure the bridge interface rather than one of its port, the additional keyword self is needed. The routing stack (at layer 3) handles IPv4 or IPv6 packets, so expects to receive frames of such type, not tagged frames. Hence VLAN ID 10 must be untagged when leaving the bridge (so the routing stack receive traffic) and this must be the Port VLAN ID, so traffic from the routing stack to the bridge gets tagged back. Only one VLAN can be linked to the routing stack this way.
A trunk port carries multiple VLANs, however PVID
for frames leaving the bridge
via the trunk port (from the routing stack into the bridge and so on) must be only one value, then there's no way to ensure that the frame is tagged with the right VLAN ID (the one it has arrived in the bridge)?
Here on the diagram I'm trying to explain my question:
+----+
| L3 |
+--+-+
|
|
|br0
+------+-------+
| Linux Bridge |
+------+-------+
|trunk (vid 2-4094)
|PVID (??)
|
+------+-------+
| L2 switch |
+-+----+-----+-+
| | |
| | |
10| 20| 30|
For example, a frame tagged with VID 10 (heading towards br0
) arrives on the Linux bridge trunk
port, the tag will be stripped off and handed over to the stack, processed (for example ICMP) and a response packet is generated back, which enters the bridge from br0
and will be tagged with PVID, and if I set PVID=20, then such packet will never reach a host on the VLAN10?
I was expecting that the Linux bridge would be able to forward reply packet based on destination MAC and VLAN ID of the original packet.
UPDATE After some experiments I found that the following setup works. So create Vlan sub-interfaces ethX.VID
and add them in the bridge, then tag/untag is done per at sub-interface, br0
has single IP address.
I.e. tagged packets (multiple VLANs) reach br0, get untagged, pushed up the stack, and response packets go all the way back via br0 into a proper Vlan sub-interface, where it's get tagged and outside.
+----+
| L3 |
+--+-+
|
|
|br0
+------+-------+
| Linux Bridge |
+------+-------+
| | |
| | |
|eth0.10|eth0.20|eth0.30|
+------+
| eth0 |
+--+---+
|trunk (vid 2-4094)
|PVID (??)
|
+------+-------+
| L2 switch |
+-+----+-----+-+
| | |
| | |
10| 20| 30|