Very useful Ubuntu 16 Networking Note
I hate when things change for no good reason. This week, it’s the interface naming of ethernet on Ubuntu 16. No more does it default to ‘eth0’.. It uses some other ‘ens’ style.. Garbage!
First up, find your ethernet interfaces (this VM has 1 interface to start):
dmesg | grep -i eth james@GREG:~$ dmesg | grep -i eth [ 1.479809] vmxnet3 0000:03:00.0 ens33: NIC Link is Up 10000 Mbps
Bah, looks gross!
Fix it by editing your grub config:
sudo nano /etc/default/grub
Change the line GRUB_CMDLINE_LINUX=””
to GRUB_CMDLINE_LINUX=”net.ifnames=0 biosdevname=0″
Regenerate your grub file:
sudo grub-mkconfig -o /boot/grub/grub.cfg
Edit your /etc/network/interfaces file, change the names to eth0, eth1 etc
# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static
Reboot, and voila.
If you add a new interface, it will come on as ethX, following the already provisioned interfaces.
Now it looks better (I added a new 10G interface, and it comes in as eth1)
james@GREG:~$ dmesg | grep -i eth [ 1.479809] vmxnet3 0000:03:00.0 eth0: NIC Link is Up 10000 Mbps [ 2.498115] vmxnet3 0000:0b:00.0 eth1: NIC Link is Up 10000 Mbps
Awww yeeeeah