I am trying to set up a set of guests in VirtualBox, such that each of them can access the Internet as well as be visible to each other and to the host. I also want the guests to have static IP addresses.
Here's the procedure that I have followed so far:
- Switch off the DHCP Server feature of the Host-Only network to be used in this setup
- Change the IP address assigned to the host to 192.168.56.254
- Create a guest machine with 2 networking interface cards (NIC)
- Configure the 1st NIC to use NAT
- Configure the 2nd NIC to use Hot-Only Networking
- Install the OS (Ubuntu Server 13.10) on each of them
- Update the OS
- Configure the networking as follows by editing /etc/network/interfaces
auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp auto eth1 iface eth1 inet static address 192.168.56.1 netmask 255.255.255.0 network 192.168.56.0 broadcast 192.168.56.255 gateway 192.168.56.254 dns-search cloudspace.local dns-nameservers 8.8.8.8 8.8.4.4
- Save the file
- Reboot
When the guest boots up again, the Host-Only networking is working fine. The host/guest and guest/guest pairs of machines can ping each other, however the Internet isn't working as apt-get
fails.
If I then issue a service networking restart
command, the networking begins to work as it should.
What am I doing wrong?
I have tried switching the order in which the NICs appear in the /etc/network/interfaces
file. I have also swapped the NAT/Host-Only Network around between the 2 NICs. Nothing worked.
The host is Windows 8.1 and the guest is Ubuntu Server 13.10. I have tried the same on Mac OS X with similar results.
I would greatly appreciate any help in this.
Update:
I have included the output from the following commands below, to help in diagnostics:
- cat /etc/network/interfaces
- ifconfig -a
- route -n
$ cat /etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp auto eth1 iface eth1 inet static address 192.168.56.1 netmask 255.255.255.0 network 192.168.56.0 broadcast 192.168.56.255 gateway 192.168.56.254 $ ifconfig -a eth0 Link encap:Ethernet HWaddr 08:00:27:75:47:64 inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe75:4764/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2 errors:0 dropped:0 overruns:0 frame:0 TX packets:10 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1180 (1.1 KB) TX bytes:1332 (1.3 KB) eth1 Link encap:Ethernet HWaddr 08:00:27:93:98:d8 inet addr:192.168.56.1 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe93:98d8/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:140 errors:0 dropped:0 overruns:0 frame:0 TX packets:225 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:14418 (14.4 KB) TX bytes:27378 (27.3 KB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:16 errors:0 dropped:0 overruns:0 frame:0 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1184 (1.1 KB) TX bytes:1184 (1.1 KB) $ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.56.254 0.0.0.0 UG 0 0 0 eth1 10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.56.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
Update 2:
After I execute sudo service networking restart
, the output from route -n
becomes:
$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 10.0.2.2 0.0.0.0 UG 0 0 0 eth0 10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.56.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
So how do I ensure this configuration on boot?