How to Customize a NIC Name
Using a systemd Link File
You can create a systemd link file with Ignition configs.
For example, to name NIC with the MAC address 12:34:56:78:9a:bc to "infra", place a systemd link file at /etc/systemd/network/25-infra.link using the Butane config snippet shown below:
variant: fcos
version: 1.7.0
storage:
files:
- path: /etc/systemd/network/25-infra.link
mode: 0644
contents:
inline: |
[Match]
MACAddress=12:34:56:78:9a:bc
[Link]
Name=infra
Using Udev Rules
Similarly, also through Ignition configs, to name NIC with the MAC address 12:34:56:78:9a:bc to "infra", create a udev rule at /etc/udev/rules.d/80-ifname.rules using the Butane config snippet shown below:
variant: fcos
version: 1.7.0
storage:
files:
- path: /etc/udev/rules.d/80-ifname.rules
mode: 0644
contents:
inline: |
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="12:34:56:78:9a:bc", ATTR{type}=="1", NAME="infra"
Networking in the Initramfs via Kernel Arguments
If networking in the initramfs is required, the kernel argument ifname= will dynamically create a udev rule to change the name of a NIC.
For example, to give the NIC with the MAC address 12:34:56:78:9a:bc a name of "infra", provide a ifname=infra:12:34:56:78:9a:bc kernel argument. A udev rule will be created like:
# cat /etc/udev/rules.d/80-ifname.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="12:34:56:78:9a:bc", ATTR{type}=="1", NAME="infra"
Want to help? Learn how to contribute to Fedora Docs ›