H Sample Net Rules File

Udev uses rules files that determine how it identifies devices and creates device names. The udev daemon (udevd) reads the rules files at system startup and stores the rules in memory. If the kernel discovers a new device or an existing device goes offline, the kernel sends an event action (uevent) notification to udevd, which matches the in-memory rules against the device attributes in /sys to identify the device. As part of device event handling, rules can specify additional programs that should run to configure a device. Rules file, which have the file extension .rules, is located in the following directory: /etc/udev/rules.d/*.rules

Sample File:
# eth0 interface with MAC address "fa:16:3e:cc:12:d6" will be assigned "xmi"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="fa:16:3e:cc:12:d6", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="xmi"
# eth1 interface with MAC address "fa:16:3e:1a:8d:8a" will be assigned "int"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="fa:16:3e:1a:8d:8a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="int"

Note:

If you need a 3rd interface add respective entry also. The iDIH Mediation VM needs an imi interface too.
# eth1 interface with MAC address "fa:16:3e:1a:8d:8a" will be assigned "int"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}==" fa:16:3e:8a:1a:12", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="imi":

Note:

  • MAC address of each interfaces can be determined using the following command issued from the console:
    ifconfig -a
  • Update MAC address for each interface. The MAC addresses must be entered in all lower case.
  • Update the interface names as in the above example.