This method uses bridging so that dynamic IP can be fixed to a static IP to connect to the intranet or to the extranet
1:
View own host IP cmd under input ipconfig
2:
Execute sequentially
where the 5th step of the drive gets the MAC address of the virtual machine
3: Start the virtual machine and use the root permission setting
Vim/etc/sysconfig/network-scripts/ifcfg-eth0
Device= "Eth0"
bootproto= "Static" #设置静态IP
ipaddr=192.168.1.111 #此处字段必须与主机ip一致, last Custom
netmask=255.255.255.0 #子网掩码与主机一致
gateway=192.168.1.1 #网关与主机一致
dns1=192.168.1.1
Hwaddr= "00:0c:29:07:04:13" #此处为虚拟机的MAC地址
Ipv6init= "No"
Nm_controlled= "Yes"
Onboot=yes #开机启动
Type= "Ethernet"
4: Perform service network restart restart
5: Try to connect the external ping www.baidu.com
Try to connect to the intranet ping 192.168.2.1
It all comes back and succeeds.
VMware CentOS Network Configuration