The first step is to modify the network configuration to bridge mode.
The second step is to enter the terminal. Turn on root.
Use dhclient to dynamically assign an IP address.
dhclient
View assigned IP
ifconfig
Remember the IP address of the current CentOS7 system. Next, we change the address of 192.168.1.111 to a static configuration for easy management.
Enter the command to open the network configuration file ifcfg-ens33
vim /etc/sysconfig/network-scripts/ifcfg-ens33
Change the dynamic allocation dhcp to static static. And add the following configuration at the end of the file.
ONBOOT="yes"
IPADDR="192.168.1.111" #IP地址
NETMASK="255.255.255.0" #掩码
GATEWAY="192.168.1.1" #网关,去宿主机查询
DNS1="119.29.29.29" #DNS
Save and exit, and execute the following command to restart the network service.
systemctl restart network.service
Test to ping Baidu, if you can ping the general rules, the configuration is complete.