I’m using Virtualbox 4.3.30 and I’ve successfully set a virtual machine up with a host-only network to work on DHCP with a non-static IP, but of course, for a virtual machine server, it’s essentially useless. So now, I’m trying to set up a virtual machine Linux server with access to the internet, and a host-only static IP. Host is Windows 8.1, guest is Ubuntu server.
VM config
I have two network devices, one for NAT, and one host-only set to adapter #3. The NAT allows for access to the internet which works. The host-only adapter doesn’t allow the host to access the virtual machine.
VirtualBox config
Host-only adapter #3 has DHCP disabled, an IP of 192.168.50.101
, and a netmask of 255.255.255.0
.
The VM system
After running:
sudo ifconfig eth1 192.168.50.101 netmask 255.255.255.0 up
…(from here then ifconfig
reveals that eth1 (host-only) is connected to the IP address. On the virtual machine, if I do wget 192.168.50.101
it pulls down the default Nginx page on itself. From the host I’m able to ping the static IP address however in the browser, the IP address times out with the message Unable to connect
.
Stuff I've tried!
I have also tried editing /etc/network/interfaces
from here to no success.
What’s happening here? I’m guessing it can’t be a firewall issue as the host connects when the host-only is using DHCP and I can successfully ping from the host. It also looks like the browser's "cannot connect message" appears in the browser faster than a simple timeout.
Update:
I think I've hit on a bug - if I activate the DHCP in the network only adapter, and set the lower and upper to the same ip address, it seems the browser can all of a sudden allow the network to occur and succeeds.
/etc/network/interface
as that will only make it permanent, the eth1 up code is in the question though, and the relevant line from ifconfig isinet addr: 192.168.50.101 Bcast 192.168.55.255 Mask 255.255.255.0