BMC,全称为 Baseboard Management Controller,是一种集成在服务器、计算机和网络设备等硬件系统上的专用微控制器。其主要功能是通过远程管理协议,如IPMI(Intelligent Platform Management Interface),来监控、管理和维护硬件设备,而无需直接访问物理设备。
BMC提供了多种通道来和主机通信,进而检测主机的温度、风扇转速、电压、电源和现场可替代器件。为了便于用户使用,它提供了非常丰富的命令,下面介绍一下主要的常用命令。
1.远程电源控制类
* ipmitool -I lanplus –H 10.32.228.111 –U username –P Password chassis power off
* ipmitool -I lanplus –H 10.32.228.111 –U username –P Password chassis power on
* ipmitool -I lanplus –H 10.32.228.111 –U username –P Password chassis power reset
* ipmitool -I lanplus –H 10.32.228.111 –U username –P Password chassis power cycle
(注意power cycle 和power reset的区别在于前者从掉电到上电有1秒钟的间隔,而后者是很快上电)
2.读取系统状态类
* ipmitool sensor list 显示系统所有传感器列表
* ipmitool fru list 显示系统所有现场可替代器件的列表
* ipmitool sdr list 显示系统所有SDRRepository设备列表
* ipmitool pef list 显示系统平台时间过滤的列表
3.系统日志类
* ipmitool sel elist 显示所有系统事件日志
* ipmitool sel clear 删除所有系统时间日志
* ipmitool sel delete ID 删除第ID条SEL
* ipmitool sel time get 显示当前BMC的时间
* ipmitool sel time set XXX 设置当前BMC的时间
4.启动设置类
* ipmitool chassis bootdev bios 重启后停在BIOS 菜单
* ipmitool chassis bootdev pxe 重启后从PXE启动
5.系统相关的命令
* ipmitool mc info 显示BMC版本信息
* ipmitool bmc reset cold BMC 热启动
* ipmitool bmc reset warmBMC冷启动
6.网络接口相关命令
* ipmitool lan print 1 显示channel1的网络配置信息
* ipmitool lan set 1ipaddr 10.32.2.2 设置channel1的IP地址
* ipmitool lan set 1 netmask 255.255.0.0 设置channel1的netmask
* ipmitool lan set 4 defgw ipaddr255.255.0.254 设置channel4的网关
* ipmitool lan set 2 defgw macaddr <macaddr> 设置channel2的网关mac address
* ipmitool lan set 2 ipsrc dhcp 设置channel2的ip 源在DHCP
* ipmitool lan set 3 ipsrc static 设置channel2的ip是静态获得的
7.通道相关命令
* ipmitool channel info 显示系统默认channel
* ipmitool channel authcap channel-number privilege 修改通道的优先级别
* ipmitool channel getaccess channel-number user-id 读取用户在通道上的权限
* ipmitool channel setacccess channel-number user-id callin=on ipmi=on link=onprivilege=5 // 设置用户在通道上的权限
8.看门狗相关命令
* ipmitool mc watchdog get 读取当前看门狗的设置
* ipmitool watchdog off 关掉看门狗
* ipmitool watchdog reset 在最近设置的计数器的基础上重启看门狗
9.用户管理相关命令
* ipmitool user list chan-id 显示某通道上的所有用户
* ipmitool set password <user id>[<password>] 修改某用户的密码
* ipmitool disable <user id> 禁止掉某用户
* ipmitool enable <user id> 使能某用户
* ipmitool priv <user id> <privilegelevel> [<channel number>] 修改某用户在某通道上的权限
* ipmitool test <user id> <16|20>[<password]> 测试用户
10.SOL远程控制服务器
* ipmitool -I lanplus -H x.x.x.x -U root -P password sol (de)activate
* ipmitool -I lanplus -H 10.253.210.250 -U ironic -P 'ironic@passwd' chassis bootdev bios
* ipmitool -I lanplus -H 10.253.210.250 -U ironic -P 'ironic@passwd' power reset
11.开启sol功能 1代表channel 5代表对应用户的ID
* ipmitool -I lanplus -H x.x.x.x -U root -P password user list
* ipmitool -I lanplus -H x.x.x.x -U root -P password sol set enabled true 1
* ipmitool -I lanplus -H x.x.x.x -U root -P password sol payload enable 1 5
12.浪潮机型COM设置
* 配置查看
ipmitool -I lanplus -H xxxx -U ironic -P xxx raw 0x3c 0x3b 0x09
* 设置为COM0
ipmitool -I lanplus -H xxxx -U ironic -P xxx raw 0x3c 0x3a 0x09 0x00
* 设置为COM1
ipmitool -I lanplus -H xxxx -U ironic -P xxx raw 0x3c 0x3a 0x09 0x01