Centos 7.0 Nic configuration and rename tutorial
After centos 7.0 is installed, the NIC is disabled by default, and the NIC name is changed. In centos 5 and earlier, the network card was named eth0 eth1. In the centos 6 era, the network card name changed to em1 em2, the bigger change appeared in the centos 7 era, and the NIC name changed directly to ens192 eno12312. The following describes how to configure the centos 7.0 Nic.
After the system is installed, enter the NIC configuration folder.
Here we can see that my Nic name is currently ifcfg-ens192
The last few lines of the vi ifcfg-ens192 are the configuration files you need to add yourself
- HWADDR = 00: 50: 56: bf: 00: 25
- TYPE = Ethernet
- BOOTPROTO = static # enable static IP addresses
- DEFROUTE = yes
- PEERDNS = yes
- PEERROUTES = yes
- 20174_failure_fatal = no
- IPV6INIT = yes
- IPV6_AUTOCONF = yes
- Required 6_defroute = yes
- IPV6_PEERDNS = yes
- 20176_peerroutes = yes
- 20176_failure_fatal = no
- NAME = ens192
- UUID = ae0965e7-22b9-45aa-8ec9-3f0a20a85d11
- ONBOOT = yes # enable automatic network connection to enable startup. Remember to modify
- IPADDR0 = 10.0.0.101 # Set the IP address
- PREFIXO0 = 24 # Set the subnet mask
- GATEWAY0 = 10.0.0.1 # Set the Gateway
- DNS1 = 202.102.152.3 # Set primary DNS
- DNS2 = 202.102.128.68 # Set the backup DNS. Here I write the dns server in Jinan. You can enter it as needed.
Save and exit.
Restart the NIC. Here you can use service network restart or the new centos7 command systemctl restart network. service.
Finally, check the NIC information and run the command systemctl status network. status.
Of course, the NIC name can be modified as needed, and can be changed to eth0 em1.
Edit the/etc/sysconfig/grub file and add "net. ifnames = 0 biosdevname = 0"
Run: grub2-mkconfig-o/boot/grub2/grub. cfg
Rename the file
Mv/etc/sysconfig/network-scripts/ifcfg-ens192/etc/sysconfig/network-scripts/ifcfg-eth0
Change the NAME = ens192 in the configuration file to the same NAME as above = eth0.
After the configuration is complete, restart the system and view the NIC configuration information ifocnfig