splashposa.blogg.se

Linux get mac address without ifconfig
Linux get mac address without ifconfig




Of course, there are cases where there isn't a hardware network card for that particular interface - virtual network drivers for virtualization and when using bridges and software switches for example.Īnd of course, the hardware may be such that you can't actually read the "original" MAC address when it has been overwritten by software, because there is only one set of registers for the MAC address itself. The only way to find the original MAC address is to use the same method the network card driver does - unfortunately, I don't believe there is a generic way to tell the driver to provide its MAC address "as provided by the hardware". Memcpy(mac, ifr.ifr_hwaddr.sa_data, IFHWADDRLEN) #include /* for the glibc version number */ I suppose it should be possible to write C code for it, below code gives my current MAC but not the original MAC: #include /* Standard I/O */ Is there any utility or command for that? How do I find the original MAC address? There must be a way to find it, because it is still burned permanently into the card, but I can't find a tool to read the burned in address. Or setting it "permanently" using /etc/sysconfig/network-scripts/ifcfg-eth0.

linux get mac address without ifconfig

I understand how to find the current MAC address using ifconfig.īut the address can be changed, say by using ifconfig eth0 hw ether uu:vv:ww:yy:xx:zz I'm trying to figure out how to find the original MAC address of an Ethernet NIC on my Linux box. Is it possible to read the MAC address from the NIC directly? I have the code below but it just reads from the layer above but not the card itself.






Linux get mac address without ifconfig