Notes

Configuring networking interfaces

Edit on GitHub

System Administration
3 minutes

Finding network interface

1# See a list of networks available
2ls /sys/class/net
3
4# See if your network is disabled
5sudo lshw -C network
6
7ip addr

Turn down a network

1sudo ip ls dev en0 down
2sudo ifdown en0
1# Enable interfaces
2sudo ifup -v eth0 

The file to edit to configure networks

1sudo nano /etc/network/interfaces

Try booting in recovery and then enabling networking. This was the easiest way for me to get ethernet to work. From GRUB, select Advanced Options and boot in recovery mode.

1# Commands
2
3systemctl status networking.service
4
5# restart networking
6service networking restart 
7sudo /etc/init.d/networking restart

If you don’t see eth0 but something like enp0s25, it’s because of Predictable Network Interface naming]() which is a part of systemd/udev. Basically it names the interface based on it’s hardware location. enp0s25 means PCI bus 0 slot 25. You can get an idea of the hardware location with lspci. You can also check the logs for lines like

Figure out which interface has the cable attached

1ip link
2
3sudo ethtool enp3s0
4sudo ethtool enp0s25
1sudo nano /etc/network/interfaces
1# The loopback network interface
2auto lo
3iface lo inet loopback
4
5# The primary network interface
6auto enp3s0
7iface enp3s0 inet dhcp
1sudo ifdown enp3s0 && sudo ifup -v enp3s0
1# Enable ethernet
2sudo ifconfig eth0 up 
3sudo dhclient eth0
1# Configure Google Public DNS
2echo "nameserver 8.8.8.8" > /etc/resolv.conf
3sudo ifconfig enp0s25 down
4sudo ifconfig enp25 up

Network manager says network not managed

Note: This happened to me on a fresh Ubuntu Sever 16.10 install from a CD. Ubuntu Desktop was installed separately later, and in it the Network Manager said ethernet networks were unmanaged. Didn’t have a wifi card on the system.

This is a known bug on Ubuntu 16.10. The Network Manager refuses to manage ethernet and bluetooth connections. Someone decided to not let Network Manager manage these interfaces except in a desktop edition (possibly because servers normally uses the ifupdown mechanism to manage networking).

On desktop images we want NM to manage everything, thus the installer creates /etc/NetworkManager/conf.d/10-globally-managed-devices.conf. But on a server, container, or similar environment we do NOT want NM to suddenly take over existing connections from netplan, networkd, or ifupdown – there it should be restricted to wifi and 3G.

The 10-globally-managed-devices.conf is the default config file to explicitly unmanage anything that is not wifi or wwan (meaning we definitely want NM to manage wifi and mobile data; and probably don’t want it to touch wired in many cases).

This file installed under /usr/lib/NetworkManager/conf.d/ has the following content by default:

[keyfile]
unmanaged-devices=*,except:type:wifi,except:type:wwan

that unmanages all network interfaces except wifi and wwan, thus bluetooth interface and ethernet interface are all unmanaged by default.

First try running the following command:

1nmcli d
2
3sudo nmcli dev set enp8s0 managed yes

If you get the error message:

Error: Device 'enp8s0' not found.

Try running the command below:

1ip link show

and look for a device name similar to enp8s0 and substitute it in the original command.

Create a blank file called 10-globally-managed-devices.conf in /etc/NetworkManager/conf.d, if one doesn’t already exist.

1# Ubuntu 16.04
2# create blank `10-globally-managed-devices.conf` under `/etc/NetworkManager/conf.d`
3# https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1638842
4touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
5
6# remove /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf
7rm -rf /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf

Alternatively, you can edit the 10-globally-managed-devices.conf to change the value for unmanaged-devices to none

1# Ubuntu 17.10
2cp /usr/lib/NetworkManager/10-globally-managed-devices.conf /etc/NetworkManager/10-globally-managed-devices.conf
3
4nano /etc/NetworkManager/10-globally-managed-devices.conf
5# change the value "unmanaged-devices" to none

Afterwards, restart Network Manager

1# restart Network Manager
2sudo service network-manager restart
3sudo systemctl restart NetworkManager

https://askubuntu.com/questions/882806/ethernet-device-not-managed/893614#893614

Check the logs

1 tail /var/log/syslog
2 cat /var/log/syslog | grep "eth" | tail -50