NIC replacement procedure

Just wondering, what is the best procedure to replace a NIC?

After the swap and boot, it is seen as a new interface (assuming because the MAC is defined in the config and no longer matches?). Which in turn means it comes back up only partially operational, as one interface is now missing, which is a bit of a pain if you send out a field engineer to swap the hardware, someone without access to and knowledge of VyOS.

I suppose what you could do is edit config.boot with the MAC address of the new NIC, and then when the field engineer swaps the hardware and reboots the box, VyOS will apply the config to the proper NIC on boot.
This of course would require knowing the MAC address of the NIC beforehand.

And the broken NIC shouldn’t prevent remote access, which is not a given.

Well thats the drawback of the way how VyOS currently rename interfaces based on mac-address instead of physical position (I think it uses) like Proxmox script does:

What you could try to instruct your fieldtech (or test in a lab first) is if you remove the hwid from the /config/config.boot file and save it, then shutdown the box to replace the card and then boot it up.

Will the “new” card find its slot in unused configured ethX interface or not?

Otherwise you will first have to boot up some random box with the new card to find out its physical mac-address and then instruct your field-tech on how to login locally (using console or such), replace the hwid in /config/config.boot (swap out the old mac-address with the new), save file, shutdown box, perform the swap, boot up the box and tada!

The tricky part of using the physical location like Proxmox uses is that for a new kind of hardware that will take longer to figure out rather than the mac-address method. Also since its not uncommon that the order of the NIC at front (or back) of the box isnt necessary sequential due to how things are wired internally.

The new card is added as a new ethX interface.

If you replace eth0, the box boots up without eth0 and a new ethX (X being the highest used number + 1). I haven’t tested what happens if one in the middle is removed (say you have eth0, eth1 and eth2, and you replace eth1, do you end up with 0,2 and 3?).

I’ll try playing around with a pre-conf script, see if I can find a way to patch the boot config before it loads, using hardware info available at that point.

It might be handy for restoring config from another VyOS router as well, as that will run into the same issue.