Broken routes with changed default router on macOS

11 views
Skip to first unread message

mic...@kinvolk.io

unread,
Nov 20, 2017, 3:40:55 AM11/20/17
to Vagrant
Hello,

I change the default route in a VM as described here: https://www.vagrantup.com/docs/networking/public_network.html#default-router (i.e. `route add default gw <new> && route del default gw <old>`).

This works fine on Linux but not for macOS users: they loose connectivity to the internet with the change (host and guest can still connect though).

Somebody knows the problem and a solution?

Thanks,
Michael

Alvaro Miranda Aguilera

unread,
Nov 20, 2017, 4:44:56 AM11/20/17
to vagra...@googlegroups.com
Hello

the documentation is just an example, different OS will require a different route.

are you doing a macOS guest and you want to override the default gw there?

The first point will be check the documentation and came with the commands you need

once you get the commands, Vagrant can run them for you. but came with the commands require some trial try/error.

Alvaro.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/d03310ea-a817-407c-a525-997cbed904c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

mic...@kinvolk.io

unread,
Nov 20, 2017, 5:26:32 AM11/20/17
to Vagrant


On Monday, November 20, 2017 at 10:44:56 AM UTC+1, Alvaro Miranda Aguilera wrote:

are you doing a macOS guest and you want to override the default gw there?

The guest is a Linux VM. The relevant part of my provision script is:

route add default gw 192.168.222.1
eval "$(route -n | awk '{ if ($8 =="enp0s3" && $2 != "0.0.0.0") print "route del default gw " $2; }')"

192.168.222.1 is the host IP address. The guest uses a private network; from the Vagrant file:

c.vm.network "private_network", ip: "192.168.222.10"

This all works on a Linux host. On a macOS host the guest is not able to connect to the internet after the default gw was changed.

 

Alvaro Miranda Aguilera

unread,
Nov 20, 2017, 7:08:04 AM11/20/17
to vagra...@googlegroups.com
there is not enough information to help.

should it connect over private_network?

what are the output of

route -n
ip addr show

can you ping 8.8.8.8 ?

perhaps you need to replace the dns?

can be many reasons why doesnt work, if you could share a repo over github to reproduce will be easier to have a look.

Alvaro.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages