Red Hat Enterprise 7 is based on fedora 19 and upstream of kernel 3.10

Ever wanted to change back to the default network device name like "ethX"

This is based on VMware installation i have the default nic name as"en01677736"

[root@eSuareznotes01 ~]# ip addr show
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:92:78:40 brd ff:ff:ff:ff:ff:ff
inet XX.X.XX.XX/24 brd 10.0.10.255 scope global dynamic eno16777736
valid_lft 85931sec preferred_lft 85931sec
inet6 fe80::20c:29ff:fe92:7840/64 scope link
valid_lft forever preferred_lft forever

[root@eSuareznotes01 ~]# vi /etc/default/grub

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=”$(sed ‘s, release .*$,,g’ /etc/system-release)”
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT=”console”
GRUB_CMDLINE_LINUX=”rd.lvm.lv=rootvg/usrlv rd.lvm.lv=rootvg/swaplv crashkernel=auto vconsole.keymap=us rd.lvm.lv=rootvg/rootlv vconsole.font=latarcyrheb-sun16 rhgb quiet”
GRUB_DISABLE_RECOVERY=”true”

Look for this line “GRUB_CMDLINE_LINUX” and add the following: “net.ifnames=0 biosdevname=0”

Should look like this:
GRUB_CMDLINE_LINUX=”rd.lvm.lv=rootvg/usrlv rd.lvm.lv=rootvg/swaplv crashkernel=auto vconsole.keymap=us rd.lvm.lv=rootvg/rootlv vconsole.font=latarcyrheb-sun16 rhgb quiet net.ifnames=0 biosdevname=0

[root@eSuareznotes01 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file …
Found linux image: /boot/vmlinuz-3.10.0-121.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-121.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-df30d92ad3eb414583d85bb471003eb4
Found initrd image: /boot/initramfs-0-rescue-df30d92ad3eb414583d85bb471003eb4.img
done

If you didn’t put any names during the installation, you will need to rename the interface files by renaming the file /etc/sysconfig/network-scripts/ifcfg-*.

[root@eSuareznotes01 ~]# mv /etc/sysconfig/network-scripts/ifcfg-eno16777736 /etc/sysconfig/network-scripts/ifcfg-eth0
[root@eSuareznotes01 ~]# shutdown -r now

After system reboot

[root@eSuareznotes01 ~]# ip addr show
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:92:78:40 brd ff:ff:ff:ff:ff:ff
inet 10.0.10.77/24 brd 10.0.10.255 scope global dynamic eth0
valid_lft 86141sec preferred_lft 86141sec
inet6 fe80::20c:29ff:fe92:7840/64 scope link
valid_lft forever preferred_lft forever

Advertisements
Comments
  1. philip says:

    Do you have to do this again after kernel updates are applied?

  2. esuarez11 says:

    in my case i haven’t done it after that kernel update was applied.

  3. Awesome steps Dude … Please share keep on about RHEL 7 … alos visit my site http://www.autellinux.wordpress.com

  4. TL says:

    Worked perfect, thanks!

  5. SomeLinuxGuy says:

    If you’re using a kickstart file, just add those parms to the append line. Kickstart will automatically add those parms to the grub default config for you.

    label centos_7.0_x86_64
    menu label CentOS 7.0 (64 bit)
    kernel images/centos7.0/x86_64/vmlinuz
    append initrd=images/centos7.0/x86_64/initrd.img pci=bfsort ks=http://xxx.xxx.xxx.xxx/centos/ks/centos7.0-64.ks net.ifnames=0 biosdevname=0

  6. SomeLinuxGuy says:

    Oh, and thanks for this post!

    It makes you wonder who was in charge of these crazy changes that will break thousands of applications and scripts expecting to find eth0, eth1, etc. I’m sure they had a good reason at the time, but that doesn’t change the fact that highly unusual changes like this are as forward thinking as using only two digits for the year.

  7. David Henley says:

    Perfect! Thank you!!!!

  8. draeath says:

    Is there any way to just ‘reset’ it’s knowledge of what was previously there? Even after removing the interface hardware it stays around in ‘ip addr’

  9. Mark says:

    cool!thank you very much!

  10. fifo says:

    Thanks, man for this article.

  11. Matt E. says:

    What if you don’t have a /etc/default/grub file?

  12. carlosahm says:

    Thank you verry much!

  13. […] 了一些其他網站的做法,直接在 GRUB […]

  14. Helmuth Kump says:

    You need one more step after renaming your interface file (mv command above). If your ifcfg-eth0 file has the old eno1234567 name as the DEVICE= parameter the interface won’t come back up. Edit the file to show DEVICE=eth0 and you’ll be good to go.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s