Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using CentOS 5.9. One of my servers recently had a malfunctioning NIC port. The software running on the server was hard-coded to use eth0. The other physical NIC ports were fine and unused. The issue is now resolved but I'm curious, how hard would it be to convince CentOS that the other NIC port is eth0?

Is it just a matter of editing /etc/sysconfig/network-scripts/ifcfg-eth0 and setting HWADDR=<MAC Address of second NIC port> ?

share|improve this question

2 Answers 2

up vote 7 down vote accepted

Adjusting

/etc/udev/rules.d/70-persistent-net.rules
/etc/sysconfig/network-scripts/ifcfg-eth0 (HWADDR)

should do the trick.

share|improve this answer
    
The udev rules bit is applicable to most modern Linux distros. –  Andrew Apr 5 '13 at 6:23
1  
persistent-net.rules name could be different depending on OS. For example for for suse it could be 30-net_persistent_names.rules. –  Drt Apr 5 '13 at 7:38
    
Just for grins, I checked this on a VM and I don't see /etc/udev/rules.d/70-persistent-net.rules. Is this file only present on bare-metal systems? –  Mike B Apr 6 '13 at 3:01

Open /etc/udev/rules.d/70-persistent-net.rules with your favorite editor and Do below changes

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:xx:xx:xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

then

cd /etc/sysconfig/network-scripts/      

put the HWADDR entry in ifcfg-eth1 file

 DEVICE="eth1"
 BOOTPROTO="static"
 HWADDR="00:50:56:xx:xx:xx"
 IPADDR="192.168.x.x"
 NETMASK="255.255.255.0"
 ONBOOT="yes"

then after rebooting your system & you will be able to get IP assign in ifcfg-eth1

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.