cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Cloud



Etc


Reference














.

os:linux:network:udev.html



udev rules - How to Configure udev rules in Linux

Check Mac Address

RHEL6/CentOS6

# udevadm info -a -p /sys/class/net/eth0

RHEL6/CentOS5

# udevinfo -a -p /sys/class/net/eth0
# udevinfo -a -p /sys/class/net/eth0 |grep SYSFS{address}
    SYSFS{address}=="1c:c1:de:xx:ce:xx"

Configuration

A upper case and lower case of Mac address is important. You must check udevinfo command.

/etc/udev/rules.d/xx-xxxxxxx.rules

RHEL6/CentOS6

/etc/udev/rules.d/70-persistent-net.rules

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

RHEL5/CentOS5

/etc/udev/rules.d/60-net.rules

SUBSYSTEM=="net",KERNEL=="eth*",SYSFS{address}=="1c:c1:de:xx:xx:xx",NAME="eth0"
SUBSYSTEM=="net",KERNEL=="eth*",SYSFS{address}=="1c:c1:de:xx:xx:xx",NAME="eth1"
SUBSYSTEM=="net",KERNEL=="eth*",SYSFS{address}=="d4:85:64:xx:xx:xx",NAME="eth2"
SUBSYSTEM=="net",KERNEL=="eth*",SYSFS{address}=="d4:85:64:xx:xx:xx",NAME="eth3"
SUBSYSTEM=="net",ACTION=="add",KERNEL=="eth*",SYSFS{address}=="xx:xx:xx:xx:xx:xx",NAME="eth0"
SUBSYSTEM=="net",ACTION=="add",KERNEL=="eth*",SYSFS{address}=="xx:xx:xx:xx:xx:xx",NAME="eth1"
SUBSYSTEM=="net",ACTION=="add",KERNEL=="eth*",SYSFS{address}=="xx:xx:xx:xx:xx:xx",NAME="eth2"
SUBSYSTEM=="net",ACTION=="add",KERNEL=="eth*",SYSFS{address}=="xx:xx:xx:xx:xx:xx",NAME="eth3"


memo

SUBSYSTEM=="net", DRIVERS=="?*", KERNEL=="eth*", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="eth0"
SUBSYSTEM=="net", DRIVERS=="?*", KERNEL=="eth*", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="eth1"
SUBSYSTEM=="net", DRIVERS=="?*", KERNEL=="eth*", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="eth2"
SUBSYSTEM=="net", DRIVERS=="?*", KERNEL=="eth*", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="eth3"
KERNEL=="eth*", SYSFS{address}=="xx:xx:xx:xx:xx:xx", NAME="eth0"
KERNEL=="eth*", SYSFS{address}=="xx:xx:xx:xx:xx:xx", NAME="eth1"
KERNEL=="eth*", SYSFS{address}=="xx:xx:xx:xx:xx:xx", NAME="eth2"
KERNEL=="eth*", SYSFS{address}=="xx:xx:xx:xx:xx:xx", NAME="eth3"







os/linux/network/udev.html.txt ยท Last modified: 2021/03/08 by admin

Page Tools