The article directories

  • preface
  • Configure the connection to the Internet
  • Configure the host to connect to the Linux VM
  • conclusion

preface

After Linux is installed on a VM, you must be able to access Linux from the host and access the Internet. The following describes how to configure Linux.


Configure the connection to the Internet

Go to /etc/sysconfig/network-scripts. 2. Open the ifcfg-ensxxx file and modify it as follows:

cd /etc/sysconfig/network-scripts
vi ifcfg-ens33
Copy the code

You can view the gateway and subnet mask using the following method. The last number of the local IP address can be configured by yourself. The preceding number must be the same as the gateway address.

Click the Virtual Network Editor in the VM Edit menu to view the subnet mask



Click NAT Settings to view the gateway



After the configuration, restart the network.

service network restart

Use pingwww.baidu.com Tests whether the network is connected

Configure the host to connect to the Linux VM

Open Windows network configuration, find WMnet8, and start it if it is disabled



Check that the IP address of WMnet8 is in the same network segment as that of the VM



Disable the firewall on the VM

Related commands: Disable the firewall: systemctl stop firewalld Disable the automatic startup: systemctl disable firewalld Enable the firewall: systemctl start firewalld Enable the automatic startup: Systemctl enable firewalld Check the status: systemctl status firewalldCopy the code

To start a host CMD test, run the ping VM IP address command


conclusion

The above is what we want to talk about today. Through the configuration of this chapter, we can access Linux from the host machine, and also let Linux access the Internet, so that we can play happily with Linux. Later we will cover installing Java development software on Linux.