3

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> ?

2 Answers 2

7

Adjusting

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

should do the trick.

3
  • The udev rules bit is applicable to most modern Linux distros.
    – Andrew
    Apr 5, 2013 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, 2013 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, 2013 at 3:01
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .