Posted by: kezhong | February 27, 2011

Persistent the network interface numbering

One of our servers always changed its ethX numbers after being rebooted. For example, this time it’s eth0, next time it will be eth1, and it happened randomly.
After searched from the net, I found the solution, and record as below.

Firstly, find out the MAC addresses of the NICs.
# grep -H . /sys/class/net/*/address|grep -v lo
/sys/class/net/eth0/address:00:0c:29:32:b9:eb
/sys/class/net/eth1/address:00:0c:29:31:b8:ec

Then, modify the MAC addresses in the file /etc/udev/rules.d/70-persistent-net.rules to change Udev rules similar to the following:
# vi /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:0c:29:32:b9:eb”, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:0c:29:31:b8:ec”, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth1″

Reboot the system again and again, I found that the network interface numbering was persistented.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: