简介
ipmitool是一个实用程序,用于监视、配置和管理支持智能平台管理接口 (IPMI) 的工具,遵循ipmi协议。它是一个开源项目,项目官网:https://sourceforge.net/projects/ipmitool/,github地址:https://github.com/ipmitool/ipmitool。ipmitool最新的发行版是于2019年6月25日发布的,版本号是1.8.18,通过源码可以编译出windows、linux系统下的ipmitool工具。
下载与安装
源码编译安装
git clone https://github.com/ipmitool/ipmitool.git
cd ipmitool
./bootstrap
sudo apt-get install libreadline6-dev libtool #不执行此在configure时可能会报错
./configure --enable-intf-lan --enable-intf-lanplus
make
make install
源码编译一般是在linux编译的,在linux在可以直接在terminal下执行以上命令。在window系统下据说可以可以安装cygwin,然后通过命令编译开课,具体自行尝试,默认编译后的二进制在src下。
configure中可能会报错,如果没有在configure命令前面执行
sudo apt-get install libreadline6-dev libtool
,需要清除整个配置输出从新编译,或者从新按照顺序从头开始。如果想知道有哪些配置,可以执行
./configure -h
查看编译选项参数等配置,这里只是配置了lan、lanplus通道,其他配置可自行研究。此外,部分参数只适合Linux系统而不适合windows系统。
软件仓库安装
sudo apt install ipmitool
使用规则
ipmitool [options...] <command>
ipmitool分为本机运行和远程管理。本机运行一般是在BMC系统下运行或者linux系统下运行,可以得到本系统采集到的信息;远程访问时,是通过本机访问远程BMC系统,管理远程BMC以及获取信息等。
一般在本机运行时执行ipmitool command
命令,远程管理时执行ipmitool -I <lan/lanplus> -H <ip> -U <user> -P <passwd> command
命令。当然,本机运行是也可以使用远程管理的命令,只不过ip地址需要换成本机地址或者127.0.0.1即可。下面说明命令中options和command字段中部分参数的含义。
ipmitool -I <lan/lanplus> -H <ip> -U <user> -P <passwd> command
-h 显示帮助文档
-V 显示版本号
-v 显示调试信息,例如
-vvv
,在windows下运行时-v -v -v
,最多是3个v,显示所有调试信息。-d 指定ipmi设备“/dev/ipmiN",默认是ipmi0,本地运行时
-I 指定访问通道,一般是常用的是lan/lanplus网络接口,分别对应ipmi协议1.5和2.0,linux下默认是open。
-H 指定访问对象的IP地址,如果想指定本机则可以是127.0.0.1,也可以是实际IP地址。
-4 使用ipv4协议
-6 使用ipV4协议
-C 指定加密方式,默认是3(SHA1),如果开启了17(SHA256),需要指定为17。17的安全性更高。此外0是允许匿名访问,这样很不安全,一般需要关闭。
-U 指定访问用户名,不用户有不同的权限,一般root用户拥有最高的权限。
-P指定访问用户的密码,用于校验。
-p 指定端口号,即远程访问时的port号。
-D tty:b[: s],指定串口访问,例如
ipmitool -I serial-basic -D ttyS1:115200
-B 指定桥接转发通道,对于冗余桥来说。
-b 设置远端目标发送通道。(ipmb)
-T 指定桥接转发地址,对于冗余桥来说。
-t 设置远端目标地址。(ipmb)
-N 设置超时时间,单位是秒。lan默认是2s,lanplus是1s。
-R 设置重发次数,lan/lanplus默认是4次。
command:
lan 网络通道信息
chassis 机架(底盘)信息
event 事件信息,测试SNMP
mc BMC资深的状态信息等
sdr 传感器信息
sensor 传感器详细信息
fru 可替换单元信息
Sel 系统记录得事件log
pef 事件过滤,是否需要报警
Sol host的网络串口 ipmi 2.0
tsol/isol host的网络串口 ipmi 1.5
User 用户管理
power 电源管理
dcmi 数据管理
channel 通道管理
firewall 固件管理
shell ipmi shell
可以使用help查看每个命令的一些详细使用方式,例如ipmitool lan help
使用cmmand是借助工具对协议数据解析成可读数据,原理上所有的命令都可以通过raw <netfn> <cmd> [data ...]
执行,但是这种方式返回的是存储的data(16进制),不不是可读数据。
常用命令
这里给的是在BMC系统下有设备支持的命令,如果是远程访问BMC或者测试远程命令,可以加上“-I lanplus -H -U -P "等。
网络配置
#查看LAN配置
ipmitool lan print 1
#配置IP来源,通常为none
ipmitool lan set 1 ipsrc none | static | dhcp | bios
#配置LAN IP
ipmitool lan set 1 ipaddr <x.x.x.x>
#配置LAN子网
ipmitool lan set 1 netmask <x.x.x.x>
#配置网关
ipmitool lan set 1 defgw ipaddr <x.x.x.x>
#开启LAN访问
ipmitool lan set 1 access on
用户管理
#查看用户列表
ipmitool user list
#重命名ADMIN
ipmitool user set name 2 <name>
#重设ADMIN密码
ipmitool user set password 2 <password>
#禁用用户
ipmitool user disable 2
电源控制
ipmitool power status/on/off/reset
ipmitool chassis power status/on/off/down/up
ipmitool chassis identify
sensor
ipmitool sensor
# list 全部传感器
ipmitool sdr elist all
# 仅读取给定的传感器
ipmitool sensor reading Fan1A Fan2A Fan1B Fan2B
# 获取给定传感器的详情
ipmitool sdr get Fan1A
# 查看全部风扇的转速
ipmitool sdr type fan/temperature/volatge/current
BMC
# 查看BMC信息
ipmitool mc info
# RESET BMC
ipmitool mc reset cold/warm
ipmitool mc selftest
ipmitool mc getenables
ipmitool mc setenables
sel
#查看sel信息
ipmitool sel info
#获取BMC上的时间
ipmitool sel time get
#设置sel时间, mm/dd/yyyy hh:mm:ss
ipmitool sel time set "08/03/2012 20:06:00"
#列出sel系统事件
ipmitool sel list
ipmitool sel elist
#清除sel记录
ipmitool sel clear
fru
#显示fru
ipmitol fru
ipmitool fru print
ipmitool fru print 0
SOL
#设置SOL波特率
ipmitool sol set volatile-bit-rate <9.6/19.2/38.4/57.6/115.2>
#打开SOL
ipmitool sol active
#关闭SOL
ipmitool sol deactivate
BIOS
ipmitool chassis bootparam set bootflag force_bios
工具集合
除了ipmitool外还有Supermicro(美国超微)提供的IPMICFG、SMCIPMITool、IPMIView等工具,其中IPMIView还有有手机客户端软件。
Name | OS | Description |
---|---|---|
IPMICFG | DOS Windows Linux | IPMICFG is an in-band utility for configuring IPMI devices. |
SMCIPMITool | Linux Windows | SMCIPMITool is an out-of-band Supermicro utility that allows a user to interface with SuperBlade® systems and IPMI devices via CLI (Command Line Interface). |
IPMIView | Linux Windows | IPMIView is a GUI-based software application that allows administrators to manage multiple target systems through BMC. |
IPMIView | Android | Available on Google Play |
IPMIView | iOS | Available on Apple App Store |