In the past, Linux network device names were easy to type and remember because they were short, such as eth0. However, these are not consistent names. You could unplug the eth0 Ethernet device and eth1 would become eth0 on the next boot. This is a problem, so learn how Linux by way of systemd has consistent network naming based on BIOS information, slot location, and MAC addresses.
- [Instructor] Traditionally, Linux device names started with eth0 for Ethernet devices and wlan0 for wireless devices. The device number was incremented for each additional device. The problem with this method is that the device numbers don't correspond to the actual locations in the computer. In the case of a server, there may be many physical network devices and the order in which they get assigned their network device numbers may not be consistent, resulting in counter-intuitive names. In Enterprise Linux 7, network device naming is handled by udev, which by default assigns names based on firmware, topology, and location information.
The advantage is that names are fully automatic, predictable and they stay fixed even if the hardware's removed or added. This allows hardware to be replaced without network cards being renamed. However, these names are not as user-friendly as the old eth0 or wlan0 names. For instance, the network device name on my Virtual Box VM is enp0s3 and my wireless card name is wlp3s0. To decipher the naming conventions, we need to look at the schemes that Systemd uses to name devices.
Scheme one names devices using firmware or BIOS-provided index numbers for onboard devices. It then goes to scheme two, which names PCI Express hotplug devices using firmware or BIOS information. Then it goes to scheme three, which names devices based on physical location of the connector of the hardware. Scheme four uses the MAC addresses of the network card to name the interface. This is not used by default, but can be utilized by the user. Scheme five uses a traditional unpredictable kernel naming scheme if all other methods fail.
If a user wants static control over device naming, they can write udev rules which will override the schemes previously mentioned. It is not recommended to disable consistent device naming, as consistent naming allows traditional names such as eth0 to be used. For manual overrides of device names, the udev script at /usr/lib/udev/rules.d/60-net.rules looks at all interface scripts in /etc/sysconfig/network-scripts for configuration files matching the network interface MAC address.
If it finds a match, it names the device according to the configuration file. In this manner, we can assign static names if we want. If an interface is renamed this way, Systemd goes with the other steps according to the schemes we discussed earlier. To understand the somewhat cryptic names, use the following rules. If the interface name starts with an en, it's an Ethernet device, if it's wl, it's a wireless device, and ww, it's a wireless wide area network device. Following the en, wl, or ww will be characters denoting its location in the system.
O if it's an onboard device, followed by the device number, such as eno1, s if it's a hotplug device, followed by the slot number. If the PCI device has multiple functions, the slot number will then be followed by the letter f and the function. For instance, if you have a PCI Express card with multiple Ethernet devices on it, it may be ens1f4. The en will be followed by an x, followed by the MAC address if it's using scheme four. The device name could be prefixed by an uppercase P, followed by the PCI domain.
This only shows if the domain is not zero. For instance, if it were an Ethernet device in PCI domain one, it could be capital P1enp5s0. Usually the uppercase P isn't necessary and the interface would be enp5s0. The lowercase p is the PCI bus number and the s is the slot number. My Virtual Box network interface device name is enp0s3, so this would be an Ethernet device in PCI bus 0, slot 3.
An Ethernet device named by MAC address would start with en followed by an x and the MAC address. A PCI hotplug Ethernet device would start with en, followed by s and the slot number, followed by f and the function number for cards that have more than one function. Be aware that many scripts call network interfaces by names such as iptables firewalls or kickstart files. If you change the name of your network interface card, you'll want to change the names in the relevant scripts. A recursive grep through all configuration files in /etc may be a good idea to find all instances of the old name, which would then need to be changed to the new name.
- Gathering network information
- Ensuring connectivity with ping
- Querying DNS servers with dig
- Changing hostname, IP address, and more
- Configuring networking
- Connecting to SSH
- Configuring SSH clients
- Authenticating and restricting access with SSH
- Optimizing SSH for speed