LuCI for "option device" to create 802.1q vlan interface

Is there a way in LuCI to create a driver level VLAN as explained at the end of:

https://openwrt.org/docs/guide-user/network/vlan/switch_configuration

When i create a bridge in LuCI and add a custom interface such as "eth1.3", then it will create "eth1.3", but it does not seem to actually create it as a vlan interface with 8021q tag 3.

So, no idea how to do this in LuCI.

This is now for x86 openwrt where i only have actual ethernet interfaces and no l2 switch chip, so no "switch" section in LuCI.

Then you will change original interface from eth1, to eth1.3. You do not create a new one.

Network -> Interfaces -> Add new interface ->
image

1 Like

That is all that you need to do to make the eth1 port send and receive packets tagged with 3. If the port is connected directly to the Ethernet cable, tagged packets will go over it. If there is a hardware switch involved you also need to configure it to pass the tagged packets.

For proper operation detach eth1 (with no VLAN) from all other network configurations. All connections to eth1 should have a VLAN number.

1 Like

Thanks.
And when i do want to bridge that subinterface, i do still create another bridge interface into which i link this subinterface then ?!

Yes, create the new interface, tick the bridge and add the vlan subinterface along with the other interfaces you want to bridge.

This is still all a bit obtuse:

Using LuCI to create a new interface name eth0_3, cover interface eth0.3, unmanaged:
This does nicely create eth0_3 in the LuCI CLI and it also creates eth0.3, but in UCI it is creating "config interface eth0_3", not configure "config device" as described in the openwrt VLAN manual page.

There is also no indication in LuCI what VLAN ID the interface actually uses. And "ip link" does not show it either. Other linux documentation says that "ip link" shows the vlan ID when using "ip link -d", but that option is not supported by openwrt it seems.

The vconfig command also does not seem to exist in openwrt.

Alas, the kernel is useful, "cat /proc/eth0.3" shows:
eth0.3 VID: 3 REORDER_HDR: 1 dev->priv_flags: 1001
...

Is there really no CLI command in openwrt that can show that an interface is a VLAN and show its VLAN ID ??

But overall, it seems to work as long as one understands the magic of creating and "covering" an interface "ethN.M" to create a vlan ID M on ethM.

How do i raise a wish for better LuCI GUI for something like this ?

Try ip link.

All that is needed is heading to the "physical settings" tab of an interface and add a custom interface ethX.Y where Y is the desired vlan ID. As soon as any "foo.X" is referenced in option ifname, netifd will implicitly create a VLAN interface for it. There is no need to create a dummy interface for this.

The explicit config device notation is only needed for non-802.1q VLANS (e.g. when you need 802.1ad) or when you want the VLAN interface to be named differently (e.g. vlan3 instead eth0.3).

I updated the section in the wiki (https://openwrt.org/docs/guide-user/network/vlan/switch_configuration#creating_driver-level_vlans) for better clarity.

Jow,

As said, i have not been able to see (in 18.06.2) any vlan id information from openwrt "ip link", or for that matter any "ip ..." option (from busybox). When i install "ip-full", i can get this detail information (option "-d"), but it is installed as /sbin/ip-full and you can't even start it without linking it to "ip": "Object "-full" is unknown, try "ip help"." Aka: proper iproute2 "ip" command does interpret its command name and would require to be named "ip" to work as expected. Wonder if i could dare to link /sbin/ip to /sbin/ip-full or if the busybox version is sufficiently different from the original that openwrt (uci/luci) would crap out on me if they would see the real thing.

Thanks for updating the documentation. I know how much work it always is to do that.

I find the term "driver-level-vlan" to be a confusing term for ethX.Y though. A VLAN is a logical broadcast domain in an ethernet network and its switches. The real equivalent in software is a (set of) linux bridge group(s), but not an ethX.Y.

I suggest to replace the term driver-level-vlan with sub-interfaces (of ethX). An ethX connects to a VLAN capable switch, either internal or external (via a cable between ethX and that switch). EthX.Y then connects to VLAN ID Y on that switch.

Of course there is the even more convoluted case when one creates an actual software switch via linux bridge-groups, because in that case you can freely bridge between arbitrary VLAN ID tags on different interfaces, but i guess this can be left as a documentation battle for another day :wink:

Opkg should already take care of symlinking ip to ip-full upon install. In master, the ip-full object has been moved to /usr/libexec/ to not confuse users anymore.

oops. My bad. forgot to check that /sbin/ip was actually relinked.

Might be worthwhile to also add to the documentation how to check what VLAN mode/ID a subinterface has sigh