nameif
Assign names to network interfaces
SYNOPSIS
nameif [-c config_file] [-v] [-s] [-x] [interface...]
PARAMETERS
-c config_file
Specify an alternate configuration file instead of the default `/etc/mactab`.
-v
Enable verbose output. Shows the interface renaming process in detail.
-s
Causes nameif to check for and fix interfaces that are renamed incorrectly using the configured /etc/mactab.
-x
Exits without renaming any interfaces; only displays the proposed renames. It's useful for testing configuration.
interface...
Specify one or more specific interfaces to rename. If omitted, all interfaces are considered.
DESCRIPTION
The `nameif` command allows you to assign names to network interfaces based on their MAC addresses. This is especially useful when you have multiple network interfaces and want to ensure that they are consistently assigned specific names, regardless of the order in which they are detected during system boot. It reads configuration from the `/etc/mactab` file (or a file specified using the `-c` option). Each line in this file maps a MAC address to a desired interface name. When executed, `nameif` iterates through all network interfaces, compares their MAC addresses against the entries in `/etc/mactab`, and renames the interfaces accordingly. This persistent naming helps avoid confusion and ensures consistent network configuration.
CAVEATS
The `nameif` command is considered deprecated in favor of more modern methods for network interface naming, such as systemd's predictable network interface names and udev rules. While it may still function on some systems, its usage is discouraged for new configurations. The `/etc/mactab` file format is simple but can become difficult to manage with a large number of interfaces.
/ETC/MACTAB FILE FORMAT
The `/etc/mactab` file consists of lines with the format: HWADDR interface_name
For example: 00:11:22:33:44:55 eth0
HISTORY
The `nameif` command was historically used to provide a simple mechanism for assigning persistent names to network interfaces based on their MAC addresses. It predates the more complex and flexible systems that are now widely used. Development ceased as more robust methods emerged and the need for the command has decreased.