Hello everyone, I know this is probably a stupid question, but I would like to solve it.
How can I get the interfaces to line up one after the other … ie: vlan102, vlan103, vlan600 and vlan1000 ?
I came from Debian 11 and it sorts automatically there. I haven’t figured out a way to achieve this yet. Can someone advise me?
[root@router ~]# ip -4 a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
inet 10.107.x.x/30 brd 10.107.x.x scope global noprefixroute enp1s0
valid_lft forever preferred_lft forever
5: vlan600@enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
inet 10.20.x.x/26 brd 10.20.x.x scope global noprefixroute vlan600
valid_lft forever preferred_lft forever
6: vlan103@enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
inet 10.107.x.x/29 brd 10.107.x.x scope global noprefixroute vlan103
valid_lft forever preferred_lft forever
7: vlan1000@enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
inet 10.123.x.x/29 brd 10.123.x.x scope global noprefixroute vlan1000
valid_lft forever preferred_lft forever
8: vlan102@enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
inet 10.107.x.x/29 brd 10.107.x.x scope global noprefixroute vlan102
valid_lft forever preferred_lft forever
Do you think the ordering is affected by udev or directly by NetworkManager? I would like to look at the source codes if it would be possible to modify it.
As far as I know, it’s the udev that decides the naming scheme. Because we don’t have problem with naming scheme here, but rather how to display it, I think we should look at or modify the command that does the display, i.e. “ip addr” command. But I’m not an expert on this so I might be wrong
A friend of mine who is very experienced in Linux explained it to me:
The whole thing is created by ip addr ordering it according to ifIndex, which is created by how interfaces are added. Nmcli adds it all at once in parallel, the init script is loaded lined up - that’s why init runs nicely. The whole problem with init is that almost any change requires a reboot, which nmcli solves.
So it makes no sense to deal with it and it is better to reorient to NetworkManager / nmcli.
autoconnect-priority The autoconnect priority. If the connection is set to autoconnect, connections with higher priority will be preferred. Defaults to 0. The higher number means higher priority.
So, depending on how you want to sort the vlans, you can set, for example:
Haha, not at all. Thank you for sharing. Just curious, maybe you have OCD? I think I also have one, so I understand why you want things in a specific order
Well, looks like you really have OCD. It’s obsessive compulsive disorder. You can search and read more about it. It’s nothing to worry about though. I’ve just recently realized that I may also have it because of the needs to check things over and over again