10

I've got two vms running on a windows host, each with a host-only network and ips in the 192.168.56.XXX range. One of them is running apache and serving some content that I want to access from my windows host.

However, the windows host can't access the apache server at all. The server is running on 192.168.56.103. ipconfig from windows says it's ip for the Virtual Box interface is 169.254.143.37. I tried route add to route 192.168.56.XX traffic, but everything I tried didn't work and I was probably using it wrong.

Any ideas on how to make this work?

1
  • Have you set the correct default gateway in your VM? What's the routing table look like on host and guest?
    – Tom Newton
    Apr 12, 2010 at 8:36

12 Answers 12

8

If you want to communicate with your VMs with 192.168.56.XXX IP, you need the host Virtual Box interface to have an IP on the same range. Your interface don't (169.254).

On a fresh installation of VBox 3.1.8, it creates a new interface named "VirtualBox Host-Only Network" with a static IP address of : 192.168.56.1/24.

Your interface is most probably misconfigured to use DHCP. Change it to use 192.168.56.1 with 255.255.255.0 netmask and it should work.

3
  • That does indeed work. But why? The DHCP server is provided by VirtualBox, surely it's a bug for it to be handing out addresses on the wrong subnet? Jul 9, 2021 at 20:01
  • This is not the DHCP server delivering addresses in the wrong subnet. 169.254.x.x are fallback addresses provided by the DHCP client when no response is received. There is no reason for VirtualBox to provide a DHCP service to the host machine. Aug 10, 2021 at 8:54
  • How we can change that 192.168.56.103 to 192.168.0.103(which my wifi local IP address is in this class)? Cause other devices in my local network don't find Genymotion with that .56.103 IP address
    – Dr.jacky
    Jul 15, 2022 at 7:38
2

I was able to fix this by giving my server a static address of 192.168.56.11. Then, I was able to ping my guest OS from the host. I also added a host file entry on my host machine to make it easier to access.

I'm still unable to ping the host from the guest... not sure why.

1

Your VMs are getting IPs like 169.* because their DHCP clients are not finding a DHCP server to give them a lease. Therefore, the IP of the host & IPs of the VMs are not accessible to each other. A static route won't really solve this. You need to figure out why the VMs are not getting an IP lease, or you could try manually setting the IP addresses to the same private Class C (192.168.56.*) that your host is on.

1

try this:

http://brianreiter.org/2010/09/18/fix-virtualbox-host-only-network-adapter-creates-a-virtual-public-network-connection-that-causes-windows-to-disable-services/

BTW, could not use powershell script. I needed to create *NdisDeviceType key via Regedit

1
  • 1
    Welcome to Server Fault! Generally we like answers on the site to be able to stand on their own - Links are great, but if that link ever breaks the answer should have enough information to still be helpful. Please consider editing your answer to include more detail. See the FAQ for more info.
    – slm
    Apr 4, 2013 at 18:00
0

Once you find, install and start the Host-only adapter on your Windows host, if you still can't connect to the VMs, try turning off the Windows firewall for that adapter.

If that works, you can either leave it that way, or use your Windows Firewall-fu to open the correct ports and stuff.

0

169.254 = No DHCP server found. THis could be either there isnt one or there is a firewalling issue. Depending on your operating system it would also be advisable to check your firewall rules. Windows 7 is quite paranoid!

0

If you can't ping host from VM, have you try to turn off firewall on host? perhaps it's filtering ICMP request. Turn off the firewall as test, if ping is OK then you should check your firewall configuration that filter ICMP request.

0

I ran into this issue and it turned out that VBox simply wasn't able to obtain an IP for my Mac guest as it is not a member of our domain. I simply made sure that the host adapter and guest VM were set to the same subnet and then manually set the IP of the guest VM to match the network part of the adapter:

Windows (Host) Host-Only Network Adapter: - Subnet: 255.255.255.0 - IPv4 Address: 192.168.56.1

Mac (Guest) VM Network Configuration: - Subnet: 255.255.255.0 - IPv4 Address: 192.168.56.2

Voila! My "Self-assigned IP" warning went away and I could ping Host <=> Guest...

Hope this helps someone!

0

If you are using Windows, go to Firewall Settings and allow all Virtual Box executables to pass thru. This one does the trick.

[root@classroom ansible]# ping 192.168.56.1 PING 192.168.56.1 (192.168.56.1) 56(84) bytes of data. 64 bytes from 192.168.56.1: icmp_seq=1 ttl=128 time=0.238 ms 64 bytes from 192.168.56.1: icmp_seq=2 ttl=128 time=0.473 ms 64 bytes from 192.168.56.1: icmp_seq=3 ttl=128 time=0.357 ms

0

I had the same problem and I used a combination of the answer provided by Christophe Drevet-Droguet and the text quoted below (which i found at the following link: https://www.vmware.com/support/ws4/doc/network_configure_ws.html)

Although VMnet0, VMnet1 and VMnet8 are available in the network adapter list, they are normally used for bridged, host-only and NAT configurations, respectively.

I was using NAT in my guest VM's network settings and so i fixed the IP and subnet in the VMware Network Adapter VMnet8 properties on Windows 10. And then it worked.

0

Go to File Menu in your virtual box and choose 'Host Network Manager', then check the radio button 'Configure Adapter Automatically'. Then try to ping from your windows host. This worked for me.

0

You can use NAT and setting port forwarding.

In port forwarding, add new rule:

HTTP, TCP, 127.0.0.1, 8888, 192.168.56.103, 80

Run your virtualbox, then use your browser http://127.0.0.1:8888

You must log in to answer this question.