Environment:
HOST: openSUSE 12.2
Virtual Machine: VirtualBox 4.1.22
Virtual System: ubuntu 12.04
Www.2cto.com
Step 1: Set VirtualBox
1) Management (F) --> global settings (P) or ctrl + g
2) Select "network"
3) Add "Host-Only"
4) Cancel DHCP
5) Select "Host-Only" for the NIC"
Step 2: ubuntu network settings
# This file describes the network interfaces available on your system
# And how to activate them. For more information, see interfaces (5 ).
# The loopback network interface
Auto lo
Iface lo inet loopback
# The primary network interface
Auto eth0
Iface eth0 inet static
Address 192.168.56.99
Netmask 255.255.255.0
Gateway 192.168.56.1
Www.2cto.com
In this way, the host can be connected to the virtual system without a network cable.
The host uses ifconfig eth0 192.168.56.90 to set the IP address so that the IP address is in the same CIDR block as the virtual system.
In this way, the virtual system can also access the host.