I run multiple VLANs on my user's switch. I used to tag everything over the trunk link and it works fine. Today I tried to output 1 of them as untagged. Let's take a look at the configuration. I shall try to simplify my real one.
Topology: Switch 1 -> Switch 2
First, here is what it used to work.
Switch 1 -- /etc/config/network
config interface 'management_vlan'
option ifname 'eth0.1'
option proto static
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign 60
config interface 'public_vlan'
option ifname 'eth0.2'
option proto static
option ipaddr '192.168.2.1'
option netmask '255.255.255.0'
option ip6assign 60
config interface 'private_vlan'
option ifname 'eth0.3'
option proto static
option ipaddr '192.168.3.1'
option netmask '255.255.255.0'
option ip6assign 60
# Management VLAN
config switch_vlan
option device 'switch0'
option vlan 1
option ports '4t 6t'
# Public VLAN
config switch_vlan
option device 'switch0'
option vlan 2
option ports '4t 6t'
# Private VLAN
config switch_vlan
option device 'switch0'
option vlan 3
option ports '4t 6t'
Switch 2 -- /etc/config/network
config interface 'management_vlan'
option ifname 'eth1.1'
option proto dhcp # Only this interface has an IP address. Users from other VLANs cannot connect to this device.
config interface 'public_vlan'
option type bridge
option ifname 'eth1.2'
option proto none
config interface 'private_vlan'
option type bridge
option ifname 'eth1.3 eth0'
option proto none
config switch
option name 'switch0'
option reset 1
option enable_vlan 0 # VLAN is disabled, all switch ports facing 'eth0' receive and send untagged traffic.
# 'eth0' is bridged to 'eth1.3'. VLAN tagging/untagging is done on 'eth1'.
# 'eth0' VLAN does not matter, hence the switch VLAN can be turned off.
# All 4 LAN ports which connect to 'eth0' will be bridged to 'eth1.3' anyway.
The Switch 2
is not placed at my home, the user may replace it with any dumb switch in the future, and everything will stop working. I want to output untagged traffic on the private_vlan
, so if he ever does that, he is still left with his own VLAN/subnet to use.
Here is how I did, and it made everything on Switch 2 stop working:
Switch 1 -- /etc/config/network
# Private VLAN
config switch_vlan
option device 'switch0'
option vlan 3
option ports '4 6t' # His VLAN traffic is now untagged.
Switch 2 -- /etc/config/network
config interface 'private_vlan'
option type bridge
option ifname 'eth1 eth0' # This line is the problem.
option proto none
I've wasted 4 hours because of this. Why bridging eth1
and eth0
made everything stop working? I can even create an interface facing untagged traffic and it works with no problem, like this:
config interface 'untagged_vlan'
option ifname 'eth1' # This works and correctly joins the corresponding subnet. 'eth1.0' does not.
option proto dhcp
config interface 'public_vlan'
option type bridge
option ifname 'eth1.2' # This also works when bridging with `eth0`.
option proto none