Find MAC address stored in NIC firmware
Yong Huang
yong321 at yahoo.com
Fri Oct 15 20:17:41 UTC 2010
The MAC address of an Ethernet network card can be changed with ifconfig or ip command. Correct me if wrong. But I think the real hardware address stored in the NIC firmware is not changed. How do I find the real MAC address? I checked ifconfig, ip, lspci, dmidecode, /sys/class/net/..., and ethtool. Most report whatever is shown by ifconfig, which could have been altered. The only possible solution is to dump EEPROM of NIC.
For NIC using e1000 driver:
# ifconfig eth3 | grep HW
eth3 Link encap:Ethernet HWaddr 00:11:0A:56:81:B1 <-- We changed it to this earlier.
# ethtool -e eth3 | head -3 <-- dump EEPROM
Offset Values
------ ------
0x0000 00 11 0a 56 81 b0 30 05 ff ff ff ff ff ff ff ff <-- first 6 bytes are HW address 00:11:0a:56:81:b0
# ifconfig eth3 hw ether 00:11:0a:56:81:ff <-- assign an arbitrary one
# ifconfig eth3 | grep HW
eth3 Link encap:Ethernet HWaddr 00:11:0A:56:81:FF <-- ifconfig is fooled
# ethtool -e eth3 | head -3
Offset Values
------ ------
0x0000 00 11 0a 56 81 b0 30 05 ff ff ff ff ff ff ff ff <-- but firmware ignores it
# ifconfig eth3 hw ether 00:11:0a:56:81:b1 <-- temporarily change it back to what we had
# ll /sys/class/net/eth3/device/driver/ | grep module
lrwxrwxrwx 1 root root 0 Oct 14 21:29 module -> ../../../../module/e1000 <-- driver for it is e1000
# ethtool -i eth3 <-- another way to check driver
driver: e1000
version: 7.3.21-k4.1-NAPI
firmware-version: N/A
bus-info: 0000:06:01.1
For a NIC using tg3 or bnx2 driver, the command has to be `ethtool -e eth1 length <some number>', otherwise I would get "Cannot get EEPROM data: Cannot allocate memory". Then the hw address is in the data or value column starting at some offset. The command output is long so has to be saved in a file to be view'ed with vi.
Question: What's the correct way to find the original manufacturer's MAC address of an Ethernet card?
Yong Huang
More information about the redhat-list
mailing list