Thursday, December 29, 2011

Linux - change a network interface name

I need to have homogenous names for my network interfaces in the whole cluster. Some were named eth0 others eth1 and so on. Now all of them are called eth0, this unlikely requirement is due to the fact that getting the ip from the master server depends on one network interface called eth0.


Edit the file -
vi /etc/udev/rules.d/70-persistent-net.rules

as root or a power user and change entries with eth0 to whatever you desire.
udev support is available for most kernels in the 2.6 generation.

This is how I'm getting the ip info:

MASTERNODE=`/sbin/ifconfig eth0 | grep inet | awk '{print $2}' | sed 's/addr://'`

No comments:

Post a Comment