Hello
that gw is coming from the DHCP.
You may avoid that either telling VirtualBox you dont want GW in the
NAT network, or some configuration on the dhcp client
I think the easiest way is with an script like this (linux)
# delete default gw on eth0
config.vm.provision "shell",
run: "always",
inline: "eval `route -n | awk '{ if ($8 ==\"eth0\" && $2 !=
\"0.0.0.0\") print \"route del default gw \" $2; }'`"
Thanks
Alvaro
On Thu, Nov 19, 2015 at 5:05 AM, Willard Dennis
<[email protected]> wrote:
> Hi all,
>
> I wrote a Vagrantfile with the following directive:
> config.vm.network :public_network, :bridge => 'vbintf0',
> :use_dhcp_assigned_default_route => true
>
>
> When I 'vagrant up' the VM and log in, I see that the VM does have two NICs
> as expected, and that the default route from DHCP on the second NIC is
> indeed in the VM's routing table, but that unfortunately, the default route
> from the 'eth0' NIC is still in the routing table as well...
>
> wdennis@vagrantsvr01 vagrant_ansible_testing> vagrant ssh
> Last login: Tue Nov 17 23:28:54 2015 from 10.0.2.2
> [vagrant@localhost ~]$ ip a sh up
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
> link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
> inet 127.0.0.1/8 scope host lo
> valid_lft forever preferred_lft forever
> inet6 ::1/128 scope host
> valid_lft forever preferred_lft forever
> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
> UP qlen 1000
> link/ether 52:54:00:d3:eb:a4 brd ff:ff:ff:ff:ff:ff
> inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0
> valid_lft 86334sec preferred_lft 86334sec
> inet6 fe80::5054:ff:fed3:eba4/64 scope link
> valid_lft forever preferred_lft forever
> 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
> UP qlen 1000
> link/ether 08:00:27:a3:43:f2 brd ff:ff:ff:ff:ff:ff
> inet 192.168.207.166/24 brd 192.168.207.255 scope global dynamic eth1
> valid_lft 535sec preferred_lft 535sec
> inet6 fe80::a00:27ff:fea3:43f2/64 scope link
> valid_lft forever preferred_lft forever
> [vagrant@localhost ~]$ ip route sh
> default via 10.0.2.2 dev eth0 proto static metric 100
> default via 192.168.207.254 dev eth1 proto static metric 101
> 10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15 metric 100
> 192.168.207.0/24 dev eth1 proto kernel scope link src 192.168.207.166
> metric 100
>
>
> Because the 2nd default route has a higher metric, it effectively is not
> being used, and making it impossible to do what I need it to do... I was
> hoping that the ":use_dhcp_assigned_default_route" directive would *replace*
> the regular (eth0) default route, not *add* one... Does anyone know what I
> might have to specify for the eth0 NIC NOT to inject a default route?
>
> Thanks,
> Will
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/7d859db2-f676-4b0b-af2c-2d04d36d2522%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vagrant-up/CAHqq0ewzS2ciYv9cojKU8cHf%2BBw_YYb1R8XLUAwv_GRoPFBXRw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.