Bridge (switch) on ZyXEL switch requires "Unmanaged" interface to work

Hi OpenWrt people,

I got a few older ZyXEL GS-1900-48 and I very happily replaced ZyXEL OS by the fantastic OpenWrt ;-).

I want to configure all ZyXEL switches with one port for administration only (port 48) with and SSH / HTTP access and the other ports just for switching. In other words the switch IP won't be accessible via ports 1-47 and to configure it I'll need to physically plug cable into port 48 (or via serial).

I started building this configuration by deleting default interface, changing device switch to switch only ports 1-8 (just for a test) and creating new interface for lan48 with static IP. I quickly realized that I can SSH / HTTP via port 48 but that switching ports don't work.

After a few trials and errors I realized that when I create an interface with Protocol: Unmanaged then the switching ports 1-8 start working as a switch.

Should I configure it like this? With option proto 'none' interface?

Thank you very much.

Joe

Example that works without VLANs:

...

config device 'switch'
	option name 'switch'
	option type 'bridge'
	option macaddr 'ab:cd:ef:00:11:22'
	list ports 'lan01'
	list ports 'lan02'
	list ports 'lan03'
	list ports 'lan04'
	list ports 'lan05'
	list ports 'lan06'
	list ports 'lan07'
	list ports 'lan08'

config interface 'mymng'
	option proto 'static'
	option device 'lan48'
	option ipaddr '10.0.0.1'
	option netmask '255.255.255.0'

config interface 'myswitch'
	option proto 'none'
	option device 'switch'

...

Example that works with VLANs:

...

config device 'switch'
	option name 'switch'
	option type 'bridge'
	option macaddr 'ab:cd:ef:00:11:22'
	list ports 'lan01'
	list ports 'lan02'
	list ports 'lan03'
	list ports 'lan04'
	list ports 'lan05'
	list ports 'lan06'
	list ports 'lan07'
	list ports 'lan08'

config bridge-vlan
	option device 'switch'
	option vlan '100'
	list ports 'lan01:t'
	list ports 'lan02:t'

config bridge-vlan
	option device 'switch'
	option vlan '101'
	list ports 'lan01:t'
	list ports 'lan02:t'

config bridge-vlan
	option device 'switch'
	option vlan '102'
	list ports 'lan01:t'
	list ports 'lan02:t'
	list ports 'lan03'
	list ports 'lan04'
	list ports 'lan05'

config bridge-vlan
	option device 'switch'
	option vlan '103'
	list ports 'lan01:t'
	list ports 'lan02:t'
	list ports 'lan06'
	list ports 'lan07'
	list ports 'lan08'

config bridge-vlan
	option device 'switch'
	option vlan '104'
	list ports 'lan01:t'
	list ports 'lan02:t'

config bridge-vlan
	option device 'switch'
	option vlan '105'
	list ports 'lan01:t'
	list ports 'lan02:t'

config interface 'mymng'
	option proto 'static'
	option device 'lan48'
	option ipaddr '10.0.0.1'
	option netmask '255.255.255.0'

config interface 'myswitch'
	option proto 'none'
	option device 'switch'

...

Sounds reasonable to me. It is the same when configuring vlans for guest or iot on a dumbAP.

Yes, this is expected and fine. Reason is the way netifd works internally, it requires a "user" (a logical interface) for a "device" to actually bring it up.

2 Likes

I have a similar setup... I have a "Mgmt-VLAN" using DHCP/DHCPv6 and a pseudo safety net providing only IPv6 Link Local. I have a DGS-1210-10

Incomplete config, just for illustrating:

config device
        option  name            'switch'
        option  type            'bridge'
        list    ports           'lan1'
        list    ports           'lan2'
        list    ports           'lan3'
        list    ports           'lan4'
        list    ports           'lan5'
        list    ports           'lan6'
        list    ports           'lan7'
        list    ports           'lan8'
        list    ports           'lan9'
        list    ports           'lan10'
        option  macaddr         '08:5a:11:a2:7f:10'

# My regular Mgmt Interface (but this is tagged, as I'm using only 
# one uplink port to my router, and every vlan is tagged on that link...
config bridge-vlan
        option  device          'switch'
        option  vlan            '16'
        list    ports           'lan8:t'

config interface 'vlan16'
        option  device          'switch.16'
        option  proto           'dhcp'

config interface 'vlan16_v6'
        option  device          'switch.16'
        option  proto           'dhcpv6'


# And my pseudo out of band / safety net direct access link,
# IPv6 link local only
config bridge-vlan
        option  device          'switch'
        option  vlan            '4094'
        list    ports           'lan1'

config interface 'vlan4094'
        option  device          'switch.4094'
        option  proto           'static'
        option  ip6class        'local'
        option  ip6assign       '64'
root@sw1:~# ip addr show switch.16
26: switch.16@switch: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 08:5a:11:a2:7f:10 brd ff:ff:ff:ff:ff:ff
    inet 192.168.16.180/24 brd 192.168.16.255 scope global switch.16
       valid_lft forever preferred_lft forever
    inet6 fde6:a09a:b373:10:a5a:11ff:fea2:7f10/64 scope global dynamic noprefixroute
       valid_lft 43113sec preferred_lft 43113sec
    inet6 2003:XXXX10:a5a:11ff:fea2:7f10/64 scope global dynamic noprefixroute
       valid_lft 13884sec preferred_lft 1284sec
    inet6 2003:XXXX10::d1f9/128 scope global dynamic noprefixroute
       valid_lft 27045sec preferred_lft 27045sec
    inet6 fde6:a09a:b373:10::d1f9/128 scope global dynamic noprefixroute
       valid_lft 27045sec preferred_lft 27045sec
    inet6 fe80::a5a:11ff:fea2:7f10/64 scope link
       valid_lft forever preferred_lft forever

root@sw1:~# ip addr show lan1
3: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master switch state LOWERLAYERDOWN group default qlen 1000
    link/ether 08:5a:11:a2:7f:10 brd ff:ff:ff:ff:ff:ff
root@sw1:~# ip addr show switch.4094
34: switch.4094@switch: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 08:5a:11:a2:7f:10 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::a5a:11ff:fea2:7f10/64 scope link
       valid_lft forever preferred_lft forever

Thank you very much @trendy and @jow

Thank you @_bernd , I can see in your configuration that you don't have an interface with protocol "none" (Unmanaged) so as Jow mentioned it makes sense that the netfid user is in your case an interface on a VLAN that has protocol DHCP / static.

Great idea since link-local is not routable. I was actually thinking about the same after I get comfortable with OpenWrt on a switch. But I was thinking about using unique local (fd00::/8) with a known "static" IPv6.

I have, but only for access ports which config I have not included.
If you need or like to I can dump you the full config

Hmm, do you need that? If you have anything on the bridge (like a VLAN with mgmt interface) should it not bring up the whole bridge with all VLANs?

Yes please, this might make it easy for you:

uci export | sed -E 's|2003:[^ ]+|2003:CENSORED|'

:wink:

Thank you very much.

Uh, not sure. Following config "works" and does its job. Dunno if it can reduced even more.

config interface                'loopback'
        option  device          'lo'
        option  proto           'static'
        list    ipaddr          '127.0.0.1/8'

config device
        option  name            'switch'
        option  type            'bridge'
        list    ports           'lan1'
        list    ports           'lan2'
        list    ports           'lan3'
        list    ports           'lan4'
        list    ports           'lan5'
        list    ports           'lan6'
        list    ports           'lan7'
        list    ports           'lan8'
        list    ports           'lan9'
        list    ports           'lan10'
        option  macaddr         '08:5a:11:a2:7f:10'

##############################################################################

config bridge-vlan
        option  device          'switch'
        option  vlan            '1'
#       list    ports           'lan1'
#       list    ports           'lan2:u*'
#       list    ports           'lan3:u*'
#       list    ports           'lan4:u*'
#       list    ports           'lan5:u*'
#       list    ports           'lan6:u*'
#       list    ports           'lan7:u*'
#       list    ports           'lan8:u*'
        list    ports           'lan9'
        list    ports           'lan10'

config bridge-vlan
        option  device          'switch'
        option  vlan            '16'
        list    ports           'lan8:t'

config bridge-vlan
        option  device          'switch'
        option  vlan            '17'
        list    ports           'lan5'
        list    ports           'lan8:t'

config bridge-vlan
        option  device          'switch'
        option  vlan            '24'
        list    ports           'lan6'
        list    ports           'lan7'
        list    ports           'lan8:t'

config bridge-vlan
        option  device          'switch'
        option  vlan            '64'
        list    ports           'lan2'
        list    ports           'lan3'
        list    ports           'lan8:t'

config bridge-vlan
        option  device          'switch'
        option  vlan            '65'
        list    ports           'lan8:t'

config bridge-vlan
        option  device          'switch'
        option  vlan            '71'
        list    ports           'lan4'
        list    ports           'lan8:t'

config bridge-vlan
        option  device          'switch'
        option  vlan            '76'
        list    ports           'lan8:t'

config bridge-vlan
        option  device          'switch'
        option  vlan            '77'
        list    ports           'lan8:t'

config bridge-vlan
        option  device          'switch'
        option  vlan            '4094'
        list    ports           'lan1'

##############################################################################

config interface 'vlan1'
        option  device          'switch.1'
        option  proto           'none'

config interface 'vlan16'
        option  device          'switch.16'
        option  proto           'dhcp'

config interface 'vlan16_v6'
        option  device          'switch.16'
        option  proto           'dhcpv6'

config interface 'vlan17'
        option  device          'switch.17'
        option  proto           'none'

config interface 'vlan24'
        option  device          'switch.24'
        option  proto           'none'

config interface 'vlan64'
        option  device          'switch.64'
        option  proto           'none'

config interface 'vlan65'
        option  device          'switch.65'
        option  proto           'none'

config interface 'vlan71'
        option  device          'switch.71'
        option  proto           'none'

config interface 'vlan76'
        option  device          'switch.76'
        option  proto           'none'

config interface 'vlan77'
        option  device          'switch.77'
        option  proto           'none'

config interface 'vlan4094'
        option  device          'switch.4094'
        option  proto           'static'
        option  ip6class        'local'
        option  ip6assign       '64'

Thank you @_bernd for posting the config. It makes a lot of sense and I'm going to test if there is a functional difference between proto 'none' on the whole bridge and proto 'none' on each VLAN.

I also want to try untick the [x] Local checkbox in LUCI device configuration and see what is going to happen in the textual configuration.

My assumption is that proto 'none' on the whole bridge and [ ] Local is the simplest secure configuration for L2 switch.

As promised, I had time to test it:

Physical configuration: two switches ZyXEL GS1900-48 connected like this:

1. test - a single Unmanaged interface

config interface 'bigswitch'
	option proto 'none'
	option device 'switch'

It works (PCs can ping each other).

2. test - a single Unmanaged interface for each VLAN

config interface 'myvlan100'
	option proto 'none'
	option device 'switch.100'

config interface 'myvlan101'
	option proto 'none'
	option device 'switch.101'

config interface ...

It works (PCs can ping each other).

3. test - same as 1. but VLANs are set [ ] Local

config interface 'bigswitch'
	option proto 'none'
	option device 'switch'

config bridge-vlan ...

config bridge-vlan
	option device 'switch'
	option vlan '102'
	list ports 'lan01:t'
	list ports 'lan02:t'
	list ports 'lan03'
	list ports 'lan04'
	option local '0'

config bridge-vlan ...

It works (PCs can ping each other).

I'm going to use the last option since that seems the most obvious for a L2 switch.

Btw. I noticed one thing, when I by mistake connected a tagged port to an untagged port, it worked.

That means that untagged port accepts tagged packets with the correct tag. In my opinion that's wrong but it's not a security problem so I guess it's OK.

I'm not 100% sure, but I assume it "works" because there is no other tag (neither tagged or untagged) assigned to lan3 of that second switch. I have never considered this use case or setup :thinking:

/* I've only once seen a setup where the dudes had a cable (on the same switch) from one port to an other to build a really poor mens "vlan translation" */

Can you explain to me what option local is doing?
I don't understand what the wiki wants say to me :confused:

https://openwrt.org/docs/guide-user/network/dsa/converting-to-dsa
Local option will automatically assign the specified VLAN ID to the bridge interface and create a VLAN interface of the bridge interface. So the router can use the VLAN interface to be involved in that VLAN.

If you don't want the router to be involved in that VLAN, you can disable this option and run service network restart for this change to take effect.

PS: So now you are happy and you have a working setup?

Try making the untagged side u* (note the asterisk).

Just use list ports lanN. (You can write it lanN:u*, but you don't need to.)

Thank you for asking. Testing setup is working, I'll see what is going to happen when I add more VLANs and try enabling STP :wink:

My understanding is that if it isn't local (option local 0) then it is not usable within the OS. I can see in LUCI that with option local 0 I can't use those VLANs to setup interfaces:

Is this just an OpenWrt configuration "thing" or does it mean that I can't use those VLANs inside the OS (for example with ip command)? I don't know... If those VLANs are really unusable then this is a more secure setup. If it's just an OpenWrt configuration "thing" then it doesn't matter...

Yes - I tried it and it has no effect. My understanding is that PVID (lan3:u*) has no effect for a port with single untagged VLAN. PVID would have effect if I had (lan3) on one VLAN and ((lan3:u*) on other VLAN. But I don't see too many use cases for that...

It seems that all packets on the tagged ports are sent untagged. Definitely an issue which I reported on Github: https://github.com/openwrt/openwrt/issues/11727

Yes. Looking at https://git.openwrt.org/?p=project/netifd.git;a=blob;f=bridge.c;hb=HEAD#l230 it seems the difference is whether netifd will add the vlan to the bridge itself in addition to the ports. Which is required if you want to use it for routing or anythng else in the OS. Otherwise it will only be switched within the bridge.

1 Like

So less attack surface - slightly more secure. Thank you @bmork

@_bernd Could you please run the following on your switch?

bridge vlan show

Would be helpful for: https://github.com/openwrt/openwrt/issues/11727

lan8 is a trunk; all other ports are access ports; (if and how lan9 and lan10 are usable I don't know. on the vendor firmware i think the user needs to toggle and choose between lan7 or lan9 and between lan8 and lan10.

root@sw1:~# bridge vlan show
port              vlan-id
lan1              4094 PVID Egress Untagged
lan2              64 PVID Egress Untagged
lan3              64 PVID Egress Untagged
lan4              71 PVID Egress Untagged
lan5              17 PVID Egress Untagged
lan6              24 PVID Egress Untagged
lan7              24 PVID Egress Untagged
lan8              16
                  17
                  24
                  64
                  65
                  71
                  76
                  77
lan9              1 PVID Egress Untagged
lan10             1 PVID Egress Untagged
switch            1
                  16
                  17
                  24
                  64
                  65
                  71
                  76
                  77
                  4094

PS: I don't quiet get the "issue" in the linked github issue. Like I also miss the info: Are both devices on the same subnet? Different subnets? But if I can help somehow, I can give it a try...

Thank you very much for posting that.

Re: issue: Yes, all devices are on the same subnet, there is no router there. Of course I don't plan to have devices on the same subnet in different VLANs - it's just for testing L2 on the switch.

My ZyXEL (and you can test your D-Link DGS-1210-10) works OK for a single switch setup. Devices on access ports in different VLANs cannot speak to each other. But when I connect two switches via trunk, the VLAN isolation breaks and devices on VLAN 102 on my first switch can speak to devices on VLAN 103 on the second switch.

I'm happy that I found this problem before I moved the switches into "production" (my house) since what is the point of having router+firewall when VLANing doesn't work.

Are the packets properly tagged on the trunk? You should be able to test that by simply connect the PC to the tagged port and snoop with wireshark or similar. We should find out whether this is an egress or ingress issue.

I'm not seeing this on my switches. Haven't actually tried to connect to of them directly, but I do use them to split VLAN trunks into both untagged access ports and trunk ports. I'm pretty sure I would notice any such failures immediately. But my switches are all RTL8380 based, like @_bernd 's DGS-1210-10. So I guess this could related to the RTL839x.

Another thought is that you could somehow be software switching the packets, conneting all VLANs together in the software bridge. Don't know how. Just a bad feeling I got from the

[230498.762516] rtl838x-eth 1b00a300.ethernet eth0: Ring contention: r: 0, last a40002dc, cur a4000400

error you mentioned in the github issue. AFAIK, that shouldn't happen unless you send "a lot" of traffic to the CPU port. Not necessarily that much relative to what the switch ports can handle, but way more than normal switch management traffic.

The last time I saw something similar was when we had a bug causing flooding of everything to all ports.