image

 

During a project I am working on, I had to replace the NICs in my Dell blade servers running CentOS 6.4 minimal installation.

 

Here was my scenario:

Dell M600/610 blade servers. 2x onboard Broadcom NICs, 4x Broadcom NICs via mezz slot.

I replaced the Broadcom mezzanine quad-port card with an Intel quad-port card , due to a problem with Broadcom drivers and my application.

 

Most of my sysadm experience is working with Windows server and Windows to its credit handles this change very well; however with CentOS, especially the minimal installation server I have, it is not as intuitive. After some quick searching I found some information on how to do this. I did not find a guide per se and I have some iSCSI configuration as well which needed attention. Here is how I did this, hopefully someone will find my experience helpful.

 

I assume that you have replaced your NIC and are trying to set it up in CentOS.

 

The first thing you should do is take a look at all of your current ifcfg files and make backup notes on the interfaces before doing anything else.

 

# cd /etc/sysconfig/network-scripts
# ls

 

Take a look at all of the ifcfg-xxx files in the directory. The quickest way to get a backup of your text files would be to display the file and copy and paste the contents (listing the full path just in case):

 

# cat /etc/sysconfig/network-scripts/ifcfg-eth0


DEVICE=eth0
HWADDR=00:BB:BB:AA:AA:AA
TYPE=Ethernet
UUID=(random string here)
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.1.10
NETMASK=255.255.255.0
GATEWAY=192.168.1.1

 

Depending on your NICs and how your installation detected them, you will see eth0, em1, or p3p1. Do NOT do this for ifcfg-lo, leave this interface alone as this is your loopback adapter. Once you have a backup of all of your NICs, edit each interface and completely remove the HWADDR= lines and save the changes.

 

Next, we need to delete the following file and then reboot your server:

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

 

Deleting this file will force CentOS to rescan your NICs, find MAC addresses, and confirm manufacturer for drivers.

 

To recap, here is what we have done so far:

-Documented all of our interface configurations
-Removed the MAC addresses from all of the ifcfg files
-Prepared our server to rescan NICs at restart

 

After the reboot, take a look at the newly created 70-persistent-net.rules file. It may look something like this:

 

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

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x14e4:0x163a (bnx2) (custom name provided by external tool)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:AA:AA:AA:AA:AA”, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″

# PCI device 0x14e4:0x163a (bnx2) (custom name provided by external tool)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:AA:AA:AA:AA:AB”, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth1″

# PCI device 0x14e4:0x163a (bnx2) (custom name provided by external tool)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:AA:AA:AA:AA:BA”, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth2″

# PCI device 0x14e4:0x163a (bnx2) (custom name provided by external tool)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:AA:AA:AA:AA:BB”, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth3″

 

Looking at this file, we know which MAC address relates to each interface by “NAME”. Next, just do an edit on all of your interfaces, add back the HWADDR= section with the appropriate MAC for each interface.

Once you complete the update of the MAC addresses on all of your interfaces, you need to issue a “service network restart” for your changes to take effect.

 

*Note – If you swapped NICs like I did, just because an interface is labeled “eth0” by CentOS does NOT mean it is referencing the same physically cabled port as before. You may need to perform port lookups on your switch to verify ports. If you are running on Cisco switches, you can do this by establishing an ssh session to your switch and entering the following, assuming the following MAC address.

1234.5678.ABCD

MyCiscoSwitch01# show mac addr | incl ABCD

 

If this yields no results, try pinging the gateway you configured on the NIC of the MAC you are attempting to trace to generate some traffic.

 

If you do not remove the HWADDR= field on your NICs before rebooting, you will see an error when your server attempts to bring the interfaces up during boot or when you try to bring the interfaces online via the network service. It will say, the MAC is not the expected MAC for the interface. This is because it is comparing the MAC address on your interface to the 70-persistent-net.rules file.

 

If you have any iSCSI interfaces you will need to update them if the ifcfg-xxx file changed. Be sure to check and update the interface file in your /var/lib/iscsi/ifaces/ directory. Remember to restart multipathd, iscsid, and to run a discovery, a login, and to check via multipath –ll command after updating your configuration.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.