Skip to content

Instantly share code, notes, and snippets.

@mjf
Last active November 28, 2022 10:09
Show Gist options
  • Save mjf/a965c630666a97e695f5694be67c84ba to your computer and use it in GitHub Desktop.
Save mjf/a965c630666a97e695f5694be67c84ba to your computer and use it in GitHub Desktop.
Online rename interface with Systemd Networkd and Udevd

Online rename interface with Systemd Networkd

  1. create .link file in for the interface to rename it to a name of choice:

    [Match]
    OriginalName=*
    MACAddress=<mac-address>
    
    [Link]
    Name=<new-name>

    Note: We use MAC address to match but any other match can be used too.

  2. create .network file for the newly named interface to configure:

    [Match]
    Name=<new-name>

    Note: The rest of configuration is omitted.

  3. reload Systemd configuration:

    systemctl daemon-reload
  4. rename the interface:

    udevadm trigger --type=devices --action=add
  5. reconfigure the interface

    networkctl reconfigure <new-name>

    Note: This may not be needed at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment