One: Installation of the CentOS system to VirtualBox, note: The installation process set up the network connection information, the IPv4 is set to manual, the address is 192.168.56.101, the gateway is 192.168.56.0 (thought to be host-only mode)
Second: Start CentOS
A. View/etc/sysconfig/network-scripts/ifcfg-enp0s*
B. Check if you are connected to the Internet: Ping www.baidu.com
C. Install common commands: yum-y install net-tools,yum-y install vim,yum-y install Lrzsz
Three: Shutdown, configure the second network card, the default first card is a NAT mode (such as), the network card allows the virtual machine to access the external network
Click ' Nic 2 ', for example, select Host-only mode
The interface name is VirtualBox a connection created in "Network connection"
You can see it in the VirtualBox global settings
Four: Start the virtual machine to view IP information
Where Enp0s8 is the host-only nic that you just added
At this point, the local machine cannot access the virtual machine and change the VIM/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ENP0S3 The IP address inside: 192.168.56.101 (set in the first step) is 10.0.2.15, that is, the IP address in the ENP0S3 network card information, the gateway is also changed, PS: where Onboot=no is not changed to Yes (indicates whether the network card is activated when the system starts), I found the network was connected after rebooting the system.
Save quit Restart Network: Service network restart
Yes, the system can access the network can be accessed locally, local can also access the system, over
Virturalbox installation of the CentOS system, set up a dual network card to enable virtual machine Internet access and main house visits