Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-machine: No route to host to default docker machine (using host-only vbox network) on some wifi networks

I'm running docker-machine on OS X and it works great on my home wifi network (wifi-one).

On another wifi network (wifi-two), I cannot access the default machine, either through docker-machine or with pings. I've tried removing all the docker and virtual box software and caches and reinstalling while connected wifi-two, to no avail.

docker-machine uses a small vm in virtual box that uses a host-only vbox network (vboxnet0) to communicate between the host and vm.

On wifi-one, I can ping the gateway to the vboxnet0 (192.168.99.1), and I can ping the vm (192.168.99.100). In the routing table, I can see routes to the vm using the right interface:

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            dlinkrouter        UGSc           60        2     en0
...
dlinkrouter        c0:a0:bb:xx:xx:xx  UHLWIir        66      155     en0   1180
192.168.99         link#10            UC              2        0 vboxnet
192.168.99.100     8:0:27:db:16:21    UHLWIi          2       42 vboxnet   1109
...

On wifi-two, I can ping the vboxnet0 gateway, but not the vm. Ping reports request timeout, but docker-machine reports "no route to host". The routing table, while connected to wifi-two, shows the route to the vboxnet0 host-only network on the wifi interface (en0), not the vboxnet0 interface. Also curious is the default route is the route to the vboxnet0 gateway, but no sign of the wifi router in the routing table. Despite this, internet connectivity works fine on wifi-two.

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            192.168.99.1       UGSc           46        0     en0
...
192.168.99         link#4             UCS             9        0     en0
192.168.99.1/32    link#4             UCS             2        0     en0
192.168.99.1       dc:9f:db:2b:89:39  UHLWIir        46       61     en0   1197
192.168.99.100     link#4             UHLWIi          1        3     en0

So, I don't really know where the problem is here - the router, mac os, virtual box or docker-machine. I suspect there is something funny about the configuration of the router, but I don't see why the wifi router would have anything to do with the routes to a virtualbox host-only network.

edit: manually deleting the en0 route to 192.168.99 via en0 and running sudo route -nv add -net 192.168.99 -interface vboxnet0 does seem to resolve this on wifi-two.

But I'd like to understand why this is happening - why there is no route to vboxnet0 automatically when I join wifi-two and I'd like to find a better solution than running route add when I'm on wifi-two.

like image 996
adapt-dev Avatar asked Sep 25 '22 14:09

adapt-dev


1 Answers

I figured it out. it's kinda stupid:

wifitwo's subnet is 192.168.99. The same subnet docker uses for the host-only network it creates for the default VM. So the conflict was causing all sorts of cryptic errors.

like image 83
adapt-dev Avatar answered Sep 28 '22 06:09

adapt-dev