For a test I need to allow routing from my local network to a guest inside a VirtualBox. The guest already have outside access.

So far I enabled ip forwarding on my local machine (OSX 10.9) and added a route to the host-only network on the machine on the local network.

route add -net netmask gw
sysctl -w net.ipv4.ip_forward=1

The network look like that.

Local network -> [Wireless] -> MacOSX (Wifi) & (VboxHost) -> [VBox 192.168.59/24] ->

Unless VirtualBox is purposely dropping packet from the outside this should work.

My goal would be for to connect to So far I can only ping from it.

Also, my guest already have another adapter with a default gw that allow access to the wifi.

What route or network config could I be missing?

Also I could understand the packet getting the my guest, but the guest not being able to reply, however tcpdump show no paquet ever get to guest if say I ping the machine. Also no firewall is running anywhere.

Routing table on my Mac

Destination        Gateway            Flags        Refs      Use   Netif Expire
default          UGSc           42        1     en0
127                UCS             0        0     lo0          UH              6  2943735     lo0
169.254            link#4             UCS             0        0     en0
192.168.0          link#4             UCS             3        0     en0        9c:d6:43:c8:cf:e8  UHLWIir        43    21647     en0   1199      8:0:27:c2:fc:68    UHLWI           0        7     en0   1068      0:15:99:77:73:ed   UHLWI           0       82     en0    845          UHS             2     9114     lo0
192.168.59         link#9             UC              3        0 vboxnet       a:0:27:0:0:0       UHLWI           0    69759     lo0     link#9             UHRLWIi         2    31866 vboxnet     1
  • 3
    Any reason you can't just configure your VM's network adapter to be bridged instead of host-only? Your effectively getting the same behavior. – heavyd Jul 25 '14 at 6:54
  • The same? The host only adapter is separate network, while bridged AFAIK will bind the host to my real network. Which inconvenient because IP while change from office, to home, etc. – kkx Jul 25 '14 at 14:47
  • I'm a VMware guy but like @heavyd mentioned, you should be able to setup a private or "host only" LAN with Virtual Box just like you can with VMware Fusion or Workstation. – SaxDaddy Jul 26 '14 at 2:46
  • @SaxDaddy It's exactly that I'm using but trying to route traffic to it for a test. However like I said not working like it should/want (or it's actually doing too good of a job). The host-only adapter seems to be dropping outside traffic, even if the routing is correct or something in MacOSX is no routing the traffic properly. – kkx Jul 26 '14 at 22:28
  • 4
    I am astounded that no one noticed the error in this configuration, since it is so obvious: in the route add command, the host-only network was configured to use as a gateway a pc outside the host-only network. This cannot possibly work. The correct route should have used as gw the IP address of the mac interface on the host-only adapter, not its default LAN. There are other mistakes (why does lo have an address of in the routing table???) but with the error in route add no progress at all is possible. I leave this note for eventaul readers. – MariusMatutiae Apr 22 '17 at 8:57

Host-only networking mode cannot be used to route traffic from the local network to the VM hosts. You should use use Bridged, NAT or NAT network. With the last two you need a port-forward.


[1] https://www.virtualbox.org/manual/ch06.html#networkingmodes (See the table at the end of section 6.2) [2] https://www.virtualbox.org/manual/ch06.html#network_hostonly

  • Sorry that's not true. I think the documentation may be misleading. The host only network is like an independent LAN true, but LANs can have gateways and there is nothing to stop the host (or even one of the guests) acting as a router. I do it all the time on LInux I don't see why it shouldn't be possible on OS-X. Bridging and routing are two different things. – Rodney May 19 at 13:38
  • Notice that we are using Virtualbox defined terms, not common sense. I was mislead by the words, that is why I pointed to the table at the documentation. – Marcelo Roberto Jimenez 2 days ago

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.