Virtualbox is a very good software and always uses default network settings (NAT), which is really convenient. But this time the host and the virtual machine need to communicate, so I found the network settings such as host-only, which can set an independent IP address to communicate with the host, other virtual machines and networks. The configuration process is as follows: (host and virtual machines are all UBUNTU)
1. virtualbox global settings, CTRL + G
Add an adapter in the network, vboxnet0, set IPv4: 192.168.56.1, and cancel DHCP server (we need to set static IP ).
2. virtualbox local settings, CTRL + S
In network, select host-only adapter for attached to and vboxnet0.
3. Configure the Virtual Machine network,/etc/Network/interfaces
Auto eth0iface eth0 Inet staticaddress192.168.56.99Netmask255.255.255.0Gateway192.168.56.1Nameserver8.8.8.8
Here, the last eight digits of the address can be retrieved (2-254), and The nameserver can retrieve the host's DNS. Modify the DNS address in/etc/resolv. conf if necessary.
At this point, you will find that the host and virtual machine can ping each other, but the virtual machine cannot ping the Internet, the Internet is a big problem, and then the next step:
4. Set the host to allow shared networks
Install a firestarter firewall software in Ubuntu, and check enable Network Connection Sharing in settings. OK! You can use putty 'remote' to log on, just like a real server ......