Linux host and virtualbox Virtual Machine LAN communication
This section describes how to connect a Linux host to a virtual machine (VM) installed in virtualbox on Linux:
1. start the VM, select the "Change Network Connection" menu, select host-only adapter in the connection mode of network connection 1, select vboxnet0 in the interface name, and select "access network cable ", then, in the IP settings of the virtual machine, select automatically obtain the IP address and DNS. Wait a moment and you will find that the virtual machine has obtained the IP address and DNS. I have ipconfig, the IP address of my VM is 192.168.56.101.
2. In the Linux host ifconfig, we found that the IP address of vboxnet0 is 192.168.56.1. Now everything is clear. In fact, a virtual Nic is automatically installed on the host when virtualbox is installed. This Nic is dedicated to communicating with virtual machines. There is a DHCP server in virtualbox, it is used to assign a virtual machine IP address to ensure it is consistent with the host's vboxnet0 (in fact, the vboxnet0 IP address is also allocated)
3.
Host Ping VM: Ping 192.168.56.101
VM Ping HOST: Ping 192.168.56.1
Done!