1. Background
In centos5, we got used to eth0 such a network device naming, in centos6 discover network devices into a em1 so named to CentOS 7 version of the card naming has been re-defined, therefore, for this naming convention modify, or so many people a headache, unable to adapt to such a randomly generated name card, the following will teach you how to modify the fixed network card is eth0, the procedure is very simple;
2. Modify method
- Go to the next / etc / sysconfig / network-scripts / directory, file backup card
[root@192168088102-NFS-Server ~]# cd /etc/sysconfig/network-scripts/ [root@192168088102-NFS-Server network-scripts]# ls ifcfg-ens33 ifdown-bnep ifdown-ipv6 ifdown-ppp ifdown-Team ifup ifup-eth ifup-isdn ifup-post ifup-sit ifup-tunnel network-functions ifcfg-lo ifdown-eth ifdown-isdn ifdown-routes ifdown-TeamPort ifup-aliases ifup-ippp ifup-plip ifup-ppp ifup-Team ifup-wireless network-functions-ipv6 ifdown ifdown-ippp ifdown-post ifdown-sit ifdown-tunnel ifup-bnep ifup-ipv6 ifup-plusb ifup-routes ifup-TeamPort init.ipv6-global [root@192168088102-NFS-Server network-scripts]# cp ifcfg-ens33 ifcfg-ens33.bak [root@192168088102-NFS-Server network-scripts]# ll ifcfg-ens33* -rw-r--r--. 1 root root 347 Jul 27 11:41 ifcfg-ens33 -rw-r--r--. 1 root root 347 Jul 27 12:48 ifcfg-ens33.bak
- The card file name to ifcfg-eth0, and modify the network card configuration file
[root@192168088102-NFS-Server network-scripts]# mv ifcfg-ens33 ifcfg-eth0 [root@192168088102-NFS-Server network-scripts]# ll ifcfg-eth0 -rw-r--r--. 1 root root 347 Jul 27 11:41 ifcfg-eth0 [root@192168088102-NFS-Server network-scripts]# cat ifcfg-eth0 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no #将ens33改为eth0 NAME=eth0 UUID=7615d0b6-d6c2-46bf-9140-45083e4aed4b #将ens33改为eth0 DEVICE=eth0 ONBOOT=yes IPADDR=192.168.88.102 NETMASK=255.255.255.0 GATEWAY=192.168.88.2
- Modify grub file, add kernel parameters net.ifnames = 0 biosdevname = 0 information, the name changed to the card eth0
[root@192168088102-NFS-Server network-scripts]# cat /etc/sysconfig/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="crashkernel=auto rhgb net.ifnames=0 biosdevname=0 quiet" GRUB_DISABLE_RECOVERY="true"
- Generation start menu, to start the reload and reboot the system
[root@192168088102-NFS-Server network-scripts]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-957.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-957.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-dc723d2d2d444cf0ae3794ab211366b8 Found initrd image: /boot/initramfs-0-rescue-dc723d2d2d444cf0ae3794ab211366b8.img done [root@192168088102-NFS-Server network-scripts]# reboot
- Verify that the network card is eth0 successfully modified
[root@192168088102-NFS-Server ~]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 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: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:b6:52:ed brd ff:ff:ff:ff:ff:ff inet 192.168.88.102/24 brd 192.168.88.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:feb6:52ed/64 scope link valid_lft forever preferred_lft forever