Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No default route in Ubuntu box after restart #7888

Closed
carlosefr opened this issue Oct 11, 2016 · 4 comments
Closed

No default route in Ubuntu box after restart #7888

carlosefr opened this issue Oct 11, 2016 · 4 comments

Comments

@carlosefr
Copy link
Contributor

Vagrant version

Vagrant 1.8.6

Host operating system

MacOS X 10.11.6 (El Capitan)

Guest operating system

Ubuntu 16.04 x64 (Xenial)

Vagrantfile

https://github.com/Probely/CTF-Challenges/blob/32b69713cad8c36f8dfdc2f3c3f62eb7b39ecb03/Vagrantfile

The Vagrant file is long, but the relevant bit is the presence of a private network (more details below).

Expected behavior

After being created, the VM can reach the internet just fine. After restarting it this should still be the case.

Actual behavior

The VM cannot reach the internet anymore after being restarted.

Steps to reproduce

  1. vagrant up
  2. vagrant halt
  3. vagrant up

Comment

The VM has two network interfaces, ensp0s3 (NAT) and ensp0s8 (private network). I've observed that after restarting the VM, the interfaces remain the same and so does the output of ifconfig.

What doesn't stay the same is the contents of /etc/network/interfaces. After initialization it contains this relevant bit:

#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
auto enp0s8
iface enp0s8 inet dhcp
    post-up route del default dev $IFACE || true
#VAGRANT-END

This removes the default route from the private network interface, which is OK. But after restarting the VM, it changes to this:

#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
auto enp0s3
iface enp0s3 inet dhcp
    post-up route del default dev $IFACE || true
#VAGRANT-END

It now removes the default route from the NAT interface, which breaks things.

I haven't figured out why this happens considering the interfaces themselves didn't change between boots.

@carlosefr
Copy link
Contributor Author

I think I understand what's happening here...

The provisioning script called from the Vagrantfile installs Docker, which creates a docker0 interface. Vagrant is sorting the interfaces and removing the default route from the second one, which happens to be the wrong one. The debug output seems to indicate exactly this:

DEBUG network_interfaces: Unsorted list: ["enp0s3", "enp0s8", "docker0"]
DEBUG network_interfaces: Sorted list: ["docker0", "enp0s3", "enp0s8"]

@chrisroberts
Copy link
Member

Hi! This has been addressed in #7866 and will be fixed in the next release. Thanks!

@carlosefr
Copy link
Contributor Author

Ok, I patched my 1.8.6 and the fix seems to work.

@ghost
Copy link

ghost commented Apr 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants