Centos 7: Change the NIC name to the previous eth0

Source: Internet
Author: User

 

Centos7 has been installed recently, and the kernel has finally been upgraded to 3.10. It supports Linux containers and network namespace ·······

However, after the installation, ifconfig does not see the familiar eth0, but it is enp0s3. Although it is only a NIC code, it will obviously affect some scripts and cause a lot of inconvenience, I don't know why centos is set to this. So I want to change him back.

[[email protected] fbw]# ifconfig enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet 10.0.2.5  netmask 255.255.255.0  broadcast 10.0.2.255        inet6 fe80::a00:27ff:fe80:4d3c  prefixlen 64  scopeid 0x20<link>        ether 08:00:27:80:4d:3c  txqueuelen 1000  (Ethernet)        RX packets 2134  bytes 176901 (172.7 KiB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 1504  bytes 206316 (201.4 KiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536        inet 127.0.0.1  netmask 255.0.0.0        inet6 ::1  prefixlen 128  scopeid 0x10

 

So refer to a previous log centos configuration eth0 prompts device does not seem to be present, first rename the ifcfg-enp0s3 to ifcfg-eth0, then go to view/etc/udev/rules. the D/70-persistent-net.rules file does not exist in centos7. It seems that the previous method of deleting the restart failed.

Baidu first, found a article "Two Methods for changing Nic em back to eth after centos Linux system installation", read the second method, and changed the grub boot file, after restarting, I found that my name was not changed.

Then, Google found an article titled change default network name to old "eth0" on RHEL 7/Fedora 19 above, which also changed the grub file, solved after restart !!!

 

The procedure is as follows:

1. Vim/etc/default/GRUB

GRUB_TIMEOUT=5GRUB_DISTRIBUTOR=”$(sed ‘s, release .*$,,g’ /etc/system-release)”GRUB_DEFAULT=savedGRUB_DISABLE_SUBMENU=trueGRUB_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”

 

At the end of grub_cmdline_linux, addNet. ifnames = 0 biosdevname = 0Parameters

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”

 

2. mV/etc/sysconfig/network-scripts/ifcfg-enp0s3/etc/sysconfig/network-scripts/ifcfg-eth0

3. Reboot

 

The network adapter is renamed eth0 ~~, Or that taste, so kind ~~~

[[email protected] ~]$ ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet 10.0.2.5  netmask 255.255.255.0  broadcast 10.0.2.255        inet6 fe80::a00:27ff:fe80:4d3c  prefixlen 64  scopeid 0x20<link>        ether 08:00:27:80:4d:3c  txqueuelen 1000  (Ethernet)        RX packets 56  bytes 7959 (7.7 KiB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 70  bytes 10796 (10.5 KiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536        inet 127.0.0.1  netmask 255.0.0.0        inet6 ::1  prefixlen 128  scopeid 0x10
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.