# 获取bmc基本信息
esxcli hardware ipmi bmc get
安装ipmitool
下载地址:https://vswitchzero.files.wordpress.com/2019/08/ipmitool-esxi-vib-1.8.11-2.zip
备用地址:https://sreok.cn/upload/ipmitool-esxi-vib-1.8.11-2.zip
# 安装
esxcli software acceptance set --level=CommunitySupported
esxcli software vib install -v /tmp/ipmitool-1.8.11-2.x86_64.vib
简单使用
# 修改密码
[root@localhost:/tmp] /opt/ipmitool/ipmitool user list 1
ID Name Callin Link Auth IPMI Msg Channel Priv Limit
2 USERID false false true ADMINISTRATOR
[root@localhost:/tmp] /opt/ipmitool/ipmitool user set password 2 Passw0rd
# 修改网络
[root@localhost:/tmp] /opt/ipmitool/ipmitool lan set 1 ipsrc static
[root@localhost:/tmp] /opt/ipmitool/ipmitool lan set 1 ipaddr 192.168.3.16
Setting LAN IP Address to 192.168.3.16
[root@localhost:/tmp] /ipmitool lan set 1 netmask 255.255.255.0
Setting LAN Subnet Mask to 255.255.255.0
[root@localhost:/tmp] /ipmitool lan set 1 defgw ipaddr 192.168.3.1
Setting LAN Default Gateway IP to 192.168.3.1
更多操作
# 常用操作
#查看ipmitool版本
/opt/ipmitool/ipmitool -V
#查看bmc版本
/opt/ipmitool/ipmitool mc info
#使BMC重新启动:
/opt/ipmitool/ipmitool mc reset <warm|cold> #warm表示软重启;cold表示硬重启
#----------------------------------------------------------------
# ipmitool管理服务器
#查看服务器状态
/opt/ipmitool/ipmitool chassis power status
#服务器开机
/opt/ipmitool/ipmitool chassis power on
#服务器关机
/opt/ipmitool/ipmitool chassis power off
#服务器重启
/opt/ipmitool/ipmitool chassis power reset
#----------------------------------------------------------------
#ipmitool 配置ip
#说明:[ChannelNo] 字段是可选的,ChannoNo为1(Share Nic网络)或者8(BMC独立管理网络);设置网络参数,必须首先设置IP为静态,然后再进行其他设置;
#查看ip配置:
/opt/ipmitool/ipmitool lan print [ChannelNo]
#修改IP为静态还是DHCP模式
/opt/ipmitool/ipmitool lan set <ChannelNo> ipsrc<static/dhcp>
#修改ip地址:
/opt/ipmitool/ipmitool lan set <ChannelNo> ipaddr <IPAddress>
#修改子网掩码:
/opt/ipmitool/ipmitool lan set <ChannelNo> netmask <NetMask>
#修改默认网关:
/opt/ipmitool/ipmitool lan set <ChannelNo> defgw ipaddr <Gateway >
#配置示例:
/opt/ipmitool/ipmitool lan set 1 ipsrc static
/opt/ipmitool/ipmitool lan set 1 ipaddr 192.168.2.60
/opt/ipmitool/ipmitool lan set 1 netmask 255.255.0.0
/opt/ipmitool/ipmitool lan set 1 defgw ipaddr 192.168.2.1
#----------------------------------------------------------------
#查看配置:
/opt/ipmitool/ipmitool lan print 1
#注:目前使用的服务器型号(浪潮、戴尔等),ChannoNo均为1,ipmi独立于操作系统而存在,控制服务器的开关机等
#/opt/ipmitool/ipmitool lan print 1 报错解决方案
解决方案:
1、查看系统是否已经加载IPMI模块:lsmod | grep ipmi
2、加载模块modprobe ipmi_msghandler
modprobe ipmi_devintf
modprobe ipmi_si
3、再次执行查询命令:查看有无报错
#----------------------------------------------------------------
# ipmitool 管理用户权限
说明:[ChannelNo] 字段是可选的,ChannoNo为1、2或8;BMC默认有2个用户:user id为1的匿名用户,user id为2的admin用户;<>字段为必选内容;<privilege level>:2为User权限,3为Operator权限,4为Administrator权限
#查看用户信息:
/opt/ipmitool/ipmitool user list [ChannelNo]
#添加用户:
/opt/ipmitool/ipmitool user set name <user id> <username>
#查看用户权限:
/opt/ipmitool/ipmitool channel getaccess [ChannelNo] <user id>
#设置用户权限:
/opt/ipmitool/ipmitool channel setaccess [ChannelNo] <user id>[callin=on|off] [ipmi=on|off] [link=on|off] [privilege=level]
#privilege的值定义如下;
1 callback
2 user
3 operator
4 administrator
5 OEM
#示例
#ipmitool channel setaccess 1 3 callin=off ipmi=on link=notallow=4
#设置用户密码:
/opt/ipmitool/ipmitool user set password <user id> <password>
#示例
#/opt/ipmitool/ipmitool user set password 3 123456
#启用/禁用用户
/opt/ipmitool/ipmitool user enable/disable <user id>
#----------------------------------------------------------------
# 重置
/opt/ipmitool/ipmitool bmc reset <warm|cold>
/opt/ipmitool/ipmitool mc reset <warm|cold>