In general, the NAT method can be connected to the Internet, but the VM cannot be accessed from the Internet. If you want to allow Internet access, you must use the bridge method,
The procedure is as follows:
1. InstallBridge-utils
2. ModifyAdd the following content to the/etc/Network/interfaces file:
Auto br0
Iface br0 Inet static
Address 192.168.1.122
Netmask 255.255.255.0
Gateway 192.168.1.1
Bridge_ports eth0
Bridge_fd 2.5
To dynamically obtain the website:
Auto br0
Iface br0 Inet DHCP
Bridge_ports eth0
Bridge_fd 2.5
3. Restart the network
/Etc/init. d/networking restart
Use brctl showCheck whether br0 is started.
Ifconfig shows that the IP address is configured on br0.
4. Run the following command to obtain the permission for this device.
Chown <username>/dev/NET/TUN
5. Configure the VM and use br0.
Vboxaddif vbox0 <username> br0
6. Select the network as hostinterface before starting the VM.
Enter the name vbox0.
7. After the VM is started, set the IP address in the VM system.
OK
References:
Http://wiki.debian.org/VirtualBox