Question:


How to fix Interface re-ordering after reboot in FlexVNF VM running on VMware 



Answer:


The issue here is related to VMware behavior.

  • If an interface is added or deleted, Linux/ESXi does not guarantee the consistent interface numbering.
  • This is applicable for all types of interfaces (VMXNET3/ET1000/SR-IOV)
  • https://kb.vmware.com/s/article/1034782


  1. Open file /etc/udev/rules.d/75-persistent-net-generator.rules and comment out line #78 and #79


Add # in start of  line 78 and 79. sudo nano /etc/udev/rules.d/75-persistent-net-generator.rules.

78 ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*|00:05:69:*|00:1C:14:*", \
79                                        ENV{MATCHADDR}=""


  1. Open /etc/udev/rules.d/70-persistent-net.rules and define the correct order of NIC based on MAC. If "70-persistent-net.rules" file doesn't exist you may have to reboot the FlexVNF VM first.


NOTE:You have to explicitly add udev rules for SR-IOV interfaces. Udev rules gets created for VMXNET3, E1000 interfaces after commenting line 78 and 79 from /etc/udev/rules.d/75-persistent-net-generator.rules



Example:

[admin@BLR-Hub-01: ~] $ sudo cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:09:ed:b7", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:09:ed:c1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:09:ed:ad", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"


  1. Reboot VM