Predictable Network Interface Names
or, why my interfaces are no longer called eth0 and eth1 etc... and I cant ifup and ifdown anymore, nor can I 'service network restart.'
Is this crap actually an improvement?
The classic naming scheme for network interfaces applied by the kernel is to simply assign names beginning with "eth0" and ethX after that. A problem occurs on new distributions with driver probing on every boot. On every boot the darn things do driver probing now to check to see if you made any hardware changes. The driver probing does not always assign interfaces with the same numbers. A system with two nics might have nic 1 as eth0 today and eth1 tomorrow even if you did not make any changes. Rather than trying to figure out why the driver probing is inconsistent, the devs used a band-aide and completely changed the name schema.
systemd - The change can be blamed on systemd. systemd is a new init system and system manager, that was adopted by most of Linux distributions now over the traditional SysVinit manager.
Predictable Network Interface Names - out with the old ethX naming schema and in with this new weird looking names like 'enp3s0' or 'enp0s10'. Now undev assigns names to ethernet devices incorporating Firmware/BIOS provided index numbers, and etc.
If you want to bring down your interface, and you identified it as 'enp3s0' as an example, issue the command:
ifconfig enp3s0 down
Interfaces are named following rules that use information from the firmware and bios if available.
The commands ifdown and ifup read the file /etc/network/interfaces on SysV machines. Either the scripts are not configured or are not compatible with systemd, since distributions like Ubuntu don't bother with them.
assignment name rules
- Names incorporating Firmware/BIOS provided index numbers for on-board devices (example: eno1)
- Names incorporating Firmware/BIOS provided PCI Express hotplug slot index numbers (example: ens1)
- Names incorporating physical/geographical location of the connector of the hardware (example: enp2s0)
- Names incorporating the interfaces's MAC address (example: enx78e7d1ea46da)
enp3s0: | | | v | | en| | --> ethernet v | p3| --> bus number (3) v s0 --> slot number (0)
NetworkManager
A program for providing detection and configuration for systems to automatically connect to networks. Network management framework (daemon and userspace tools) - A GUI thing.
Network Manager has a command line tool that can be used to see which interfaces it is controlling. Pull up a terminal window and type the following command:
nmcli dev status
sample output:
# nmcli dev status DEVICE TYPE STATE CONNECTION enp0s4 ethernet connected Wired connection 1
For Ubuntu and Mint distributions (recent like 18.3 or 19.2) this is how network interfaces are configured. Network Manager settings are controlled by the configuration file: /etc/NetworkManager/NetworkManager.conf
To disable Network Manager for a specific interface: Tell Network Manager to stop controlling an interface is by adding the following lines to the /etc/NetworkManager/NetworkManager.conf file:
[main] plugins=keyfile [keyfile] unmanaged-devices=mac:00:11:22:33:44:55;mac:66:77:88:99:00:aa
Completely disable Network Manager so it does not control anything, even after reboot:
This seems to be the Redhat recommended way
sudo systemctl stop network-manager sudo systemctl mask network-manager
This seems to be the Debian/Ubuntu/Mint recommend way
sudo stop network-manager echo "manual" | sudo tee /etc/init/network-manager.override
Command Line:
The command:
sudo service NetworkManager restart
Will not restart your network service, it only restarts the networkmanager. Connection will not be interrupted by issuing this command.
The command:
systemctl --all|grep -i network
With systemd various '*.service' and '*.target' init scripts/config files are used to describe services, and you can see them running this way.
nmcli
NetworkManager from the command line.
nmcli – a command-line tool used to configure networking.
nmtui – a simple curses-based text user interface, which is also used to configure and manage newtwork interface connections.
Other tools include the nm-connection-editor, control-center, and network connection icon (all under GUI).
Usage:
nmcli [OPTIONS] OBJECT { COMMAND | help }