richmaio.blogg.se

Get mac address on linux
Get mac address on linux





On a modern GNU/Linux system you can see the available network interfaces listing the content of /sys/class/net/, for example: $ ls /sys/class/net/ How do I find it ? Also it should work on all the Linux flavours. So in this case I want the HWaddr for eth1 and not eth0.

get mac address on linux

NOTE : I have changed the values of the output. UP BROADCAST RUNNING MULTICAST MTU:123 Metric:123 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:123 it has an inet address, I even don't want one having inet6).

get mac address on linux

So is there a way I could get the MAC address for the first available interface that is Active.(i.e. Also on OS X the interface names are different.Īlso the interface eth0 may be present but is unused.

get mac address on linux

Currently all the solution mentioned for getting the MAC address always use eth0.īut what if instead of eth0 my interfaces start with eth1.







Get mac address on linux