Last active
September 1, 2019 07:19
-
-
Save jeremmfr/79f1d9492823e545fafeef8355c3ad2f to your computer and use it in GitHub Desktop.
Fix interface name order with systemd (when net.ifnames=0 biosdevname=0)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
printf "[Match]\nDriver=*802.1Q*\nDriver=*802.1Q*\nNamePolicy=kernel\n" > /etc/systemd/network/05-vlan.link | |
for if in $(udevadm info -e | grep ^P.*\/pci.*\/net\/ | rev | cut -d'/' -f1 | rev) ; do | |
mac=$(ip link show ${if} | grep ether | awk '{print $2}') | |
printf "[Match]\nMACAddress=${mac}\n\n[Link]\nMACAddressPolicy=persistent\nName=${if}\n" > /etc/systemd/network/15-${if}.link | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment