Can't ping guest OS in VirtualBox, but guests can ping host

141,353

Solution 1

I was surprised to find the answer that finally worked for me in an ubuntu forum:

Depending on the version of Windows you used in your VirtualBox, in order to be able to get a reply to your pings you probably need to create at least one folder share on the Windows machine. In Windows XP for example, once you have at least one share set up, the machine will respond to pings. But if no shares are set, no pings will be returned.

(Have a look at the full answer, here: http://ubuntuforums.org/showthread.php?t=2028309)

So basically what I did was:

  • Use Bridged Mode instead of NAT for the VM in the host VirtualBox GUI
  • Shutdown the firewall in the windows host
  • Setup some foo shared folder in the VM itself (c:\foo or similar)

EDIT: to clarify, my setup is Windows7 Host & Windows7 Guest.

That's that, hope it helps someone.

Solution 2

  1. If you want your VM to be accessible on network like a standalone machine (I guess that is what you trying to do), check following

    • In VirtualBox GUI interface, under network setting of each VM, select bridge mode, not NAT.

    • Within each VM, either setup static IP or dhcp.

  2. For firewall blocking issue, Check out my answer for another question here

    On hosting machine, in file explorer, go to

    Control Panel\All Control Panel Items\Windows Firewall\Allowed apps

    The above path is for windows 8, other windows version may differ slightly.

    Look for application name (eg. Virtual Box is "Oracle VM VirtualBox"). There are 3 check boxes for the application, check mark them all, restart your app and it should work.

Solution 3

Tested on two Ubuntu 16.06 guest boxes

you will need to use "ifconfig -a" to list all available network interfaces - at first you run just an "ifconfig" (without the -a flag), memorize network interfaces that it shows you and then run it again with the -a flag, and find that extra interface. In my case by running just a "ifconfig" I got two interfaces - “enp0s3”, “lo” and when running with “-a” flag I got an extra interface - “enp0s8”. After we got a name of that extra interface name you edit /etc/network/interfaces file and append these two lines there:

auto enp0s8 iface enp0s8 inet dhcp

After that change you reboot the machine and now when running “ifconfig” should get a host-only adapter’s IP that you can use to connect from you host machine.

Both of the guest os have different ips. I am able to ping host from both guests, guest to guest and guests to host.

Source: answer by sergeil

Share:
141,353

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year
    • Host OS: Windows 7
    • Guest OS: Ret Hat Linux (RHEL 6) and Windows 7

    I want to connect to both guest OSes. I tried to ping both guests, but it is not working. Both guests can ping my Windows 7 host though.

  • tyh
    tyh over 9 years
    Adding the shared folder works as well when it is a Windows Server 2008 VM.
  • Donatello
    Donatello about 9 years
    this strange solution worked : I added a shared folder on Windows VM guest OS. Note that a window asking for switching on "private network" appears, so maybe the type of network was not good .. ("public" ?)
  • StanE
    StanE about 8 years
    This is probably the strangest thing I ever read. I too can confirm that this worked with my Win10 guest and bridged mode and without deactivating the firewall. How could anyone find out this himself / herself? Thank you very much!
  • Alchemist
    Alchemist almost 8 years
    Having the same problem but it only happens when I introduce a VNIC in the virtual machine. It was working fine earlier but as soon as I create a VNIC, I am unable to ping the Virtual Machine from my other OS. Any ideas what might be happening?
  • Paul Zaczkowski
    Paul Zaczkowski over 6 years
    Worked for me as well... that's fun.
  • Nicholas
    Nicholas almost 6 years
    I think that the 'network discovery' in Windows was turned off. First I was also not able to ping and after reading this strange solution and the question by @Donatello I thought maybe the network discovery was still turned off. So I went into the Network tab in the File Explorer. Got the message that Network Discovery was turned off in the top of the window. And after enabling that I was able to ping.
  • Souza
    Souza over 5 years
    worked for me. Host = Windows 10 and Guest Windows XP
  • Scott - Слава Україні
    Scott - Слава Україні over 5 years
    As I hope you understand, the article you linked to is about letting ping requests into a Windows box (and letting ping responses get out). But this question is about sending ping requests out of a Windows host and letting ping responses get in. Why do you believe that this is the same problem? Also, did you notice that the Windows 7 guest can ping the Windows 7 host?
  • RaffaeleT
    RaffaeleT over 4 years
    weirdly worked for me too, W10 Host and W10 Guest.