Centos7 is installed along the way according to the developer type during initial installation. it is already set to bridge mode in vmware. it is said that the network is automatically connected according to DHCP, but it is found that the network card is not activated, record it here. Configure the Nic vim/etc/sysconfig/network-scripts/ifcfg-ens33
Centos7 is installed along the way according to the developer type during initial installation. it is already set to bridge mode in vmware. it is said that the network is automatically connected according to DHCP, but it is found that the network card is not activated, record it here.
Configure the NIC
vim /etc/sysconfig/network-scripts/ifcfg-ens33
|
The original configuration is as follows:
HWADDR=00:0C:29:2C:E5:30TYPE=EthernetBOOTPROTO=staticDEFROUTE=yesPEERDNS=yesPEERROUTES=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_PEERDNS=yesIPV6_PEERROUTES=yesIPV6_FAILURE_FATAL=noNAME=ens33UUID=ea35e10e-ff50-4a7a-92d5-ab54c58d8b44ONBOOT=no
|
I did not expect that the NIC will not be started by default in centos7. this is a strange setting, so the NIC is not activated and changed to yes, and then the following parameters are added.
IPADDR=192.168.2.181GATEWAY=192.168.2.1DNS1=114.114.114.114DNS2=8.8.8.8
|
Here, IPADDR is the Nic address, GATEWAY is the GATEWAY address, and I use the bridge in vmware, so it is the actual router address. DNS1 and DNS2 must be entered at least. Edit/etc/resolv. conf and add
nameserver 114.114.114.114nameserver 8.8.8.8
|
After configuring the dns in/etc/resolv. conf as shown above
sudo service network restart
|
In this way, the configuration is ready for Internet access.
Ps: You can also use the system-config-network-tui software to configure it in GUI mode and install it using yum.