Remapping Ethernet Interfaces using hw-id / mac address

Using version VyOS 1.5-rolling-202407280023 and I have encountered what I think is a strange behaviour.

I am booting an instance of VyOS on KVM that has 9 interfaces.

On booting the assigned names (eth0, eth1 etc) are out of order with the mac-addresses.

I expect eth8 to be eth0, eth0 to be eth1, eth1 to be eth2 etc

vyos@vyos:~$ show interfaces 
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface    IP Address    MAC                VRF        MTU  S/L    Description
-----------  ------------  -----------------  -------  -----  -----  -------------
eth0         -             52:54:00:ab:cd:01  default   1500  u/u
eth1         -             52:54:00:ab:cd:02  default   1500  u/u
eth2         -             52:54:00:ab:cd:03  default   1500  u/u
eth3         -             52:54:00:ab:cd:04  default   1500  u/u
eth4         -             52:54:00:ab:cd:05  default   1500  u/u
eth5         -             52:54:00:ab:cd:06  default   1500  u/u
eth6         -             52:54:00:ab:cd:07  default   1500  u/u
eth7         -             52:54:00:ab:cd:08  default   1500  u/u
eth8         -             d4:93:90:2b:a0:9e  default   1500  u/D
lo           127.0.0.1/8   00:00:00:00:00:00  default  65536  u/u
             ::1/128

Using delete interfaces ethernet ethX and set interfaces ethernet ethX hw-id '<mac>' allows me to change the assigned interfaces and it seems to work correctly and allow me to apply the config I have prepared.

vyos@vyos:~$ show interfaces 
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface    IP Address    MAC                VRF        MTU  S/L    Description
-----------  ------------  -----------------  -------  -----  -----  -------------
eth0         -             d4:93:90:2b:a0:9e  default   1500  u/D
eth1         -             52:54:00:ab:cd:01  default   1500  u/u
eth2         -             52:54:00:ab:cd:02  default   1500  u/u
eth3         -             52:54:00:ab:cd:03  default   1500  u/u
eth4         -             52:54:00:ab:cd:04  default   1500  u/u
eth5         -             52:54:00:ab:cd:05  default   1500  u/u
eth6         -             52:54:00:ab:cd:06  default   1500  u/u
eth7         -             52:54:00:ab:cd:07  default   1500  u/u
eth8         -             52:54:00:ab:cd:08  default   1500  u/u
lo           127.0.0.1/8   00:00:00:00:00:00  default  65536  u/u
             ::1/128

However once I save the configuration and reboot the router, I get the following error;

<snip>
[   24.936976] vyos-router[985]: Waiting for NICs to settle down: settled in 7sec..
[   26.811361] vyos-router[985]: Mounting VyOS Config...done.
[   40.599154] vyos-router[985]: Starting VyOS router: migrate system configure failed!
[   41.502306] vyos-config[1007]: Configuration error

Welcome to VyOS - router ttyS0

… and the interfaces have changed.

vyos@ert:~$ show interfaces 
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface    IP Address    MAC                VRF         MTU  S/L    Description
-----------  ------------  -----------------  --------  -----  -----  ---------------------------
br100        -             de:f6:be:42:cd:36  VRF100   1500  u/D    BR100
br101        -             a6:8f:f0:9b:01:07  VRF101   1500  u/D    BR101
eth0         -             d4:93:90:2b:a0:9e  default    1500  u/D    ETH0
eth9         -             52:54:00:ab:cd:08  default    1500  u/u
eth10        -             52:54:00:ab:cd:04  default    1500  u/u
eth11        -             52:54:00:ab:cd:03  default    1500  u/u
eth12        -             52:54:00:ab:cd:01  default    1500  u/u
eth13        -             52:54:00:ab:cd:06  default    1500  u/u
eth14        -             52:54:00:ab:cd:07  default    1500  u/u
eth15        -             52:54:00:ab:cd:02  default    1500  u/u
eth16        -             52:54:00:ab:cd:05  default    1500  u/u
lo           127.0.0.1/8   00:00:00:00:00:00  default   65536  u/u
             ::1/128

Perhaps I am not using set interfaces ethernet ethX hw-id '<mac>' correctly. Wondering if anyone can suggest what might be happening here or what I might be doing incorrectly?

Probably easier if you at first step (when your interfaces are “out of order”) save the config and then manipulate that config file with vi or such (located in /config/config.boot) and then reboot the box.

3 Likes

That was a useful tip and it pointed me to the problem, which was definitely user error (me!). I am not entirely sure how I did it but the mac address tied to eth1-eth8 were different to those above and which didn’t exist on the system. I’m guessing I did it before somehow and was never really clearing the interfaces properly from the config. So - Solved, and I learnt another useful troubleshooting tool. Thanks.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.