To install Ubuntu server 10.04 with virtual box in Ubuntu, you need to connect to the Internet to install software, but you also need to access it on the local machine. If you want to assign an intranet IP address, you need to configure a bridge, I used it once before, which is too troublesome.
Therefore, we consider using other solutions, such as two NICs for the virtual machine, one Nat mode and one host-only mode.
Since Linux can only have one default gateway, the NAT mode is the DHCP dynamically assigned IP address managed by virtualbox, and the host-only mode can set its own IP address. The solution is obvious:
First, modify the Ubuntu network configuration file.
Sudo VI/etc/Network/interfaces
Modify the file content as follows:
# The loopback network interface
Auto Lo
Iface lo Inet loopback
# The primary network interface
Auto eth0
Iface eth0 Inet DHCP
# The second eth1
Auto eth1
Iface eth1 Inet static
Address 192.168.56.68
Netmask 255.255.255.0
Eth0 is a NAT Nic, and eth1 is a host-only NIC.
In this way, you can restart the virtual machine.
The network segment 192.168.56. * is used for communication between the host and the virtual machine.
Virtual machines and Internet communication can directly access the address, as long as the host can access, virtual machines can access
Over!