Creating VLAN

Started by lilsense, March 28, 2022, 08:47:21 PM

Previous topic - Next topic
  In the new 22.1, when creating a VLAN, it's not allowed to correctly assign deviceid?

so as an example when one attempts to create VLAN3, deviceId is automatically selected for you as VLAN01 if there are no other VLANs.

One ought to be able to correctly align the two information together.

I have also observed this since the latest update. My VLANs created on an older version of OPNsense have sensible deviceid's such as " igb1_vlan22" for VLAN ID 22 on parent interface igb1. This naming makes a lot of sense. I created a VLAN ID 201 today on parent interface igb0 and OPNsense automatically created it with the deviceid of "vlan01" which is not very helpful when I am trying to assign things to it.

Not sure if related, but the latest update also broke my PPPoE configuration and I had to delete my VLAN and PPPoE virtual interface and recreate them (with the same exact settings) to get my ISP connection working again because OPNsense was just sitting there looping PADI/PADO, even after a reboot. This was only after my cronjob to install the latest update 22.1.4_1 fired off last night.

https://github.com/opnsense/core/commit/64fb551caa3

The changes are permanent as "igb1_vlan22" is not sustainable for a number of technical reasons:

First and foremost the 16 character limit of network devices which makes stacked VLAN "igb1_vlan22_vlan33" impossible for example. Also, if a parent interface or tag changes the device needs to be renamed and the rename must be carried out in assigned interfaces as well. This is much worse for stacked VLANs where you can't directly edit the parent-parent interface. It's a lot of complexity with bugs slumbering in the depths of the code paths waiting to happen.

FreeBSD ifconfig will create "vlan0", "vlan1", etc. devices by default too and we will now split between "vlan" and "qinq" prefix to make it easier to distinguish stacked VLANs and if you can actually stack one again (the limit is two actually). We use the leading "0" in numbering to avoid clashes with default ifconfig naming as described earlier.

Old names are preserved for the time being but that might change due to mentioned reasons.


Cheers,
Franco

Why not just use/pick the tagged ID that the user enters as the deviceId? I do understand the silly naming convention but coming from the networking and coding side you never want to use something and call it something else.

banana = "pickle"

VLAN05 = 99

????

Sure, I encourage you to edit the resulting config.xml entry and switch "vlanif" to whatever you prefer.  I have to say that for several technical reasons that is a bad idea, but please don't mind that much.


Cheers,
Franco

QuoteWhy not just use/pick the tagged ID that the user enters as the deviceId? I do understand the silly naming convention but coming from the networking and coding side you never want to use something and call it something else.

Because vlan tags aren't unique, multiple interfaces can share the same one, which is where unique sequences come into play. Further more it's easier to cope with changes when "anchors" are fixed.

When it comes to naming and preventing inconsistencies in "data" it might help to take a look at how databases are being designed (https://en.wikipedia.org/wiki/Third_normal_form) as these cope with the same type of problem where changing a name shouldn't lead to changes in related records for example.

Thinking of Switching, you'd be incorrect. However, how easily I forgot that OPNsense is a router and interfaces cannot be in the same subnet. :)

So from the perspective of the deviceId vs. tag. I'd highly recommend displaying the tagged information on the Interfaces:Assignments since looking at the VLAN index information is not clear to the configurator what VLAN01, VLAN02, VLAN03 are...


The FreeBSD default for auto-created VLANs is igb0.27, lagg0.2, ... btw.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

# ifconfig vlan create
vlan0

Nope :)


Quote from: franco on March 29, 2022, 03:28:31 PM
# ifconfig vlan create
vlan0

Nope :)

If you put this into /etc/rc.conf:
vlans_lagg0="1 2 3 4"
and reboot, you will end up with

lagg0.1
lagg0.2
lagg0.3
lagg0.4

All with the correct vlandev and tag already set.

Kind regards,
Patrick
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Yes, the rc system does that. I wasn't disagreeing. But since we only use ifconfig ourselves I tried to make it clear which sort of ground rules exist. :)


Cheers,
Franco

So I am confused. it seem like I should jus create rc.conf file and do:

vlans_ax0="2 5 33 78 126"

and reboot.

If you weren't running OPNsense but stock FreeBSD, yes.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)