1

I am working on an IoT project where I have set up a Raspberry Pi as a guest OS in VirtualBox on my Windows host machine. Both the host and the guest OS have been assigned static IP addresses: 192.168.56.1 for the host and 192.168.56.2 for the guest.

I am facing issues with network connectivity between the host and the guest OS. When I attempt to ping the guest OS (192.168.56.2) from the host, I receive the following message:

Pinging 192.168.56.2 with 32 bytes of data:
Reply from 192.168.56.1: Destination host unreachable.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.56.2: Packets: Sent = 4, Received = 1, Lost = 3 (75% loss).

And when I try to ping the host (192.168.56.1) from the guest OS, I get the error message:

ping: connect: Network is unreachable

I have configured the network settings in VirtualBox to use a bridged adapter.

Could someone help me troubleshoot this issue? I'm unsure why the ping requests are failing despite configuring the network settings correctly. Any insights or suggestions would be greatly appreciated.

1
  • So far this seems more like a general Raspberry or networking issue. Not a specific IoT issue. Either way without more info there's very little anyone will be able to help you with.
    – Helmar
    Commented Feb 16 at 15:05

1 Answer 1

0

You will have to enable networking between the two.

Try this:

Setup the virtualbox to use 2 adapters: The first adapter is set to NAT (that will give you the internet connection). The second adapter is set to host only. Start the virtual machine and assign a static IP for the second adapter in Ubuntu (for instance 192.168.56.56). The host Windows will have 192.168.56.1 as IP for the internal network (VirtualBox Host-Only Network is the name in network connections in Windows). What this will give you is being able to access the apache server on ubuntu, from windows, by going to 192.168.56.56. Also, Ubuntu will have internet access, since the first adapter (set to NAT) will take care of that. Now, to make the connection available both ways (accessing the windows host from the ubuntu guest) there's still one more step to be performed. Windows will automatically add the virtualbox host-only network to the list of public networks and that cannot be changed. This entails that the firewall will prevent proper access. To overcome this and not make any security breaches in your setup: go to the windows firewall section, in control panel, click on advanced settings. In the page that pops up, click on inbound rules (left column), then on new rule (right column). Chose custom rule, set the rule to allow all programs, and any protocol. For the scope, add in the first box (local IP addresses) 192.168.56.1, and in the second box (remote IP) 192.168.56.56. Click next, select allow the connection, next, check all profiles, next, give it a name and save. That's it, now you have 2 way communication, with apache/any other service available as well as internet. The final step is to setup a share. Do not use the shared folders feature in virtualbox, it's quite buggy especially with windows 7 (and 64 bit). Instead use samba shares

  • fast and efficient.

Follow this link for how to set that up: https://wiki.ubuntu.com/MountWindowsSharesPermanently

Refer to virtualbox networking

PS: I recently joined in and do not have enough reputation to put this in comment. Hence, putting this in an answer. Hope this solves your problem.

Not the answer you're looking for? Browse other questions tagged or ask your own question.