Linux easy way to extract MAC address per device

linuxmac addressnetworkingsystemd

I am dealing with post systemd crapstorm where devices get renamed to eno1,2,3 or sometimes rename1,2,3. I don't run systemd as init system but unfortunately udevd is that systemd infected garbage what is broken now so it won't do much good adding /etc/systemd/network/*.link files.

I need a simple way to extract the device name eg eno1 for a mac address.

This would be possible with:

ip a

ifconfig -a

but is there a more convenient way from getting this info right out of the proc file system? So whatever the interface gets renamed I can always rename it back to eth0 and eth1. I also want to run this distro on a great variety of servers so this check list must be extensible by device mac ids.

Best Answer

You can easily get the MAC address of an interface using:

cat /sys/class/net/eth0/address