工具介绍
功能描述
智能平台管理接口工具,访问 BMC 时使用。(该文档介绍的工具使用时,需 BMC 支持 IPMI v2.0 协议)
工具安装
安装环境
Ubuntu & Windows
安装方法
### Ubuntu
~$ sudo apt-get install ipmitool
### Windows
网页下载 ipmitool.exe
基本配置
- 配置命令别名
### 带外 ipmi 便捷指令
~$ vim .bashrc
## 文档后面追加如下内容
alias ipmi='ipmitool -H 192.168.4.3 -U admin -P admin -I lanplus'
~$ source .bashrc
工具使用
Linux 终端命令
- non-open bmc
~$ ipmitool -V //查看工具版本信息
~$ ipmitool -h //查看帮助信息
~$ ipmitool mc info //带内查看BMC信息,带内命令无需添加BMC IP、用户名、密码等参数
~$ ipmitool -H 192.168.4.3 -U admin -P admin -I lanplus mc info //带外查看BMC信息 (~$ ipmi mc info)
// -H : BMC IP
// -U : BMC User Name
// -P : BMC User Password
~$ ipmitool chassis status //获取系统主机状态
~$ ipmitool chassis power status //获取系统主机开关机状态 (~$ ipmitool power status)
~$ ipmitool power on //开机
~$ ipmitool power off //关机
~$ ipmitool sdr elist //查看 SDR 信息
~$ ipmitool sdr elist all //查看所有 SDR 信息 (包含隐藏sensor)
~$ ipmitool sel elist //查看 SEL 信息
~$ ipmitool sel elist -v //查看 SEL 详细信息,可查看 3 byte EventData raw data
~$ ipmitool sensor list //查看 sensor 信息,可查看 sensor threshold
~$ ipmitool fru //查看 FRU 信息
~$ ipmitool fru print 0 //查看指定 Device ID (0) 的 FRU 信息
~$ ipmitool user list //查看用户信息
### 添加一个用户
~$ ipmitool user set name 4 test4 //添加用户名
~$ ipmitool user set password 4 test1234567890 //添加用户密码 (可能有长度限制)
~$ ipmitool user priv 4 4 //添加用户权限
~$ ipmitool user enable 4 //启用用户
~$ ipmitool channel setaccess 1 4 callin=off ipmi=on link=off //添加用户通道权限
~$ ipmitool lan print 1 //查看专有网口网络信息 (dedicated nic)
~$ ipmitool -I lanplus -U root -P 0penBmc -H 192.168.33.124 -C 17 hpm upgrade image.hpm force // BMC 更新(hpm fw)
~$ ipmitool raw 6 2 //BMC cold reset (raw data 命令,其他命令详细描述可参考 IPMI Spec)
~$ ipmitool raw 0x06 0x46 1 | xxd -r -p && echo '' //命令返回 raw data 转换为字符串
- openbmc
### WSL2-Ubuntu 虚拟机对 Qemu BMC 下 ipmitool 命令 (ipmitool version 1.8.18)
$ ipmitool -I lanplus -U root -P 0penBmc -H 127.0.0.1 -p 6233 -C 17 mc info
// -p : port (default 623) ,在 qemu 启动时映射为 6233
// -C : Cipher Suite (IPMI Spec 22.15.2, default 3)
Windows 终端命令
- non-open bmc
> ipmitool.exe -I ms mc info // 带内 Windows 系统使用 ipmitool 工具(服务器搭载 Windows 系统)
> ipmitool.exe -H 192.168.4.3 -U admin -P admin -I lanplus mc info //带外查看BMC信息
- openbmc
### Windows PowerShell 对 WSL2-Ubuntu 中 Qemu BMC 下 ipmitool 命令 (ipmitool version 1.8.18)
### BMC IP 与 WSL-Ubuntu 虚拟机 IP 一致
> ipmitool.exe -I lanplus -U root -P 0penBmc -H 172.20.88.121 -p 6233 -C 17 mc info
raw 命令
~$ ipmitool raw 0 2 0 //强制关机(长拉GPIO)
~$ ipmitool raw 0 2 5 //正常关机(给Host一个关机信号,Host自己做关机操作)
### IPMI 标准命令模拟测试 SEL 告警功能
~$ ipmitool raw 0x04 0x27 0x11 //查看某个阈值传感器的阈值(sensor number 0x11)
~$ ipmitool raw 0x04 0x26 0x11 0x08 0 0 0 0x10 0 0 //修改某个阈值传感器的阈值,模拟触发 UNC 告警
~$ ipmitool raw 0x04 0x26 0x11 0x08 0 0 0 0x46 0 0 //修改某个阈值传感器的阈值,模拟恢复 UNC 告警
~$ ipmitool raw 0x0a 0x44 0x01 0x00 0x02 0 0 0 0 0x20 0 0x04 0x0c 0x90 0x6f 0x00 0xff 0xff //手动添加sel (memory ECC)
### IPMI Cmd 'Get System Boot Options'
~$ ipmitool raw 0 9 5 0 0
### 修改 BMC MAC Address
~$ ipmitool raw 0x0c 1 1 5 0x10 0x20 0x30 0x40 0x50 0xa0
上述只是一小部分 ipmi raw 命令的使用,更多命令详情请查看 IPMI Spec