The following describes the procedure for swapping a NIC after stopping the system on RHEL7 or later. If the interface names are switched before and after swapping NIC, the operating system network configuration file must be modified.
When swapping multiple NICs, replace them one at a time without replacing them at once. Perform the swapping procedure for each swapped NIC.
Collect the interface name of NIC.
Collect the interface name from /sys/class/net directory.
# cd /sys/class/net # ls eth0 eth1 lo |
Check the correspondence between NICs and MAC addresses.
Check the MAC address for all the interface name collected in step 1.
# cat eth0/address
<MAC_address> |
Check the correspondence between NICs and bus addresses.
Check the bus address of NIC for all the interface name collected in step 1.
# ls -l eth0/device lrwxrwxrwx 1 root root 0 Apr 9 09:17 eth0/device -> ../../../0000:01:06.0 |
The bus address is the file name (directory) of the lowest layer of the symbolic link destination file displayed in the output command result.
The bus address is the address information for identifying the device configuring the following information.
[<segment_number>:]<bus_number>:<slot_number>.<function_number> |
The segment number is not displayed depending on the model, because it is used as a part of bus number.
Create a hardware address description of NIC from the information collected in steps 1 to 3.
Interface name | MAC address | Bus address |
---|---|---|
eth0 | <MAC_address> | <bus_number>:<slot_number>.<function_number> |
... | ... | ... |
Shut down the system.
# shutdown -h now |
Swap NIC.
Information
In the following procedure, edit the interface configuration file to deal with the swapping of interface name.
If "HWADDR" is not stated in the interface configuration file of NIC before swapping, the following procedures are not necessary.
Start the system and modify the MAC address of the hardware address description of NIC created in step 4.
Boot the system in rescue mode.
Modify the operating system network configuration file.
8-1. Collect the interface name from the /sys/class/net directory.
# cd /sys/class/net # ls eth2 eth3 lo |
If the collected interface name is not in the hardware address description of the NIC created in step 4, a new name will be attached to the swapped NIC. Continue the following procedure.
8-2. Check the MAC address and bus address that corresponds to the interface name that did not exist in the system before NIC swapping.
## cat eth2/address
<MAC_address> |
# ls -l eth2/device lrwxrwxrwx 1 root root 0 Apr 9 09:17 eth2/device -> ../../../0000:01:06.0 |
8-3. When comparing the checked bus address with the bus address string of the hardware address description of NIC created in step 4, the line of the corresponding interface can be seen. Set the checked MAC address in "HWADDR" of the configuration file corresponding to this interface.
Note
For multiple NIC ports, all ports of the interface configuration file must be edited.
Repeat step 8.
Reboot the system.
# shutdown -r now |
Modify the hardware address description of NIC.
Modify the MAC address of the hardware address description of NIC created in step 4.