I help organize an academic event. As part of our deployment process we create pods, pods are identical setups we currently use VMWare (though looking toward Proxmox in the future), as part of this process we create linked clones. The MAC Addresses change and everything is run via a 1:1 NAT configuration. When VYOS boots, I have a script that configures the NAT and other configuration. vyos-autoconf/autoconf.sh at main · spiceywasabi/vyos-autoconf · GitHub.
However after deployment I noticed none of the pods were coming up with networking. Logging into one of the VyOS routers I noticed that eth0 gets renamed and eth1 gets renamed. There’s been some discussion on the forums Interface renaming in 1.4 rolling - #14 by Nikolay but no fix was presented. I tried deleting all interface configuration before shutdown (and clone) but that didn’t fix it or stop the post-boot renaming. We can try for cloud-init but that is a lot more challenging.
I realize our setup is probably an edge case. But I was hoping for some ideas how to get the interface names to be consistent especially since the event is supposed to be identical. Is there a way to stop the interface renames?
We’re using a slightly older versions of VyOS, 1.2 and 1.3 respectively.
In VyOS the MAC address is associated with an interface. Cloning the OS and booting up it can’t find the interfaces belonging to the MACs and it creates new interfaces.
That may happens to you too, well that’s how it is for me when I clone them on Proxmox.
You would have to delete the MAC address before cloning.
Would that be:
delete interfaces ethernet eth0 mac
I delete eth0 and eth1 before clone and let the script reconfigure things for DHCP. I had thought that clears any configuration before setup. Is that not the case? If so, what would actually clear out the mac addresses?
In 1.3 it’s not
hw-id, for other version you gotta check the documentation.
Deleting the interfaces itself doesn’t sound like a good idea to me. You loose all configuration for them, VyOS wouldn’t know how to get the IP, static or dhcp or whatever else.
Ah your right. I was just going off memory when replying. Its a bit like taking a hammer to the interfaces. But it works. I don’t mind not having any configuration in advance in this particular setup.
The second interface always should be the LAN and the first interface should always be WAN with DHCP. I then apply the settings on top based on that assumption. But the interfaces still get renamed by systemd-udevd.
This is a mistake I’ve made before too
hw-id is the MAC that identifies the hardware to bind to.
mac is the MAC for the physical interface to use.
To always make sure 00:aa:bb:cc:dd:ee is eth0 you put “hw-id 00:aa:bb:cc:dd:ee” under eth0.
To make eth0 send packets as “bb:cc:ee:44:33:22” you set “mac bb:cc:ee:44:33:22” under eth0.
I assume “hw-id” occurs before the “mac”?
As in hw-id acts on the physical mac and not on the configured mac?
Would it be technically possible to expand hw-id to also include PCI-slot or similar?
Like on these boxes the nic is always placed at pci “00:19.0”.
This would resolve the issue the OP talks about.
Or if hw-id is removed will VyOS always number the interfaces in the order they appear in “lspci” (because then this would be the workaround for OP)?