How to convert em0 to eth0 in centos 6 and rhel 6
Users who upgraded their platform from centos version 5 to centos version 6, or users with fedora 15 or other latest versions installed might have noticed that their NIC card interface naming is completely different from the previous ones.
The new naming convention that redhat/centos will follow from now onwards is not just simply a name change, but was done to solve an important problem in NIC naming convention. Imagine a situation where in you have 4 NIC cards on a server, and you want to quickly identify which one of them is On board NIC card, and Which one is an external PCI card. There are also cases where the names assigned to NIC cards are not consistent across reboots.
Or imagine a case where you have just added an additional NIC card, and cant identify, which one is the newly added one. Previosly NIC cards were named in the following fashion.
eth[0,1,2,3,4,5,6....]
What's the New NIC card naming convention in Centos and Redhat called?
In order to solve the problem of identifying NIC cards based on their location, Matt Domsch, from Dell Inc. came up with a solution called " Consistent Network Device Naming".
How does "Consistent Network Device Naming" work?
The feature of naming network interface cards based on their physical location works with the help of a program called "biosdevname". Biosdevname infact does the job of helping udev, which renames the interfaces according to the information supplied by the system BIOS.
The new naming convention is as follows.
- em[0,1,2,3,4....] is used for On board NIC cards.
- pci<slot><port 1...N> for PCI cards
- The main purpose behind " Consistent Network Device Naming" is for consistency in naming.
What is the Problem with " Consistent Network Device Naming" and "biosdevname"?
I must not say there some problem with both of them working together, infact they are brilliant way of identifying NIC cards based on their location.
But people who have lot of system scripts that are critical to their infrastructure, and have the previously used NIC naming convention(eth) hardcorded in their scripts do have a problem.
How to change em0 to eth0?
If you have already installed the machine, and have the new naming convention based on " Consistent Network Device Naming", and you want to revert back to eth naming convention then you can do that by following the below steps.
Step 1: The first step is to verify whether the package "biosdevname" is installed on the machine, by the following command.
rpm -qa | grep biosdevname
If you have the package then uninstall it by the following command.
rpm -e --nodeps <copy paste the exact package name we got from the previous command here>
Step 2:
Now go to the network scripts folder where all network files are placed. and rename all em files to eth files as the following.
get inside the ifcfg-eth0 and change DEVICE="em0" to DEVICE="eth0".
Do this for all the devices you have.
Step 3:
70-persistent-net.rules file in UDEV rules directory needs to be modified.
You can see from the above picture that both the subsytem argument is changing the name of the NIC card with some specific MAC address from "eth*" to em[1,2,3..]
We need to change the last NAME argument in both the lines to NAME="eth0" or "eth1" or "eth2" or whatever you need for a specific MAC address.
for example the edited line will be something like the below.
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="<Your MAC Address Here>", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
The only thing that got changed is highleted in bold in the above line. In the above manner you can assign the desired mac address the desired Name.
If you dont like to edit it, then you can either remove the file (after uninstalling the "biosdevname" package).
Step 4: Now you can reboot the machine...and have the old naming convention back.
How to disable "Consistent Network Device Naming" during install time?
You can also disable this functionality during the install time.
During the install boot screen enter the below command.
linux biosdevname=0
Comments
NOT OK
does not work for CentOS7 or RedHat7 the file 70-persistent-net.rules no longer exists there!
It worked for me
Thanks for the great post. It helps me out.
using biosdevname , interface name is changed to - 'rename12
Hi
did someone had this problem ? I will welcome any answers that will solve this issue
One of the silicon interfaces in my hp-g8 is modified in 70-persistent-net. rules to: 'rename12", it should be: 'p3p3. It was randomly happening after restart of the server
see below the last interface :
[root@localhost home]# ifconfig -a
em1 Link encap:Ethernet HWaddr 2C:76:8A:53:68:C0
inet addr:192.168.20.55 Bcast:192.168.20.255 Mask:255.255.255.0
inet6 addr: fe80::2e76:8aff:fe53:68c0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:79167 errors:0 dropped:0 overruns:0 frame:0
TX packets:12430 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:83841760 (79.9 MiB) TX bytes:1005885 (982.3 KiB)
Interrupt:32
em2 Link encap:Ethernet HWaddr 2C:76:8A:53:68:C1
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:36
em3 Link encap:Ethernet HWaddr 2C:76:8A:53:68:C2
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:32
em4 Link encap:Ethernet HWaddr 2C:76:8A:53:68:C3
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:36
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:5302 errors:0 dropped:0 overruns:0 frame:0
TX packets:5302 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:507869 (495.9 KiB) TX bytes:507869 (495.9 KiB)
p1p1 Link encap:Ethernet HWaddr 00:E0:ED:30:00:B2
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Memory:f7780000-f7800000
p1p2 Link encap:Ethernet HWaddr 00:E0:ED:30:00:B3
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Memory:f7680000-f7700000
p1p3 Link encap:Ethernet HWaddr 00:E0:ED:30:00:B4
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Memory:f7580000-f7600000
p1p4 Link encap:Ethernet HWaddr 00:E0:ED:30:00:B5
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Memory:f7480000-f7500000
p2p1 Link encap:Ethernet HWaddr 00:E0:ED:30:00:BA
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Memory:f7b80000-f7c00000
p2p2 Link encap:Ethernet HWaddr 00:E0:ED:30:00:BB
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Memory:f7a80000-f7b00000
p2p3 Link encap:Ethernet HWaddr 00:E0:ED:30:00:BC
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Memory:f7980000-f7a00000
p2p4 Link encap:Ethernet HWaddr 00:E0:ED:30:00:BD
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Memory:f7880000-f7900000
p3p1 Link encap:Ethernet HWaddr 00:E0:ED:30:00:BE
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Memory:f7f80000-f8000000
p3p2 Link encap:Ethernet HWaddr 00:E0:ED:30:00:BF
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Memory:f7e80000-f7f00000
p3p4 Link encap:Ethernet HWaddr 00:E0:ED:30:00:C1
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Memory:f7c80000-f7d00000
rename12 Link encap:Ethernet HWaddr 00:E0:ED:30:00:C0
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Memory:f7d80000-f7e00000
ifcfg-em1 is missing from network-scripts folder
Hi,
I have network named as em1 and working fine but strangely there is no /etc/sysconfig/network-scripts/ifcfg-em1 file :(
System was configured via gui and I only have ssh connectivity. Now I wan't to run it in cli mode as its production system and cant affor gui mode but don't know how to modify ip settings if there is no ifcfg-em1 file
[root@localhost ~]# cat /etc/redhat-release
CentOS release 6.6 (Final)
[root@localhost ~]# ifconfig
em1 Link encap:Ethernet HWaddr 34:17:EB:B9:DD:17
inet addr:23.1.1.189 Bcast:23.1.1.255 Mask:255.255.255.0
inet6 addr: fe80::3617:ebff:feb9:dd17/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4632770 errors:0 dropped:0 overruns:0 frame:0
TX packets:7031359 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:327414025 (312.2 MiB) TX bytes:8098663014 (7.5 GiB)
Interrupt:20 Memory:f7e00000-f7e20000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:14525 errors:0 dropped:0 overruns:0 frame:0
TX packets:14525 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1437559 (1.3 MiB) TX bytes:1437559 (1.3 MiB)
[root@localhost ~]# ls /etc/sysconfig/network-scripts/
ifcfg-lo ifdown-eth ifdown-isdn ifdown-routes ifup ifup-eth ifup-isdn ifup-post ifup-sit init.ipv6-global network-functions-ipv6
ifdown ifdown-ippp ifdown-post ifdown-sit ifup-aliases ifup-ippp ifup-plip ifup-ppp ifup-tunnel net.hotplug
ifdown-bnep ifdown-ipv6 ifdown-ppp ifdown-tunnel ifup-bnep ifup-ipv6 ifup-plusb ifup-routes ifup-wireless network-functions
Any idea?
Thanks
Reply to Nasir Javaid
Just create that file in that location
vi /etc/sysconfig/network-scripts/ifcfg-em1
and paste below text
DEVICE="em1"
ONBOOT="yes"
TYPE="Ethernet"
BOOTPROTO="static"
HWADDR="34:17:EB:B9:DD:17"
IPADDR="23.1.1.189"
It's very informative website
Very interesting site i have bookmarked slashroot.in for future reference.
Add new comment