How to Assign and Manage Alternate Interface Names (altnames) in Linux Using ip link

In modern Linux distributions, predictable network interface naming assigns hardware-derived identifiers such as enp3s0, ens192, or wlp2s0. While this prevents interface swapping across system reboots, these generated identifiers are cumbersome to type in daily operations, complex to manage in firewall policies, and prone to breaking automated infrastructure scripts if hardware is migrated to a different PCI slot. Historically, renaming an interface meant taking the link completely offline and altering its primary name, disrupting network traffic and conflicting with udev rules.

To resolve this limitation without sacrificing predictability, Linux kernel 5.4 and modern iproute2 introduced Alternate Interface Names (altnames). An interface can now maintain its primary systemd-assigned hardware name while simultaneously carrying multiple descriptive, human-readable aliases. Best of all, altnames can be registered dynamically while links remain fully operational and can be referenced interchangeably across all networking utilities. In this guide, we examine how to assign, inspect, and remove alternate interface names using the ip link command, and how to persist them across system boots.

What Are Linux Network Interface Altnames?

Unlike traditional interface renaming which replaces the master system identifier, altname attaches secondary alias tags directly into kernel network device memory:

  • Zero-Downtime Assignment: Altnames can be added or deleted on the fly while an interface is actively carrying production traffic without requiring link-down cycling.
  • Full Command-Line Interoperability: Once an altname is registered, all Linux networking tools—including ip addr, ip route, iptables, nftables, and tcpdump—can target the interface using either its primary identifier or any of its active altnames.
  • Multiple Semantic Aliases: A single physical adapter can carry multiple simultaneous altnames (for example, simultaneously carrying wan0, fiber-uplink, and isp-primary).

Step 1: Auditing Your Current Network Interfaces

Before assigning alternate names, list your existing network adapters to note their primary identifiers:

ip link show

You will see standard entries such as 2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> ....

Step 2: Assigning Alternate Names Using ip link property add

To assign an alternate name, use the ip link property add command followed by the target device name and the desired alias string.

For example, to attach the semantic alias wan0 to primary physical adapter enp0s31f6:

sudo ip link property add dev enp0s31f6 altname wan0

You can assign multiple alternate names to reflect different architectural roles:

sudo ip link property add dev enp0s31f6 altname primary-uplink

Step 3: Verifying and Inspecting Assigned Altnames

Once registered, alternate names appear directly in standard ip link listings:

ip link show dev enp0s31f6

Output will display the primary name followed by all attached altnames:

2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 00:1a:2b:3c:4d:5e brd ff:ff:ff:ff:ff:ff
    altname wan0
    altname primary-uplink

Step 4: Using Altnames in Everyday Networking Tasks

Once an alternate name is registered, you can treat it as a first-class network interface across any Linux administrative command:

1. Querying IP Addresses via Altname

ip addr show wan0

Linux will return the IP configuration of the underlying physical adapter seamlessly.

2. Managing Link State and Capturing Packets

You can reference the altname when bringing links up, assigning routes, or sniffing traffic with tcpdump:

# Capture packets using the alternate name
sudo tcpdump -i wan0 -n

# Send pings binding to the alternate interface
ping -I wan0 1.1.1.1

Step 5: Deleting Alternate Interface Names

If you no longer need an alias or wish to reassign a name to a different interface, delete it using ip link property del:

sudo ip link property del dev enp0s31f6 altname primary-uplink

Confirm the deletion by re-running ip link show dev enp0s31f6. The removed altname will disappear from the interface definition while leaving the connection active.

Persisting Alternate Interface Names Across System Reboots

Altnames created via the ip link property add command are maintained in ephemeral kernel memory and will vanish when the system restarts. To make them permanent, configure them via systemd-networkd or udev.

Method 1: Using systemd.link Files (Recommended)

Modern Linux systems running systemd-networkd or NetworkManager can declare persistent alternate names using custom .link files:

  1. Create a custom link configuration file in /etc/systemd/network/:
    sudo nano /etc/systemd/network/10-wan.link
  2. Define the matching hardware MAC address and desired alternate names:
    [Match]
    MACAddress=00:1a:2b:3c:4d:5e
    
    [Link]
    AlternativeNames=wan0 primary-uplink
  3. Save the file and reload systemd configuration:
    sudo systemctl restart systemd-networkd

Method 2: Using Persistent udev Rules

For Debian, Ubuntu, or RHEL distributions relying primarily on udev:

  1. Create a custom udev rule:
    sudo nano /etc/udev/rules.d/75-persistent-altname.rules
  2. Add a rule instructing udev to execute ip link whenever the device is added:
    ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="00:1a:2b:3c:4d:5e", RUN+="/usr/bin/ip link property add dev %k altname wan0"
  3. Save and exit. On every subsequent system boot, the kernel will automatically register your custom altname without delaying boot scripts.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.