Page 1 of 1

Host only network not working OSX 10.8.3 VB 4.2.10r84104

Posted: 11. Apr 2013, 22:19
by oradebug
I've been beating my head against this for days...

I am running VBox 4.2.10r84104 on Mac OS X 10.8.3. My guest is Oracle Enterprise Linux 5.6.

I can't get the guest and the host to talk via the host-only network:

Code: Select all

[root@oel56-guest]# ping 192.168.56.1
PING 192.168.56.1 (192.168.56.1) 56(84) bytes of data.
--- 192.168.56.1 ping statistics ---
8 packets transmitted, 0 received, 100% packet loss, time 7010ms

[wilton@osx1083-host]$ ping 192.168.56.2
PING 192.168.56.2 (192.168.56.2): 56 data bytes
Request timeout for icmp_seq 0
...
--- 192.168.56.2 ping statistics ---
6 packets transmitted, 0 packets received, 100.0% packet loss
I have set up the default vboxnet0 network:

Code: Select all

[wilton@osx1083-host]$ VBoxManage list hostonlyifs --long
Name:            vboxnet0
GUID:            786f6276-656e-4074-8000-0a0027000000
DHCP:            Disabled
IPAddress:       192.168.56.1
NetworkMask:     255.255.255.0
IPV6Address:     
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 0a:00:27:00:00:00
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-vboxnet0
In Virtualbox, the guest NIC 2 interface is connected to the vboxnet0 network:

Code: Select all

[wilton@osx1083-host]$ VBoxManage showvminfo work | grep '^NIC 2'
NIC 2:           MAC: 080027BBCF34, 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
On the guest, the interface is configured with an appropriate IP address, etc.

Code: Select all

[root@oel56-guest]# ifconfig -a eth1
eth1      Link encap:Ethernet  HWaddr 08:00:27:BB:CF:34  
          inet addr:192.168.56.2  Bcast:192.168.56.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5 errors:0 dropped:0 overruns:0 frame:0
          TX packets:132 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:300 (300.0 b)  TX bytes:11883 (11.6 KiB)
On the guest, iptables and selinux are disabled:

Code: Select all

[root@oel56-guest]# setenforce 0
setenforce: SELinux is disabled

[root@oel56-guest]# grep ^SELINUX= /etc/selinux/config
SELINUX=disabled

[root@oel56-guest]# service iptables status
Firewall is stopped.
Please oh please someone please tell me where I am going wrong. Thanks.

-- Oradebug

Re: Host only network not working OSX 10.8.3 VB 4.2.10r84104

Posted: 12. Apr 2013, 06:42
by noteirak
what about the firewall in the host?
Could you show the routing table in both the host & guest?

Re: Host only network not working OSX 10.8.3 VB 4.2.10r84104

Posted: 12. Apr 2013, 17:40
by oradebug
@noteirac that was it. I didn't realize I would have to add a static route to the host:

Code: Select all

sudo route -nv add -net 192.168.56 -interface vboxnet0
Now I can ping the guest from the host and the host from the guest. Making that route persistent is a little challenging. If I add it to OS X startup items it won't work because the vboxnet0 interface doesn't exist until Virtualbox starts. At least I can move beyond the hacking stage now.

Oradebug

Re: Host only network not working OSX 10.8.3 VB 4.2.10r84104

Posted: 12. Apr 2013, 18:13
by noteirak
Very interesting that you need to add a route for a directly connected interface. This shouldn't be the case at all as this is normally automatic.
Looks like there is an underlying problem to your case.

Re: Host only network not working OSX 10.8.3 VB 4.2.10r84104

Posted: 21. May 2013, 16:17
by wizonesolutions
A note to future readers: make sure you add the route while disconnected from your VPN. I use the Cisco AnyConnect Secure Mobility Client, and it implicitly blocked adding the route. If I added it with the client disconnected, reconnected, and then removed the "deny all" firewall rule it added, I was able to ping my VM on the host-only network.

Strange, but effective.

Re: Host only network not working OSX 10.8.3 VB 4.2.10r84104

Posted: 21. May 2013, 16:27
by noteirak
Actually intended behaviour: The VPN client removes all the routes and only keep the ones required for the VPN tunnel and add the routes coming from the VPN config at connection.
At disconnection, it removes all the routes and put back the ones previously in place.

But very good catch, thank you for coming back with a solution to this topic - I am sure it will be useful to others.

Re: Host only network not working OSX 10.8.3 VB 4.2.10r84104

Posted: 28. Jul 2015, 20:09
by Keith Roberts
noteirak wrote:Actually intended behaviour: The VPN client removes all the routes and only keep the ones required for the VPN tunnel and add the routes coming from the VPN config at connection.
At disconnection, it removes all the routes and put back the ones previously in place.
I'm using Cisco AnyConnect (3.1.05170) and it DOES remove the VirtualBox Host-Only routes, but it never recreates them after I shut the VPN down :(
Restarting the VM or VirtualBox doesn't either - I have to reboot my mac to get it working again

Re: Host only network not working OSX 10.8.3 VB 4.2.10r84104

Posted: 12. Aug 2015, 05:18
by petzi-baer
Keith Roberts wrote:
noteirak wrote:Actually intended behaviour: The VPN client removes all the routes and only keep the ones required for the VPN tunnel and add the routes coming from the VPN config at connection.
At disconnection, it removes all the routes and put back the ones previously in place.
I'm using Cisco AnyConnect (3.1.05170) and it DOES remove the VirtualBox Host-Only routes, but it never recreates them after I shut the VPN down :(
Restarting the VM or VirtualBox doesn't either - I have to reboot my mac to get it working again
A somewhat less painful solution: Requires only to shutdown all the VMs and Virtualbox and then:

Code: Select all

sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh restart