IPMITOOL是一种可用在 Linux/Unix 系统下的基于命令行方式的 ipmi 平台管理工具。利用它可以实现获取传感器的信息、显示系统日志内容、网络远程开关机等功能。其主要功能包括读取和显示传感器数据(SDR),显示System Evernt Log(SEL)的内容,显示打印Field Replaceable Unit(FRU)信息,读取和设置BMC模块的LAN配置,远程控制服务器主机的电源。
开关机,重启
1. 查看开关机状态:
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) power status |
2. 开机:
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) power on |
3. 关机:
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) power off |
4. 重启:
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) power reset |
用户管理
[ChannelNo] 字段是可选的,ChannoNo为1或者8;
BMC默认有2个用户:user id为1的匿名用户,user id为2的ADMIN用户;
<>字段为必选内容;<privilege level>
2为user权限,3为Operator权限,4为Administrator权限;
1. 查看用户信息
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) user list [ChannelNo] |
2. 增加用户
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) user set name <user id> <username> |
3. 设置密码
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) user set password <user id> <password> |
4. 设置用户权限
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) user priv <user id> <privilege level> [ChannelNo] |
5. 启用/禁用用户
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) user enable/disable <user id> |
Watchdog配置
1. 查看当前的watchdog信息
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) mc watchdog get |
2. 设置,开启watchdog
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) mc watchdog get |
设置一个OS WDT的watchdog, 超时时间为60秒(自己看IPMI 2.0手册,351页的27.6 Set Watchdog Timer Command)(60x10=600 = 0x258)
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) raw 0x06 0x24 0x04 0x01 0x00 0x10 0x58 0x2 |
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) mc watchdog get |
开启该watchdog
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) mc watchdog reset |
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) mc watchdog get |
禁止watchdog动作(Hard reset-> no action)
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) raw 0x06 0x24 0x04 0x00 0x00 0x10 0x58 0xFF |
上面的命令把时间改为非常大,提示第1个0x00表示没有动作,0x04表示是SMS/OS的watchdog, 0xFF58是超时的时间,单位为100ms。
IP网络设置
[ChannelNo] 字段是可选的,ChannoNo为1(Share Nic网络)或者8(BMC独立管理网络);
设置网络参数,必须首先设置IP为静态,然后再进行其他设置;
1. 查看网络信息
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) lan print [ChannelNo] |
2. 修改IP为静态还是DHCP模式
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) lan set <ChannelNo> ipsrc <static/dhcp> |
3. 修改IP
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) lan set <ChannelNo> ipaddr <IPAddress> |
4. 修改子网掩码
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) lan set <ChannelNo> netmask <NetMask> |
5. 修改默认网关
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) lan set <ChannelNo> defgw ipaddr <默认网关> |
SOL功能
<9.6/19.2/38.4/57.6/115.2>其中115.2代表115200,即*1000是表示的波特率。
1. 设置SOL串口波特率
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) sol set volatile-bit-rate <9.6/19.2/38.4/57.6/115.2> |
2. 打开SOL功能
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) sol activate |
3. 关闭SOL功能
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) sol deactivate |
SEL日志查看
1. 查看当前的SEL summary信息
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) sel |
2. 列示所有SEL记录详细信息
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) sel list |
3. 删除指定的SEL记录
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) sel delete 1 |
4. 清除所有的SEL记录
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) sel clear |
5. 获取和修改SEL当前时钟
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) sel time get |
6. 以RAW方式查看制定的SEL数据
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) raw 0xa 0x43 0 0 111 0 0 0xFF |
0xa 0x43为Get SEL Entry Command; 0 0 保留值,111 0 表示取第112条记录(从0开始),0 为offset,保留;0xFF为读取的字节数,FF表示取整条记录
FRU信息查看
1. 查看FRU信息
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) fru list |
SDR,Sensor信息查看
1. 查看SDR Sensor信息
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) sdr |
2. 查看Sensor信息
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) sensor list |
mc状态和控制
1. 重启动BMC
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) mc reset <warm/cold> |
设置BMC的iptables防火墙
1. 设置某一段IP可以访问BMC
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) raw 0x32 0x76 0x01 0x01 ip1(0xa 0xa 0xa 0xa) ip2(0xb 0xb 0xb 0xb) |
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) raw 0x32 0x76 0x09 |
2. 设置某个IP可以访问BMC
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) raw 0x32 0x76 0x00 0x01 ip1(0xa 0xa 0xa 0xa) |
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) raw 0x32 0x76 0x09 |
3. 取消设置
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) raw 0x32 0x76 0x08 |
4.获取防火墙设置
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) raw 0x32 0x77 0x01 0x00 |
5. 阻止/开启某个端口
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) raw 0x32 0x76 0x02 0x00/0x01 0x00 (portno)0x22 0x00 |
6. 取消某个端口的设置(6是5的对应取消操作)
ipmitool -H (IP) -I lanplus -U (用户) -P (密码) raw 0x32 0x76 0x06 0x00/0x01 0x00 (portno)0x22 0x00 |
附录
ipimitool 使用规则:ipmitool [options...] <command>
参数
参数 | 描述 |
---|---|
-h | 帮助 |
-V | 显示版本信息 |
-v | 详细(可以使用多次) |
-c | 以逗号分隔格式显示输出 |
-d | 指定要使用的/ dev / ipmiN设备(默认值= 0) |
-I | 要使用的接口 |
-H | LAN接口的远程主机名 |
-p | 远程RMCP端口[默认= 623] |
-U | 远程会话用户 |
-f | 从文件读取远程会话密码 |
-z | 通信通道(OEM)的尺寸更改大小 |
-S | 使用本地文件进行远程SDR缓存 |
-D | ttyb[:s]指定要使用的串行设备,波特率并且可选地指定该接口是系统接口 |
-a | 提示输入远程密码 |
-Y | 提示用于IPMIv2身份验证的Kg密钥 |
-e | 设置SOL转义字符 |
-C | 加密套件将被lanplus接口使用 |
-k | 使用Kg键进行IPMIv2身份验证 |
-y | 使用十六进制编码的Kg密钥进行IPMIv2身份验证 |
-L | 远程会话权限[默认=管理员] 附加一个’+’以在RAKP1中使用名称/特权查找 |
-A | 强制使用auth type NONE,PASSWORD,MD2,MD5或OEM |
-P | 远程会话密码 |
-E | 从IPMI_PASSWORD环境变量读取密码 |
-K | 从IPMI_KGKEY环境变量中读取kgkey |
-m | 设置本地IPMB地址 |
-b | 通道为桥接请求设置目标通道 |
-t | 将桥接请求发送到远程目标地址 |
-B | 为桥接请求设置传输通道(双桥) |
-T | 设置桥接请求的传输地址(双桥) |
-l | 设置原始命令的目的地lun |
-o | OEM设置(使用’list’查看可用的OEM类型) |
-O | 将文件用于OEM SEL事件描述 |
-N | 指定lan [default = 2] / lanplus [default = 1]接口的超时时间 |
-R | 设置lan / lanplus接口的重试次数[默认= 4] |
Interfaces
接口 | 描述 |
---|---|
open | Linux OpenIPMI Interface [default] |
imb | Intel IMB Interface |
lan | IPMI v1.5 LAN Interface |
lanplus | IPMI v2.0 RMCP+ LAN Interface |
serial-terminal | Serial Interface, Terminal Mode |
serial-basic | Serial Interface, Basic Mode |
Commands
命令 | 描述 |
---|---|
raw | Send a RAW IPMI request and print response |
i2c | Send an I2C Master Write-Read command and print response |
spd | Print SPD info from remote I2C device |
lan | Configure LAN Channels |
chassis | Get chassis status and set power state |
power | Shortcut to chassis power commands |
event | Send pre-defined events to MC |
mc | Management Controller status and global enables |
sdr | Print Sensor Data Repository entries and readings |
sensor | Print detailed sensor information |
fru | Print built-in FRU and scan SDR for FRU locators |
gendev | Read/Write Device associated with Generic Device locators sdr |
sel | Print System Event Log (SEL) |
pef | Configure Platform Event Filtering (PEF) |
sol | Configure and connect IPMIv2.0 Serial-over-LAN |
tsol | Configure and connect with Tyan IPMIv1.5 Serial-over-LAN |
isol | Configure IPMIv1.5 Serial-over-LAN |
user | Configure Management Controller users |
channel | Configure Management Controller channels |
session | Print session information |
dcmi | Data Center Management Interface |
sunoem | OEM Commands for Sun servers |
kontronoem | OEM Commands for Kontron devices |
picmg | Run a PICMG/ATCA extended cmd |
fwum | Update IPMC using Kontron OEM Firmware Update Manager |
firewall | Configure Firmware Firewall |
delloem | OEM Commands for Dell systems |
exec | Run list of commands from file |
set | Set runtime variable for shell and exec |
hpm | Update HPM components using PICMG HPM.1 file |
ekanalyzer | run FRU-Ekeying analyzer using FRU files |
ime | Update Intel Manageability Engine Firmware |