When I run ip addr show
, this will show an interface being named enp3s0f0
or similar.
This name is assigned by udev
.
This happens after mounting the /
drive.
Thus it happens after luks
file encryption.
I wanted to make the password prompt to decrypt available over the network by installing an ssh server, dropbear, into the initramfs. Doing so requires telling dropbear what network interface to listen on, and also enabling dhcp
within initramfs. To do so, I need the network interface name.
To my surprise, nowhere could I find a way to easily see what the original name of enp3s0f0
is. If my host has many ports and is slow to boot, trial and error can be cumbersome, requiring two reboots per try.
Is there some command I can run to find this out quickly, after the renaming has already happened?
interface=$(grep -li $MACADDR /sys/class/net/*/address | cut -d/ -f5)
to get the interface name.