VLAN assigning

Hi,

I've got a newbie question: could anyone explain me why to use 'vlan' AND 'vid'
options when configuring 'switch_vlan'?
I've read https://lede-project.org/docs/user-guide/switch_configuration
and I thought I get the difference between hardware VLAN and software VLAN.
As I understand it, the former is for assigning VLANs on programmable switch,
the latter for creating VLANs on one physical port (for example single NIC device).
For example:

config 'switch_vlan' 'eth0_1' option 'device' 'eth0' option 'vlan' '1' option 'ports' '0 1 3t 5t'

and

config device 'eth0.106' option type '8021q' option name 'eth0.106' option ifname 'eth0' option vid '106'

Looking at some configs in the Internet, I've seen quite a lot advice to assign
'vid' option except 'vlan' similar to this:

config 'switch_vlan' 'eth0_1' option 'device' 'eth0' option 'vlan' '1' option 'ports' '1 5t' option 'vid' '1'

or

option 'vid' '100'

What's the point and use case of such an option? When I create on my programmable
switch VLAN with option 'vlan' '1' it is assigned VLAN ID 1 without adding option 'vid' '1' anyways. When I add option 'vid' '100' and option 'vlan' '1' there are then two interfaces displayed in LuCi: eth0.1 and eth0.100 but it seems that only eth0.1 is used.
Is it even proper to set these two options in 'switch_vlan' section?
I think one could still set VLANs this way:

config 'switch_vlan' 'eth0_1' option 'device' 'eth0' option 'vlan' '1' option 'ports' '1t 5t'

and

config 'switch_vlan' 'eth0_100' option 'device' 'eth0' option 'vlan' '100' option 'ports' '1t 5t'

Documentation does not encompass using 'vid' option together with 'vlan' option.

mash

Dear Mash;

To be frank, this VLAN documentation need more rewriting.

I wrote sections "discover your hardware" and "software VLAN", so please let me answer.
These two sections are targeted at new users to help make a distinction between switch and interface.

As for software VLAN writing:

config device 'eth0.106'
option type '8021q'
option name 'eth0.106'

is enough and will tag eth0 as part of VLAN 106.

I will have a closer look at the switch configuration section. If you can, apply your own modifications. I added a back link in the article to this thread.

I don't know precisely to which extent 'vlan' or 'vid' are needed. I will study connecting a LEDE device (I need to unbrick one ...) to a switch...

Kind regards,
French Fries

From OpenWrt documentation (https://wiki.openwrt.org/doc/uci/network/switch#vlanswitch_config):

The number of the VLAN is specified on the option vlan line. The VID (VLAN ID) associated with a VLAN is by default the same as the number of the VLAN. This is overridden by using an option vid line so, for example, that VLAN 1 could use VID 100.

Documentation is good for new users. Almost perfect. It is missing only some details that new users won't use anyway (I suppose).

Your answers gave me a hint and I've done some tests on my box.
Now I knew that using 'vlan' '1' and 'vid' '100' simultaneously was proper action but there still appeared two virtual interfaces in LuCi: eth0.1 and eth0.100.
I could even assign those virtual interfaces originating from one switch_vlan section to different bridged interfaces (have no idea what the implication would be).

There was only one distinction: eth0.100 (also 'vid' number) was described as "Switch VLAN" and eth0.1 (also 'vlan' number) was "Software VLAN".
Last thing I noticed - I did not declare eth0.100 interface but only eth0.1 which was in my 'lan' bridged interface section. I changed that to eth0.100 and that was it. I had only hardware VLAN eth0.100 visible in LuCi.

So, this verse from OpenWrt wiki does not say that adding option 'vid' 'XXX' to your vlan_switch section you should change your interface section to option ifname eth0.XXX (where XXX is your VLAN ID).
It seems that ifname eth0.XXX declaration from interface section overrides somehow 'vid' number assigned for VLAN. It was my misconfiguration.

your config section seems weird,because uci parse don't accept section name "eth0.106".(not support "."dot).so how dit it works?

Didn't know that. Maybe last table in last section should be amended then?
Anyone can confirm? I stayed with interface and switch_vlan sections in my config so I dont't know.

Is that doc correct?

config device 'eth0.204'

It doesn't seem to like 'config device' only 'config interface'. What is the difference and how to set this up with a single physical port device to trunk vlans to a managed switch? WAN is physical LTE card, so only need LAN VLANs to work on single physical port.

config interface 'lan'
   option ifname 'eth0.204'
   ...

Hey friend

I have applied VLAN capability on two openwrt routers and the tagged frames are getting propagated without any issue between routers (according to the satisfying output) . now I just wanna know if there is any method to capture these tagged frames on the routers as a proof before they reach the final switch in which the tagged frames are getting un-tagged for the final destination.

You can take a capture using tcpdump and then scp that to your computer and view them using wireshark to filter for the appropriate traffic that gets tagged.

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