When working with Ubuntu 16.04 (Xenial) systems, you might encounter a puzzling situation where ifdown enp0s3
reports "Unknown interface enp0s3" despite the interface being active and functional. This occurs because modern Ubuntu versions use NetworkManager by default, while traditional ifup/ifdown
commands rely on /etc/network/interfaces
configuration.
First, let's verify the current network configuration:
# ifconfig
enp0s3 Link encap:Ethernet HWaddr 08:00:27:ef:b6:e6
inet addr:192.168.2.3 Bcast:192.168.2.255 Mask:255.255.255.0
[...output truncated...]
# ip a s
2: enp0s3: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:ef:b6:e6 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.7/24 brd 192.168.2.255 scope global enp0s3
The key indicators are:
- NetworkManager is managing the interface (shown by
nmcli conn sh
output) /etc/network/interfaces
only contains loopback configuration- Traditional network tools (
ifup/ifdown
) only work with interfaces defined in/etc/network/interfaces
Method 1: Use NetworkManager Commands
# nmcli connection down "Wired connection 1"
# nmcli connection up "Wired connection 1"
Method 2: Configure /etc/network/interfaces
# Add to /etc/network/interfaces:
auto enp0s3
iface enp0s3 inet dhcp
Then disable NetworkManager for this interface:
# Create /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
[keyfile]
unmanaged-devices=interface-name:enp0s3
# Restart NetworkManager
systemctl restart network-manager
After implementing either solution, verify with:
# Check interface status
ip link show enp0s3
# Test bringing interface down/up
sudo ifdown enp0s3 && sudo ifup enp0s3
- For desktop systems: Stick with NetworkManager (Method 1)
- For servers: Use
/etc/network/interfaces
(Method 2) - Always document network configuration changes
- Test changes in a non-production environment first
If issues persist, check system logs:
# View network-related logs
journalctl -u NetworkManager
journalctl -u networking
For complex setups, consider examining:
# NetworkManager connection details
nmcli connection show "Wired connection 1"
# Interface configuration files
ls -l /etc/network/interfaces.d/
This is a classic case where the network interface enp0s3
clearly exists (as shown by both ifconfig
and ip a s
), but the traditional network utilities can't manage it. Here's why this happens in Ubuntu 16.04:
# Traditional method fails
$ sudo ifdown enp0s3
Unknown interface enp0s3
# Yet the interface is active
$ ip link show enp0s3
2: enp0s3: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
Ubuntu 16.04 uses NetworkManager by default, but keeps legacy ifupdown compatibility. The minimal /etc/network/interfaces
shows NetworkManager is managing the interface:
# This empty config delegates to NetworkManager
auto lo
iface lo inet loopback
When NetworkManager controls an interface, you should use its tools instead of ifup/ifdown:
# View active connections
$ nmcli connection show
NAME UUID TYPE DEVICE
Wired connection 1 42d740b1-21c3-3b7c-8b9e-5922fe8a6380 ethernet enp0s3
# Bring interface down
$ nmcli connection down "Wired connection 1"
# Bring interface up
$ nmcli connection up "Wired connection 1"
Option 1: Switch to ifupdown completely by configuring the interface:
# /etc/network/interfaces
auto enp0s3
iface enp0s3 inet dhcp
Option 2: Use the new iproute2 utilities:
# Disable interface
$ sudo ip link set enp0s3 down
# Enable interface
$ sudo ip link set enp0s3 up
# Refresh DHCP (if needed)
$ sudo dhclient enp0s3
The modern Linux networking stack has evolved beyond ifupdown. For Ubuntu 16.04 specifically, sticking with NetworkManager commands provides the most reliable interface control while maintaining all network configuration features.