Skip to content

Instantly share code, notes, and snippets.

@brbsix
Last active December 27, 2021 22:33
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brbsix/b70413dec907906ef659 to your computer and use it in GitHub Desktop.
Save brbsix/b70413dec907906ef659 to your computer and use it in GitHub Desktop.
Networking Troubles with Vagrant Box ubuntu/wily64

Networking Troubles with Vagrant Box ubuntu/wily64

For some reason, the network interfaces in ubuntu/wily64 fail to configure at boot. The interfaces are renamed during boot, with dmesg reporting things like udev renamed network interface eth0 to enp1s0. This is apparently the result of a change in systemd. You can read about it here:

Starting with v197 systemd/udev will automatically assign predictable, stable network interface names for all local Ethernet, WLAN and WWAN interfaces. This is a departure from the traditional interface naming scheme ("eth0", "eth1", "wlan0", ...), but should fix real problems.

http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/


You have at least two ways to remedy the situation. Disable Predictable Network Interface Names or configure the new interfaces.

In order to get into the machine, you'll need to boot in GUI mode. See https://docs.vagrantup.com/v2/virtualbox/configuration.html. Generally this entails adding something like vb.gui = true to your Vagrantfile.

To disable this behavior

Edit /etc/default/grub with GRUB_CMDLINE_LINUX="net.ifnames=0".

Then update grub with sudo grub-mkconfig -o /boot/grub/grub.cfg or sudo update-grub.

Networking should be configured as expected (with eth0) upon reboot.

To configure the new interfaces

First, determine the name(s) of the new interface(s). You may run ifconfig -a or check dmesg (i.e. dmesg | grep renamed) for a line like this:

[2.671805] e1000 0000:00:03.0 enp0s3: renamed from eth0

In this example, the new interface name is enp0s3.

Once you have determined the new interface name(s), go to /etc/network/interfaces.d. There should be a file named eth0.cfg with the following contents:

# The primary network interface
auto eth0
iface eth0 inet dhcp

Now copy eth0.cfg to enp0s3.cfg (or whatever the name of your interface is). Edit the new file and replace all use of eth0 with enp0s3. Do this for each interface you need configured. Remove eth0.cfg when you are finished.

Finally, restart networking with sudo systemctl restart networking.service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment