Skip to content

Instantly share code, notes, and snippets.

@DavidWittman
Last active August 17, 2023 08:05
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
  • Save DavidWittman/b7a509632ed92fccf237 to your computer and use it in GitHub Desktop.
Save DavidWittman/b7a509632ed92fccf237 to your computer and use it in GitHub Desktop.
Pull the LAN1/eth0 MAC address from SuperMicro IPMI

You can find the MAC address for LAN1/eth0 (not the BMC MAC) via the SuperMicro IPMI interface by running the following command:

$ ipmitool -U $IPMI_USER -P $IPMI_PASS -H $IPMI_HOST raw 0x30 0x21 | tail -c 18

The eth0 MAC address will be output in this format:

00 25 90 f0 be ef
@tapanswain-zz
Copy link

cool it works

@violetbp
Copy link

Just for clarity, only use the first line. its not all one line with wrapping.

@DavidWittman
Copy link
Author

Thanks @mookie1097. I just edited this Gist to avoid any confusion.

@Goorzhel
Copy link

This is pretty neat. Is there a way to get the BMC MAC via ipmitool though? I landed here from Google looking for the solution to that.

@dmick
Copy link

dmick commented Jan 17, 2017

@GA114: well, you could get it from your ARP table, but yeah, lan print will show a bunch of stuff including MAC

@Vishesh-GIT
Copy link

Vishesh-GIT commented Feb 1, 2017

not working for me on intel's S2600TP server board, giving some random number which doesn't match any of the mac

@lurkalicious
Copy link

lurkalicious commented Feb 10, 2017

To get BMC MAC:

$ ipmitool -U $IPMI_USER -P $IPMI_PASS -H $IPMI_HOST lan print | grep "MAC Address"
or
$ ipmitool -U $IPMI_USER -P $IPMI_PASS -H $IPMI_HOST raw 0x0c 0x02 0x01 0x05 0x00 0x00

@exodusftw
Copy link

anyone know if it's possible to use ipmitool to grab the additional LAN MAC addresses - for example, Lan1/2/3/4 or even pushing into non-embedded PCI-e fiber NIC's?

@boxrick
Copy link

boxrick commented Dec 5, 2017

exodusftw: And for other people looking at this in the future

raw 0x30 0x9F - will display LAN2 and any ONBOARD NICs onwards, you cannot use this method for PCI-E based NIC. Also a bit of reference here.

Hopefully help someone out in the future, had to do a little digging for this.

http://www.supermicro.co.uk/support/faqs/faq.cfm?faq=14914

@Gnossos
Copy link

Gnossos commented May 16, 2018

I found this discussion, but it took me about an hour to implement it. To save others time, here are the most important lessons:

  1. On a Supermicro motherboard, if you know the MAC address of LAN 1, just add 1 to the last byte of the address. See http://www.supermicro.com/support/faqs/faq.cfm?faq=14914. (I know, boxrick just referenced this page, but knowing the MAC addresses are sequential might save you the trouble of looking this up.)

  2. On an Apple Mac, use Homebrew to install ipmitool. Open a terminal window, and enter "brew install ipmitool". If you don't have Homebrew installed yet, use this command first:
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
    See macappstore.org/ipmitool/.

@Goorzhel
Copy link

lan print was it. Thanks, dmick and lurkalicious!

@logan2211
Copy link

Has anyone had luck pulling AOC MAC addresses? Somehow the BMC is showing them in the webpage.

ie.

BMC MAC Address: ac:1f:6b:62:e7:ca
System LAN1 MAC address :ac:1f:6b:62:ea:e8
System LAN2 MAC address :ac:1f:6b:62:ea:e9
AOC LAN1 MAC address :ac:1f:6b:81:b6:ca
AOC LAN2 MAC address :ac:1f:6b:81:b6:cb

The AOC LAN are a PCI-E NIC.

@davidcarver
Copy link

Nice! Here is a small suggestion, because I'm a lazy dog

ipmitool -U $IPMI_USER -P $IPMI_PASS -H $IPMI_HOST raw 0x30 0x21 | tail -c 18 | sed 's/ /:/g'

00:25:90:f0:be:ef

@cavus700
Copy link

cavus700 commented May 6, 2021

Does anyone know where to find some documentation about the raw hexcodes like 0x30 0x21 ?

@olivergs
Copy link

A fast search lead me to https://www.supermicro.com/support/faqs/faq.cfm?faq=25788

But right now I can't see the contents of the page.

In the search engine cache it shows this:

# ipmitool raw 0x30 0x21 // Data5-10: LAN1 MAC Address Get onboard LAN MAC Address (start from 2nd). # ipmitool raw 0x30 0x9f // Data2-7: LAN2 MAC Address // Data8-13: LAN3 MAC Address // … Note, above commands are for X10 and later generations.

There is also: https://www.supermicro.com/support/faqs/faq.cfm?faq=14914

Or, you can use ipmitool raw command "ipmitool raw 0x30 0x21" to get the system LAN1 and LAN2 MAC addresses. This command will return 10 bytes, read just the last 6 bytes and that would be the MAC address of LAN1. For LAN2, just add 1 to the last bit of the last byte from LAN1. Example: if the command returns 00 00 2b 35 00 25 b3 83 f2 9a, the ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment