0

I have Mac OS X 10.10 (Yosemite) as the host machine, I have installed VirtualBox and created a virtual machine with Windows 7 64-bit.

I have created 2 network adapters on the virtual machine, shown below. But I can’t ping the Windows 7 guest OS from the Mac OS X host OS. How do I fix this issue? I am able to ping the host OS from the guest OS.

I feel a solution to this issue will also help me fix the issues I am having with SSH to the guest OS. I don’t want to use port forwarding.

  1. Host Only Adapter
  2. NAT adapter

The VBoxManage showvminfo command shows:

VBoxManage showvminfo win7_x64

Give the following info

 NIC 1:           MAC: 080027D6197C, Attachment: Host-only Interface
                  'vboxnet0', Cable connected: on, Trace: off (file: none), 
                  Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, 
                  Promisc Policy: deny, Bandwidth group: none
 NIC 2:           MAC: 080027DC16CE, Attachment: NAT, Cable connected: on, 
                  Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps,
                  Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
 NIC 2 Settings:  MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)

When I run ipconfig on the guest I get the following output.

 Windows IP Configuration


 Ethernet adapter Local Area Connection 2:

    Connection-specific DNS Suffix  . :
    Link-local IPv6 Address . . . . . : fe80::78da:422c:2215:41bb%12
    IPv4 Address. . . . . . . . . . . : 192.168.56.101
    Subnet Mask . . . . . . . . . . . : 255.255.255.0
    Default Gateway . . . . . . . . . :

 Ethernet adapter Local Area Connection:

    Connection-specific DNS Suffix  . : Home
    Link-local IPv6 Address . . . . . : fe80::61b7:c9f4:3f50:c732%10
    IPv4 Address. . . . . . . . . . . : 10.0.3.15
    Subnet Mask . . . . . . . . . . . : 255.255.255.0
    Default Gateway . . . . . . . . . : 10.0.3.2

 Tunnel adapter Local Area Connection* 12:

    Media State . . . . . . . . . . . : Media disconnected
    Connection-specific DNS Suffix  . :

 Tunnel adapter isatap.Home:

    Media State . . . . . . . . . . . : Media disconnected
    Connection-specific DNS Suffix  . : Home

 Tunnel adapter isatap.{13342B61-268C-4B2A-92E7-5DA848C7707B}:

    Media State . . . . . . . . . . . : Media disconnected
    Connection-specific DNS Suffix  . :

When I try to ping the guest IP address (in this case 192.168.56.101), I keep getting timeouts.

XYZ-MBP:~ user1$ ping 192.168.56.101
PING 192.168.56.101 (192.168.56.101): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
^C
--- 192.168.56.101 ping statistics ---
5 packets transmitted, 0 packets received, 100.0% packet loss

Following is the result of running the ifconfig command on my Mac (the host)

XYZ-MBP:~ user1$ ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=3<RXCSUM,TXCSUM>
    inet6 ::1 prefixlen 128 
    inet 127.0.0.1 netmask 0xff000000 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    nd6 options=1<PERFORMNUD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 24:a0:74:f0:ee:46 
    inet6 fe80::26a0:74ff:fef0:ee46%en0 prefixlen 64 scopeid 0x4 
    inet 192.168.0.5 netmask 0xffffff00 broadcast 192.168.0.255
    inet6 fd54:669f:e4f2::26a0:74ff:fef0:ee46 prefixlen 64 autoconf 
    inet6 fd54:669f:e4f2::3024:caa:5279:425d prefixlen 64 autoconf temporary 
    nd6 options=1<PERFORMNUD>
    media: autoselect
    status: active
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=60<TSO4,TSO6>
    ether 72:00:07:b1:67:90 
    media: autoselect <full-duplex>
    status: inactive
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    options=60<TSO4,TSO6>
    ether 72:00:07:b1:67:91 
    media: autoselect <full-duplex>
    status: inactive
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
    ether 06:a0:74:f0:ee:46 
    media: autoselect
    status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1452
    ether 26:39:2f:b8:30:3f 
    inet6 fe80::2439:2fff:feb8:303f%awdl0 prefixlen 64 scopeid 0x8 
    nd6 options=1<PERFORMNUD>
    media: autoselect
    status: active
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=63<RXCSUM,TXCSUM,TSO4,TSO6>
    ether 26:a0:74:0f:a8:00 
    Configuration:
        id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
        maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
        root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
        ipfilter disabled flags 0x2
    member: en1 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 5 priority 0 path cost 0
    member: en2 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 6 priority 0 path cost 0
    nd6 options=1<PERFORMNUD>
    media: <unknown type>
    status: inactive
vboxnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:00 
    inet 192.168.0.10 netmask 0xffffff00 broadcast 192.168.0.255
2

The two ends of the vboxnet connection, i.e., your Host-onlyadapter,belong to two different subnets, hence they cannot talk to each other.

From ipconfig:

  Ethernet adapter Local Area Connection 2:

Connection-specific DNS Suffix  . :
Link-local IPv6 Address . . . . . : fe80::78da:422c:2215:41bb%12
IPv4 Address. . . . . . . . . . . : 192.168.56.101
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :

From the ifconfig command onthe host:

 vboxnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
ether 0a:00:27:00:00:00 
inet 192.168.0.10 netmask 0xffffff00 broadcast 192.168.0.255

One has address 192.168.56.101, the other one has 192.168.0.10. For them to be able to talk to each other, they should belong to the same subnet, 192.168.56.0/24. What is worse, the subnet of the host' vboxnet0 interface is the same as your host’s LAN, just to make sure tht there is maximum confusion.The two subnets are setup automatically by VirtualBox to be distinct, that's the reason for using such an unusual subnet as 192.168.56.0/24. You should not alter this scheme.

It is possible your routing table also contains some errors, but we’ll cross that bridge when we get there.

  • thanks for the response. You have said that I should not change the subnet mask to match them. So, What action should I take to fix this? Do you want more information? – A j Sep 22 '15 at 9:21
  • @Ajay It's funny that this mismatch has not been caused by you.... normally automatic configurations by VirtualBox work quite well. At any rate, from the VB GUI: File-> Preferences-> Network -> Host-Only-Network, make sure you have one (generally called vboxnet0), then hit the screwdriver -> DHCP server,enable it, and fill the four boxes with these values: 192.168.56.100 255.255.255.0 192.168.56.2 192.168.56.10 respectiely. Save. Reboot, check now that the addresses of the host-only interfaces on host and guest are both witihin 192.168.56.0/24 – MariusMatutiae Sep 22 '15 at 9:29
1

The following solved the problem in my case:

I was seeing timeouts when pinging a Win7 guest from a Mac OS X host, and found that the adapter order definition mattered.

The following configurations worked:
* Adapter 1: Host-only
* Adapter 1: Host-only | Adapter 2: NAT
* Adapter 1: Host-only | Adapter 2: Bridged
* Adapter 1: Host-only | Adapter 2: Bridged | Adapter 3: NAT
* Adapter 1: Host-only | Adapter 2: NAT | Adapter 3: Bridged

where the ping response was:
64 bytes from 192.168.56.199: icmp_seq=0 ttl=64 time=0.327 ms
64 bytes from 192.168.56.199: icmp_seq=1 ttl=64 time=0.277 ms
64 bytes from 192.168.56.199: icmp_seq=2 ttl=64 time=0.314 ms
...

The following configurations timed out:
* Adapter 1: NAT | Adapter 2: Host-only
* Adapter 1: Bridged | Adapter 2: Host-only
* Adapter 1: Bridged | Adapter 2: NAT | Adapter 3: Host-only

where the ping response was:
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
...

I am uncertain at this time as to why, however it seems the Host-only adapter must be specified first. I stopped testing permutations after those noted above.

I hope this helps!

  • This worked for me. So much trial and error, and at first I did not think your answer worked, but as I have been using my Win10 via vagrant up with a Vagrantfile, every time I used that after configuring the global Vbox settings and then settings adapter sets for my Win10 VM... using vagrant up would reset all of my settings!! I avoided using vagrant via host CLI and instead just used the VBox GUI for everything, after using your ordered settings, and voila! – danjah Nov 3 '16 at 3:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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