On a Ubuntu system where I’m creating a VXLAN Proof of Concept with CloudStack I wanted to rename the interface enp5s0 to cloudbr0.
I found many documentation on the internet on how to do this with *.link files, but I was missing the golden tip, which was you need to re-generate your initramfs.
/etc/systemd/network/50-cloudbr0.link
[Match] MACAddress=00:25:90:4b:81:54 [Link] Name=cloudbr0
After you create this file, re-generate your initramfs:
update-initramfs -c -k all
You can now use cloudbr0 in *.network files to use it like any other network interface.
In my case this is how my interfaces look like:
1: lo:mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 6: cloudbr0: mtu 9000 qdisc fq_codel state UP group default qlen 1000 link/ether 00:25:90:4b:81:54 brd ff:ff:ff:ff:ff:ff inet 192.168.0.11/24 brd 192.168.0.255 scope global cloudbr0 valid_lft forever preferred_lft forever inet6 2a00:f10:114:0:225:90ff:fe4b:8154/64 scope global dynamic mngtmpaddr noprefixroute valid_lft 2591993sec preferred_lft 604793sec inet6 fe80::225:90ff:fe4b:8154/64 scope link valid_lft forever preferred_lft forever 8: cloudbr1: mtu 1450 qdisc noqueue state UP group default qlen 1000 link/ether 86:fa:b6:31:6e:c1 brd ff:ff:ff:ff:ff:ff inet 172.16.0.11/24 brd 172.16.0.255 scope global cloudbr1 valid_lft forever preferred_lft forever inet6 fe80::84fa:b6ff:fe31:6ec1/64 scope link valid_lft forever preferred_lft forever 9: vxlan100: mtu 1450 qdisc noqueue master cloudbr1 state UNKNOWN group default qlen 1000 link/ether 56:df:29:8d:db:83 brd ff:ff:ff:ff:ff:ff