• Advertisement
Preserving the Apple IIGS

CentOS 6.x - UDev - Changing network cards (NICs)

Any software title released with a GNU/Linux distribution. Articles are posted in "Linux Distribution - Software Title - Subject" format.

CentOS 6.x - UDev - Changing network cards (NICs)

Postby lmmtux » Sun Aug 26, 2012 10:31 pm

In CentOS 6.x, changing network cards in the system is different than in previous versions. Since CentOS 6.x uses UDev to manage the hardware, NICs are detected and are remembered even if the NICs are removed. UDev starts when the system boots and tries to detect new and changed hardware. For network cards, all of the information of what cards UDev finds is stored in the file:

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

The contents of this file will include a line for each detected network card in the system. Below is an example of a system that has one Intel e100 NIC installed:

Code: Select all
# PCI device 0x8086:0x2449 (e100) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:03:47:69:ed:32", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


If you have additional NICs in the system, each one will have an entry in this file.
You can change the file and force your choice of NIC to be assigned its respective ethernet device (eth0, eth1, etc.). Changing the file and rebooting the system will assign the ethernet devices as specified in this file. This is most useful when adding or replacing a NIC in the system.

The network configuration for each of these devices found in the "70-persistent-net.rules" file are stored in the folder:

/etc/sysconfig/networking/devices

Each ethernet device will have its own configuration file. For example, if the system only has one NIC and it is eth0, there will be a file stored in this directory called: "ifcfg-eth0". This file will usually look similar to this:

Code: Select all
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:03:47:69:ed:32
NM_CONTROLLED=yes
ONBOOT=yes
IPADDR=192.168.2.81
NETMASK=255.255.255.0
TYPE=Ethernet
GATEWAY=192.168.2.1
DNS1=192.168.2.1
IPV6INIT=no
USERCTL=no


The MAC address (or HWADDR) is the important field of information because that is what ties this configuration file to the NICs shown in "70-persistent-net.rules". You can also edit this file to change the IP address and information shown. To activate changes in this file, simply restart the NetworkManager or network services:

NetworkManager:

Code: Select all
service NetworkManager restart


network:

Code: Select all
service network restart


Note: It is recommended in server systems to disable the NetworkManager service and use the "network" service to manage all of the network interfaces.
lmmtux
 
Posts: 55
Joined: Mon Jul 30, 2012 9:40 pm
Reputation: 0

Return to Linux

cron