Open interfrastic opened 5 years ago
any update on this issue? I saw another thread open on the topic of unclear default routes dating all the way back to 2014, with just some hacky scripts proposed to manuallly change routing during provisioning. But those solutions require the VM to be reprovisioned on each boot.. So that can't be the proper solution here. This issue is written very clearly and understandably, so I'm hoping for an implementation!
For context, I'm having this issue on NixOS host with Ubuntu 22.04 client on Vagrant 2.2.19 using libvirt provider
Vagrant version
Vagrant 2.2.4
Host operating system
macOS Mojave Version 10.14.3
Guest operating system
Ubuntu Bionic Beaver 18.04.2 LTS from box bento/ubuntu-18.04
Vagrantfile
Debug output
vagrant.log
Expected behavior
When
use_dhcp_assigned_default_route
istrue
, there should be exactly one default route, and it should be through the bridged interfaceeth1
, like this:When
use_dhcp_assigned_default_route
isfalse
, there should be exactly one default route, and it should be through the NAT interfaceeth0
, like this:Actual behavior
Regardless of whether
use_dhcp_assigned_default_route
istrue
orfalse
, there are two default routes, one through the NAT interfaceeth0
and one through the bridged interfaceeth1
, like this:The ordering of the routes seems to vary in ways that are difficult to predict. This causes protocols like NFS, which can fail when passed through NAT, to work in some cases and fail in others, despite an identical Vagrantfile (and therefore guest OS configuration) in each case.
Steps to reproduce
public_network
mode.vagrant up
and choose to bridge to whichever network interface is connected to the Internet.vagrant ssh
to connect to the VM.ip route
in the VM.Note that editing the Vagrantfile to set the
use_dhcp_assigned_default_route
option totrue
has no effect on the routing.Editing the Vagrantfile to specify Ubuntu 16.04, or any other Debian distribution that uses net-tools for network configuration, makes the problem of dual default routes disappear; this change also restores the proper behavior of the
use_dhcp_assigned_default_route
option.A glance at the source code shows that only the net-tools Debian configuration template actually takes
use_dhcp_assigned_default_route
into account, a change that was implemented as a fix for GH-2648; the new Netplan configuration code, implemented for GH-9134, does not seem to consideruse_dhcp_assigned_default_route
at all.References