文章目录
fence_ipmilan 这个也是ipmi工具(可以了解下,这是一套)
ipmi tool 工具用法参考文章
IPMItool 实用程序和命令摘要
http://www.opstool.com/article/199
http://www.opstool.com/article/212
http://www.opstool.com/article/194
特别说明
ipmi默认端口 udp 623
1、为什么默认的channnel是1,根据实际经验,对于Dell、Huawei、IBM的机器,channel id 为1,但是对于HP的机器往往它的channel id为2
2、实际情况比较复杂,ipmitool添加账号对于华为的服务器总是有效,对于Dell的服务器(DRAC的带外)添加的ipmi账号只适合ipmi的命令行,
3、而不适合DRAC Web登录,对于HP的机器如果iLO2,则无法用ipmitool来操作。总结一下:
IPMI 1.5规范 与 IPMI 2.0规范的不同点
#注意:ipmi卡版本不同,ipmitool带的固定参数也不一样
当启用 IPMI 1.5 会话时,IPMItool 须指定 -I lan
当启用 IPMI 2.0 会话时,IPMItool 须指定 -I lanplus
IPMI v1.5 会话不支持增强的验证和数据包加密
oracle服务器 如何启用IPMI 1.5 会话( set /SP/services/ipmi v1_5_sessions=enabled )
oracle服务器 如何启用IPMI 服务状态( set /SP/services/ipmi state=enabled )
oracle服务器 如何启用ILOM CLI, (执行下面命令后再输入 CLI 即可使用)
#ipmitool -H SP_hostname_or_IPaddress -U username -P password sunoem cli
通过IPMI 2.0规范 它可以实现获取传感器的信息、显示系统日志内容、网络远程开关机等功能
ipmitool常见用法(注意有的不是都支持)
帮助查看
ipmitool -I lanplus -H host_ip -U root -P passwd power help #电源操作可用选项
ipmitool help
电源管理(有点不支持直接跟power,前面要用classis)
chassis policy list #查看电源策略
chassis status #查看机箱电源状态
chassis power soft #关闭机箱电源(软关机,按机箱电源)
chassis power off #强制关闭机箱电源
chassis power on #打开机箱电源系统(开机)
chassis power cycle #重启机箱
chassis power reset #重启系统
power status #查看电源状态
power on #系统开机(开机)
power off #关闭系统(硬关机,直接切断电源)
power restart #重启系统(硬重启)
健康管理
sel #查看系统事件日志状态
sdr list #显示系统所有SDRRepository设备列表
fru list #显示系统FRU 所有现场可替代器件的列表
sensor list #显示系统所有传感器列表
pef list #显示系统平台时间过滤的列表
chassis selftest #显示 BMC 自检结果
sensor get /SYS/T_AMB #显示单个传感器的详细信息
系统日志/时间管理
sel list #显示事件日志
sel clear #清空事件日志
sel delete ID ##删除第ID条SEL(有的不支持)
sel time get #显示当前BMC的时间
sel time set "04/24/2020 18:44:44" #设置当前BMC的时间
chassis restart_cause #oracle服务器 查询机箱最后一次重启原因
网络设置
lan print #打印ipmi口子网络配置
lan set <ChannelNo> ipsrc <static/dhcp> #修改IP为静态还是DHCP模式
lan set <ChannelNo> ipaddr <IPAddress> #修改IP地址
lan set <ChannelNo> netmask <NetMask> #修改子网掩码
lan set <ChannelNo> defgw ipaddr <默认网关> #修改默认网关
lan set <ChannelNo> defgw macaddr <macaddr> #设置网关mac address
看门狗相关命令
mc watchdog get #读取当前看门狗的设置
watchdog off #关掉看门狗
watchdog reset #在最近设置的计数器的基础上重启看门狗
用户设置
user list #查看BMC用户列表
user set name <user id> <username> #添加用户
user set password <user id> <password> #设置密码
user enable/disable <user id> #启用/禁用用户
priv <user id> <privilegelevel> [<channel number>] #修改某用户在某通道上的权限
http://www.opstool.com/article/199 #这里介绍了如何设置用户密码
重启/重置IPMI
mc info #显示BMC版本信息
mc reset cold #重启IPMI 等于 bmc reset cold(IPMI冷重置)
mc reset warm #IPMI热启动
ipmcset -d reset #华为CLI 冷重置IPMI
启动项/引导设置
chassis bootparam set bootflag force_bios #设置为BIOS启动(测试不生效)
chassis bootparam set bootflag force_pxe #设置为PXE启动(测试不生效)
chassis bootparam set bootflag force_cdrom #设置光盘系统(测试不生效)
chassis bootparam set bootflag force_disk #设置硬盘启动(测试不生效)
chassis bootdev help #查看帮助,看有那些可以设置的启动项目
chassis bootdev pxe options=help #查看帮助,看pxe有那些可以设置选项
chassis bootdev pxe options=persistent #永久PXE启动
chassis bootdev disk options=persistent #永久硬盘启动
chassis bootdev pxe #设置下一次从pxe引导系统(非常有用)
chassis bootdev disk #设置下一次从disk引导系统
chassis bootdev cdrom #设置下一次从cdrom引导系统
强制踢掉在线用户(报错Info: SOL payload already active on another session 怎么办?)
sol deactivate #强制踢掉在线用户
ipmitool特殊用法(基于linux管理自身ipmi)
#如何查看bmc在bios中的channel号(重要:很多是基于channel号来定位的)
dmidecode -s system-manufacturer #HP服务器一般是2,其他服务器一般是1
#修改ipmi用户密码(要不要加lan都可以具体试一试,我测试dell ipmi 1.5不加lan)
#ipmitool user list 1 #这里的1表示 channel号,基本都是1,HP可能是2(有的系统不需要指定lan)
#ipmitool user set password 2 xxxx
ipmitool lan user list 1 #打印user列表
ipmitool lan user set password 2 xxxx #将user id为2的用户设置密码为xxxx(就是改密码)
#打印服务器ipmi信息
ipmitool lan print 显示网卡地址等
ipmitool sdr elist 显示电源、风扇、温度等各项传感器信息
#修改ipmi的ip地址(如何是HP服务器,通常要用set 2)
ipmitool lan set 1 ipsrc static
ipmitool lan set 1 ipaddr 192.168.3.151
ipmitool lan set 1 netmask 255.255.255.0
ipmitool lan set 1 defgw ipaddr 192.168.3.254
#展示示例
[root@node100 ~]# ipmitool lan print
Set in Progress : Set Complete
Auth Type Support : MD5
Auth Type Enable : Callback : MD5
: User : MD5
: Operator : MD5
: Admin : MD5
: OEM :
IP Address Source : Static Address
IP Address : 192.168.3.51
Subnet Mask : 255.255.255.0
MAC Address : 74:86:7a:f2:6f:4c
SNMP Community String : public
IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
BMC ARP Control : ARP Responses Enabled, Gratuitous ARP Disabled
Gratituous ARP Intrvl : 2.0 seconds
Default Gateway IP : 192.168.3.1
Default Gateway MAC : 00:00:00:00:00:00
Backup Gateway IP : 0.0.0.0
Backup Gateway MAC : 00:00:00:00:00:00
802.1q VLAN ID : Disabled
802.1q VLAN Priority : 0
RMCP+ Cipher Suites : 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
Cipher Suite Priv Max : Xaaaaaaaaaaaaaa
: X=Cipher Suite Unused
: c=CALLBACK
: u=USER
: o=OPERATOR
: a=ADMIN
: O=OEM
Bad Password Threshold : Not Available
设置BMC的iptables防火墙
1. 设置某一段IP可以访问BMC
raw 0x32 0x76 0x01 0x01 ip1(0xa 0xa 0xa 0xa) ip2(0xb 0xb 0xb 0xb)
raw 0x32 0x76 0x09
2. 设置某个IP可以访问BMC
raw 0x32 0x76 0x00 0x01 ip1(0xa 0xa 0xa 0xa)
raw 0x32 0x76 0x09
3. 取消设置
raw 0x32 0x76 0x08
4.获取防火墙设置
raw 0x32 0x77 0x01 0x00
5. 阻止/开启某个端口
raw 0x32 0x76 0x02 0x00/0x01 0x00 (portno)0x22 0x00
6. 取消某个端口的设置(6是5的对应取消操作)
raw 0x32 0x76 0x06 0x00/0x01 0x00 (portno)0x22 0x00
华为服务器如何用命令开启IPMI 的ssh服务
IPMItool工具的安装 以及启动报错解决办法
1、安装
yum install ipmitool -y
apt-get install ipmitool
2、使用
[root@localhost ~]# ipmitool sdr
Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No
such file or directory
Get Device ID command failed
Unable to open SDR for reading
需要添加如下:
[root@localhost ~]# modprobe ipmi_watchdog
[root@localhost ~]# modprobe ipmi_poweroff
[root@localhost ~]# modprobe ipmi_devintf
[root@localhost ~]# modprobe ipmi_si
[root@localhost ~]# modprobe ipmi_msghandler
3、当添加ipmi_si时,提示:
FATAL: Error inserting ipmi_si (/lib/modules/2.6.9-5.ELsmp/kernel/drivers/char/ipmi/ipmi_si.ko): No such device
这是因为机器上没有IPMI设备而出现的报错。
如果文章对你有帮助,欢迎点击上方按钮打赏作者
赞