1. DHCP assigns IP
# cd /etc/sysconfig/network-scripts
# vi / ifcfg-en *
I am here ifcfg-ens33
Change onboot=no to yes
restart network service
# service network restart
Found that you can visit Baidu
Note that the command to view the network IP in the centos7 system is ip addr
Note that the virtual machine must select the network as bridge mode
2. Fixed IP
Edit ifcfg-ens33
Modify the IP address mode to fixed IP, IP address, subnet mask, gateway, DNS address
As shown below
restart network service
Found that you can visit Baidu