ipmitool是与服务器BMC连接的工具,是服务器运维管理不可或缺的工具,支持执行的方式有raw和明文两种,标准raw命令如下:
IPM Device “Global” Commands |
NetFn |
Cmd |
Get Device ID |
App 06h |
01h |
Cold Reset |
App 06h |
02h |
Get Self Test Results |
App 06h |
04h |
Get Device GUID |
App 06h |
08h |
BMC Watchdog Timer Commands |
NetFn |
Cmd |
Reset Watchdog Timer |
App 06h |
22h |
Set Watchdog Timer |
App 06h |
24h |
Get Watchdog Timer |
App 06h |
25h |
BMC Device and Messaging Commands |
NetFn |
Cmd |
Set BMC Global Enables |
App 06h |
2Eh |
Get BMC Global Enables |
App 06h |
2Fh |
Clear Message Flags |
App 06h |
30h |
Get Message Flags |
App 06h |
31h |
Get Message |
App 06h |
33h |
Send Message |
App 06h |
34h |
Get System GUID |
App 06h |
37h |
Get Channel Authentication Capabilities |
App 06h |
38h |
Close Session |
App 06h |
3Ch |
Set Channel Access |
App 06h |
40h |
Get Channel Access |
App 06h |
41h |
Get Channel Info |
App 06h |
42h |
Set User Access Command |
App 06h |
43h |
Get User Access Command |
App 06h |
44h |
Set User Name Command |
App 06h |
45h |
Get User Name Command |
App 06h |
46h |
Set User Password Command |
App 06h |
47h |
Activate Payload |
App 06h |
48h |
Deactivate Payload |
App 06h |
49h |
Get Payload Activation Status |
App 06h |
4Ah |
Get Payload Instance Info |
App 06h |
4Bh |
Set User Payload Access |
App 06h |
4Ch |
Get User Payload Access |
App 06h |
4Dh |
Get Channel Payload Support |
App 06h |
4Eh |
Get Channel Payload Version |
App 06h |
4Fh |
Get Channel Cipher Suites |
App 06h |
54h |
Suspend/Resume Payload Encryption |
App 06h |
55h |
Set Channel Security Keys |
App 06h |
56h |
Get System Interface Capabilities |
App 06h |
57h |
Set System Info Parameters |
App 06h |
58h |
Get System Info Parameters |
App 06h |
59h |
Chassis Device Commands |
NetFn |
Cmd |
Get Chassis Capabilities |
Chassis 00h |
00h |
Get Chassis Status |
Chassis 00h |
01h |
Chassis Control |
Chassis 00h |
02h |
Chassis Identify |
Chassis 00h |
04h |
Set Front Panel Button Enables |
Chassis 00h |
0Ah |
Set Chassis Capabilities |
Chassis 00h |
05h |
Set Power Restore Policy |
Chassis 00h |
06h |
Set Power Cycle Interval |
Chassis 00h |
0Bh |
Get System Restart Cause |
Chassis 00h |
07h |
Set System Boot Options |
Chassis 00h |
08h |
Get System Boot Options |
Chassis 00h |
09h |
Event Commands |
NetFn |
Cmd |
Set Event Receiver |
S/E 04h |
00h |
Get Event Receiver |
S/E 04h |
01h |
Platform Event (a.k.a. “Event Message”) |
S/E 04h |
02h |
Sensor Device Commands |
NetFn |
Cmd |
Get Device SDR Info |
S/E 04h |
20h |
Get Device SDR |
S/E 04h |
21h |
Reserve Device SDR Repository |
S/E 04h |
22h |
Set Sensor Hysteresis |
S/E 04h |
24h |
Get Sensor Hysteresis |
S/E 04h |
25h |
Set Sensor Threshold |
S/E 04h |
26h |
Get Sensor Threshold |
S/E 04h |
27h |
Set Sensor Event Enable |
S/E 04h |
28h |
Get Sensor Event Enable |
S/E 04h |
29h |
Re-arm Sensor Events |
S/E 04h |
2Ah |
Get Sensor Event Status |
S/E 04h |
2Bh |
Get Sensor Reading |
S/E 04h |
2Dh |
Get Sensor Type |
S/E 04h |
2Fh |
FRU Device Commands |
NetFn |
Cmd |
Get FRU Inventory Area Info |
Storage 0Ah |
10h |
Read FRU Data |
Storage 0Ah |
11h |
Write FRU Data |
Storage 0Ah |
12h |
SDR Device Commands |
NetFn |
Cmd |
Get SDR Repository Info |
Storage 0Ah |
20h |
Get SDR Repository Allocation Info |
Storage 0Ah |
21h |
Reserve SDR Repository |
Storage 0Ah |
22h |
Get SDR |
Storage 0Ah |
23h |
Partial Add SDR |
Storage 0Ah |
25h |
Delete SDR |
Storage 0Ah |
26h |
Clear SDR Repository |
Storage 0Ah |
27h |
Get SDR Repository Time |
Storage 0Ah |
28h |
Set SDR Repository Time |
Storage 0Ah |
29h |
Enter SDR Repository Update Mode |
Storage 0Ah |
2Ah |
Exit SDR Repository Update Mode |
Storage 0Ah |
2Bh |
Run Initialization Agent |
Storage 0Ah |
2Ch |
SEL Device Commands |
NetFn |
Cmd |
Get SEL Info |
Storage 0Ah |
40h |
Get SEL Allocation Info |
Storage 0Ah |
41h |
Reserve SEL |
Storage 0Ah |
42h |
Get SEL Entry |
Storage 0Ah |
43h |
Add SEL Entry |
Storage 0Ah |
44h |
Clear SEL |
Storage 0Ah |
47h |
Get SEL Time |
Storage 0Ah |
48h |
Set SEL Time |
Storage 0Ah |
49h |
LAN Device Commands |
NetFn |
Cmd |
Set LAN Configuration Parameters |
Transport 0Ch |
01h |
Get LAN Configuration Parameters |
Transport 0Ch |
02h |
Serial/Modem Device Commands |
NetFn |
Cmd |
Set SOL Configuration Parameters |
Transport 0Ch |
21h |
Get SOL Configuration Parameters |
Transport 0Ch |
22h |
格式是ipmitool raw <netfn> <cmd> <data1> <data2> ....
如Get Deivce ID就是ipmitool raw 0x06 0x01
明文执行的命令如下
命令集 |
命令行格式 |
命令行说明 |
User |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> user summary |
查询用户概要信息 |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> user list |
查询BMC上所有用户 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> user set name <用户ID> <用户名> |
设置用户名 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> user set password <用户ID> <密码> |
设置用户密码 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> user enable <用户ID> |
使用用户 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> user disable <用户ID> |
禁用用户 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> user priv <用户ID> <级别> |
设置用户权限 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> user test <16|20> <密码> |
用户密码测试 |
|
Channel |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> channel info <channel> |
获取通道信息 |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> channel authcap <channel number> <max privilege> |
获取通道认证鉴权能力 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> channel getaccess <channel number> [user id] |
获取用户权限信息 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> channel setaccess <channel number> [user id] [privilege=level] |
设置用户权限信息 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> channel getciphers <ipmi|sol> <channel> |
获取通道的加密法套件 |
|
Lan |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> lan print 1 |
打印Lan参数配置信息 |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> lan set <channel> ipaddr <...> |
设置通道IP地址 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> lan set <channel> netmask <...> |
设置通道子掩码 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> lan set <channel> macaddr <:::::> |
设置通道mac地址 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> lan set <channel> defgw ipaddr <...> |
设置通道默认网关IP |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> lan set <channel> snmp <团体名> |
设置snmp团体名 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> lan set <channel> access <on> |
通道对于IPMI消息的访问模式 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> lan set <channel> vlan id <off|<id>> |
使能、禁用虚拟局域网(Virtual Local Area Network),设置ID |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> lan set <channel> auth <level> <type,..> |
设置通道认证类型 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> lan alert print <channel number> <alert destination> |
打印告警信息 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> lan alert set <channel number> <alert destination> ipaddr <x.x.x.x> |
设置告警ip地址 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> lan alert set <channel number> <alert destination> macaddr <x:x:x:x:x:x> |
设置告警mac地址 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> lan alert set <channel number> <alert destination> type <pet|oem1> |
设置目的地址类型,PET或者OEM |
|
SOL |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sol info |
显示SOL参数配置信息 |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sol activate |
建立SOL会话 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sol deactivate |
去激活SOL会话 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sol set enabled <true|false> <channel> |
设置SOL通道1使能状态 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sol set set-in-progress <set-complete|set-in-progress|commit-write> |
设置SOL参数状态 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sol set force-encryption <true|false> |
设置SOL负载是否强制加密 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sol set force-authentication <true|false> |
设置SOL负载是否强制认证 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sol set privilege-level <user|operator|admin|oem> |
设置建立SOL会话的最低权限级别 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sol set character-accumulate-level <level> |
设置SOL字符发送间隔,一个单位为5ms |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sol set character-send-threshold <bytes> |
设置SOL字符门限(32字节) |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sol set retry-count <count> |
设置SOL重发次数 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sol set retry-interval <interval> |
设置SOL重发时间间隔(一个单位为10ms) |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sol payload <enable|disable> <channel> <用户ID> |
设置用户对负载的访问权限(和命令参数名不一致) |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sol looptest <loop-times> <loop-interval> |
SOL连接压力测试 |
|
BMC |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> mc reset <warm|cold> |
BMC执行热(冷)复位 |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> mc guid |
查询BMC guid信息 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> mc info |
查询BMC的版本信息 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> mc watchdog <get|reset|off> |
设置和查询BMC看门狗状态 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> mc selftest |
查询BMC自测试结果 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> mc getenables |
显示目前BMC已经使能的选项的信息 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> mc setenables <system_event_log|event_msg|event_msg_intr|oem0|oem1|oem2> <on|off> |
设置BMC使能的选项的信息 |
|
Chassis |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> chassis status |
获取设置底板电源状态信息 |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> chassis power <status|on|off|reset|cycle|soft> |
设置底板电源状态 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> chassis identify |
控制前插板指示灯亮 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> chassis policy <list|always-on|always-off|previous> |
设置单板底板在上电失败后的处理方案 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> chassis restart_cause |
查询单板最后一次重起的原因 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> chassis bootdev <none|pxe|disk|cdrom|floppy> |
设置单板下一次启动的启动顺序 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> chassis bootparam set bootflag <force_pxe|force_disk|force_cdrom|force_bios> |
● |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> chassis selftest |
● |
|
Event |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> event <1|2|3> |
发送预先定义好的系统事件的编号给单板,可以支持以下3种事件: ● 温度过高告警 ● 电压过低告警 ● 内存ECC错误 |
FRU |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> fru |
查询FRU等制造信息 |
SDR |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sdr info |
查询SDR的相关信息 |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sdr list <all|full|compact|event|mcloc|fru|generic> |
获取传感器信息 |
|
SEL |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sel info |
显示日志的相关信息 |
ipmitoo -H ... -I lanplus -U <用户名> -P <密码> sel clear |
清除BMC上的SEL |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sel list |
按照指定格式显示日志信息 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sel get <id> |
显示某一条日志 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sel save <filename> |
将日志保存到文件 |
|
Sensor |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> sensor list |
查询传感器信息 |
Power |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> power status |
查询电源状态 |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> power on |
上电 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> power off |
下电 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> power cycle |
循环上下电 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> power reset |
复位 |
|
ipmitool -H ... -I lanplus -U <用户名> -P <密码> raw <netfn> <cmd> [data] |
● |
|
Raw |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> raw <netfn> <cmd> [data] |
发送原始命令 |
REF |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> pef <info| status |policy |list> |
● |
Session |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> session info <active> |
获取有关当前活动会话的用户的信息 |
Exec |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> exec <filename> |
● |
Set |
ipmitool -H ... -I lanplus -U <用户名> -P <密码> shell |
● |
如启用某BMC用户:ipmitool user enable <userid>
userid就是ipmitool user list <channel> |grep "<username>" 返回的第一列
除了以上raw和明文的方式区别外,还存在远程执行、本地执行两种方式,如
本地执行启用某BMC用户:ipmitool user enable <userid>
远程执行启用某BMC用户:ipmitool -H <BMCIP> -I lanplus -U <BMCUSER> -P <BMCPASS> user enable <userid>
差别是本地执行需要ssh登陆目标机器,root下执行
而远程执行需要连接目标机器BMCIP的UDP 623端口,且有正确的BMC用户和BMC密码
以下是常用的一些命令
ipmitool mc reset cold 重启BMC
ipmitool chassis power cycle 下电机器再上电
ipmitool sel elist 查看BMC SEL事件
ipmitool sdr elist 查看BMC传感器
ipmitool lan print 查看BMC网络配置