VirtualBox Virtual Machine (CentOS)
1. Virtual Network Card in VirtualBox. After VirtualBox is installed, a virtual network card is installed in the system. We can see it in Management> global settings.
Www.2cto.com
2. Select a network and you can see a network card. This network card is a bridge for mutual access between the Host and the Host in the Host-Only connection mode.
Www.2cto.com 3. Host access to virtual machines is achieved through Host Only. Host access to virtual machines is the simplest. By selecting Host-only Adapter in network connection 1, our virtual machine can obtain an intranet address, which can be directly accessed by the Host. You can use DHCP or specify an IP address. In most cases, a fixed IP address is specified. 4. to access the Internet through a virtual machine, we can add another network card for the Virtual Machine to access the Internet through the Bridge or NAT mode. The NAT method is successfully tested. 5. unable to access the Internet after CentOS is started, ifconfig finds that the second Nic is not started by default. You can use the ifconfig command to enable the second Nic of CentOS. The method is as follows:
Linux code $ sudo ifconfig eth1 up $ sudo dhclient eth1 6. Check ifconfig again and find that the second ENI has been started and obtained an IP address. Ping www.baidu.com. But it is not time to celebrate the victory, because after we restart the virtual machine, CentOS will not drive the second Nic itself, but must also manually run ifconfig to drive. This step has not been learned yet.