How does a local host access a VM and a VM?
1. Install ubuntu16.04 on virtualBox and confirm the network conditions.
Ping www.baidu.com-c 5
2. make sure that the VM and the host are in the same CIDR block. If the IP address of the VM starts with 192.168, it indicates the same CIDR block. If the IP address of the VM is 10. it cannot start with the same CIDR block. You need to configure the VM network.
Ifconfig
3. If the VM instance and the host machine are not in the same network segment, go to the VM instance, click Settings, and then click Network to change the connection mode to bridge mode.
4. After the configuration, ping the IP address of the VM server on the host machine. If you can ping the IP address of the VM server, you can access it.
5. If the host cannot be pinged but the IP address is in the same CIDR Block, check the DNS.
6. Configure DNS in sudo vim/etc/network/interfaces
7. Restart the service after configuration.