Centos7 change the default Nic to eth
1. Change the default Nic to eth0.
Vi/etc/sysconfig/network-scripts/ifcfg-eno16777736
# First, edit the NIC configuration file and change the NAME to eth0.
Mv/etc/sysconfig/network-scripts/ifcfg-eno16777736/etc/sysconfig/network-scripts/ifcfg-eth0
# Then, rename the file
2. Edit Grub Configuration
Vim/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 = "crashkernel = autord. lvm. lv = centos/rootrd. lvm. lv = centos/swapnet. ifnames = 0 biosdevname = 0 rhgbquiet"
GRUB_DISABLE_RECOVERY = "true"
# Disable this predictable naming rule. At startup, pass the Kernel Parameter "net. ifnames = 0 biosdevname = 0. Edit/etc/default/grub and add "net. ifnames = 0 biosdevname = 0" to the grubw.linelinux variable.
Grub2-mkconfig-o/boot/grub2/grub. cfg
# Regenerate GRUB configuration and update Kernel Parameters
3. Set device name rules
Vim/etc/udev/rules. d/70-persistent-net.rules
SUBSYSTEM = "net", ACTION = "add", DRIVERS = "? * ", ATTR {address} =" 00: 0c: 29: 84: 3a: 14 ", ATTR {type} =" 1 ", KERNEL = "eth *", NAME = "eth0"
# According to the FAQ in the Centos official WIKI, if you have multiple interfaces and want to control their device names, instead of naming and creating the kernel in its own way, /etc/udev/rules. d/XXX-net.rules rules are necessary
# After restart
[Root @ localhost ~] # Ip
1: lo: <LOOPBACK, UP, LOWER_UP> 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: <BROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
Link/ether 00: 0c: 29: 5b: 71: b3 brd ff: ff
Inet 192.168.1.205/24 brd 192.168.1.255 scope global eth0
Valid_lft forever preferred_lft forever
Inet6 fe80: 20c: 29ff: fe5b: 71b3/64 scope link