Environment
Win7 64bitVM workstation 10CentOS 7NAT mode access network, all virtual machines are configured in the same network segment that is 192.168.0.1~192.168.0.254
2. View and modify the default configuration
Prior to this, we need to modify the default configuration file and Nic name, operation as follows:① ip a #可以看到有两个网卡 , an lo "up" a ifcfg-eno16777736 " Down "② #修改网卡eno-16777736 for eth0cd /etc/sysconfig/network-scripts/mv ifcfg-eno16777736 ifcfg-eth0# Or the above two lines can be replaced with: #mv /etc/sysconfig/network-scripts/ifcfg-eno16777736 /etc/sysconfig/ network-scripts/ifcfg#-eth0③ vi /etc/sysconfig/network-scripts/ifcfg-eth0# Modify or add the following: #BOOTPROTO = Static#name=eth0#onboot=yes#hwaddr=??:??:??:??:??:?? mac address #dns1=114.114.114.114 Access to the network requires #dns2=8.8.8.8 can not fill this #ipaddr= 192.168.0.5 local ip need to be configured in the same segment as the virtual machine in order to access the network #prefix=24 mask prefix bits #gateway =192.168.0.1 Gateway, VM generated virtual network card address, the address and Win7 VM8 configuration IP is the same can ④ vim /etc/sysconfig/grub #然后, Add "net.ifnames=0 biosdevname=0" content to this file, disable auto-prediction name, prevent the network card name from being modified automatically, i.e. #grub_cmdline_linux= "Rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto net.ifn#ames=0 biosdevname=0 rhgb&nbSp;quiet "⑤ grub2-mkconfig -o /boot/grub2/grub.cfg #运行命令grub2-mkconfig -o / boot/grub2/grub.cfg to regenerate the grub configuration and generate a new configuration file ⑥ reboot ip a # You should see the interface
Description
BOOTPROTO=[NONE|STATIC|BOOTP|DHCP] not using protocol at boot | static Assignment | BOOTP Protocol |DHCP Protocol
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/84/4A/wKiom1eLpK-AMNGRAAB5prMYghk332.png-wh_500x0-wm_3 -wmp_4-s_4261936075.png "title=" Centos7_eth0_default_ip.png "alt=" Wkiom1elpk-amngraab5prmyghk332.png-wh_50 "/>
As you can see, the NIC name has been modified in order to eth0, but it has not been started
3. Start eth0 and Activation failed solution
Service Network start
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/84/4A/wKiom1eLrC-DCc0QAACLhxmCmFQ963.png-wh_500x0-wm_3 -wmp_4-s_3391173139.png "title=" Centos7_eth0_up.png "alt=" Wkiom1elrc-dcc0qaaclhxmcmfq963.png-wh_50 "/>
SYSTEMCTL Status Network #查看出错原因 active error
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/84/4A/wKiom1eLrRHj7aKuAAC4oqfg9yc867.png-wh_500x0-wm_3 -wmp_4-s_1181847552.png "title=" Centos7_eth0_status.png "alt=" Wkiom1elrrhj7akuaac4oqfg9yc867.png-wh_50 "/>
By looking up the documentation, we know that the reason for this is because the NetworkManager service caused the boot, we modified the relevant configuration, but failed to detect, so we need to enter the following processing
Chkconfig NetworkManager off# shutdown boot This service chkconfig network On#service NetworkManager stop or Systemctl stop Networkmanager.service#service network start or Systemctl start Network.service
Ok
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/84/4A/wKioL1eLsAmiB4AKAAB2P28zxMQ687.png-wh_500x0-wm_3 -wmp_4-s_4271080406.png "title=" Centos7_eth0_ok.png "alt=" Wkiol1elsamib4akaab2p28zxmq687.png-wh_50 "/>
Description
The Networkmangager service is a graphical way to manage the configuration of the network adapter, and the terminal is implemented by command writing files. So when you use the command terminal to set up the NIC, the management of the Networkmanmager graphical method also calls the
This article is from the "Romantic Dev" blog, so be sure to keep this source http://xinbaby88.blog.51cto.com/9943025/1827256
Under CentOS 7 VM, modify the NIC name eth0 and start the problem resolution