1. Description
Virtual machine: VMware Workstation 15.5
System: centos 7
Network environment: WIFI (mobile phone hotspot)
2. Virtual network editor
First open the VM and edit it—select the virtual network editor,
grant administrator permissions, and click Change Settings:
Then this page will appear, we select VMnet0 (bridge mode),
at this time we press the shortcut key win+R, enter cmd, and enter the command line Enter ipconfig -all in , find the wireless LAN adapter, and see your own network card: (don’t turn it off, wait for the above information)
and then select this network card:
Then return to the virtual machine page, click on the network adapter, select Custom, select Just configure VMnet0, and start the virtual machine after confirming.
3. Use the command line to modify the network configuration file
Enter the centos terminal, enter the command: cd /etc/sysconfig/network-scripts/
and then use the ls command to list all files, find out your own network card, and use vi to edit:
change BOOTPROTO to static, and then write ip ( Write the same network segment) subnet mask, gateway and DNS, the above data can be viewed in the above windows command line. After saving and exiting, enter systemctl restart network.service
in the terminal to restart the network service. Then we use the ifconfig -a command to see if it takes effect: we find that the ip address is in the same network segment as the physical machine , then we ping Baidu to see if we can connect to the Internet: ping www.baidu.com , we can see that Netcom is connected , we are trying to ping Check the ip of the physical machine: it is also found, indicating that the network configuration is complete this time. Like it if you like it~~