ipmitool使用

ipmitool使用
ipmitool 编译命令git clone https://github.com/ipmitool/ipmitool.gitcd ipmitool git checkout tags/IPMITOOL_1_8_18 -b 1.8.18./bootstrap./configure --enable-intf-lan --enable-intf-lanplus --enable-intf-open --enable-intf-imb --enable-intf-serial --enable-intf-bmc --enable-intf-usb --enable-intf-lipmi --enable-intf-dummy --enable-ipmishell --enable-solaris-opt --enable-static CFLAGS-m64 LDFLAGS-staticesxi使用的用以下命令./configure CFLAGS-m64 LDFLAGS-static #不支持lanplus#编译后可以在esxi里面使用关键参数CFLAGS-m64 LDFLAGS-static 其他参数是用以开启相关功能esxi shell里面直接运行ipmitool 可能会提示./ipmitool: Operation not permitted# 如果不禁止就会提示-sh: ./ipmitool: Operation not permittedesxcli system settings advanced set -o /User/execInstalledOnly -i 0# 关闭安全策略允许未安装的二进制文件运行esxcli system settings advanced set -o /User/execInstalledOnly -i 1ipmitool相关命令IPMI 允许通过多个通道与 BMCBaseboard Management Controller进行通信。每个通道可以配置为不同的接口类型例如通道 0通常是本地接口允许通过系统的 IPMI 设备文件如 /dev/ipmi0进行访问。通道 1通常是网络接口允许通过 LAN 访问 BMC。不同通道可以设置不同的权限一、用户管理1、查看用户列表1.1 查看本地通道用户列表和相应权限rootubuntu:~# ipmitool user list 0ID Name Callin Link Auth IPMI Msg Channel Priv Limit1 true false false Unknown (0x00)2 ADMIN true false false Unknown (0x00)3 true false false Unknown (0x00)4 true false false Unknown (0x00)5 true false false Unknown (0x00)6 true false false Unknown (0x00)7 true false false Unknown (0x00)8 true false false Unknown (0x00)9 true false false Unknown (0x00)10 true false false Unknown (0x00)1.2 查看网络通道用户列表和相应权限rootubuntu:~# ipmitool user list 1ID Name Callin Link Auth IPMI Msg Channel Priv Limit1 true false false Unknown (0x00)2 ADMIN false false true ADMINISTRATOR3 true false false Unknown (0x00)4 true false false Unknown (0x00)5 true false false Unknown (0x00)6 true false false Unknown (0x00)7 true false false Unknown (0x00)8 true false false Unknown (0x00)9 true false false Unknown (0x00)10 true false false Unknown (0x00)ipmi允许创建10个用户每个用户可以在不同通道设置不同权限2、添加用户(因为只能有10个用户所以这里相当于给指定ID用户修改用户名和密码)User Commands:summary [channel number]list [channel number]set name user id usernameset password user id [password 16|20]disable user idenable user idpriv user id privilege level [channel number]Privilege levels:* 0x1 - Callback* 0x2 - User* 0x3 - Operator* 0x4 - Administrator* 0x5 - OEM Proprietary* 0xF - No Access1、修改用户名:(这里的3表示ID为3的用户账号是通用的不需要区分通道)ipmitool user set name 3 test2、修改用户密码ipmitool user set password 3 test3、启用相关账号ipmitool user enable 34、停用账号ipmitool user disable 35、设置账号级别ipmitool user priv 3 4 1 #这里区分通道3、通道权限设置Channel Commands: authcap channel number max privilegegetaccess channel number [user id]setaccess channel number user id [callinon|off] [ipmion|off] [linkon|off] [privilegelevel]info [channel number]getciphers ipmi | sol [channel]setkg hex|plain key [channel]Possible privilege levels are:1 Callback level2 User level3 Operator level4 Administrator level5 OEM Proprietary level15 No access3.1 查看通道权限ipmitool channel getaccess 1 3 #1表示通道3表示用户ID3.2 设置通道权限ipmitool channel setaccess 1 3 callinoff ipmion linkoff privilege4本地通道(通道0)是通过调用/dev/ipmi0只需要callin有权限即可远程通道(通道1)privilege 用以控制bmc web登录权限,也影响ipmitool命令执行ipmi用于控制通过ipmitool远程访问权限(如通过ipmitool获取用户列表或者控制电源开关)4、网络设置相关ipmitool lanLAN Commands:print [channel number]set channel number command parameteralert print channel number alert destinationalert set channel number alert destination command parameterstats get [channel number]stats clear [channel number]ipmitool lan setusage: lan set channel command parameterLAN set command/parameter options:ipaddr x.x.x.x Set channel IP addressnetmask x.x.x.x Set channel IP netmaskmacaddr x:x:x:x:x:x Set channel MAC addressdefgw ipaddr x.x.x.x Set default gateway IP addressdefgw macaddr x:x:x:x:x:x Set default gateway MAC addressbakgw ipaddr x.x.x.x Set backup gateway IP addressbakgw macaddr x:x:x:x:x:x Set backup gateway MAC addresspassword password Set session password for this channelsnmp community string Set SNMP public community stringuser Enable default user for this channelaccess on|off Enable or disable access to this channelalert on|off Enable or disable PEF alerting for this channelarp respond on|off Enable or disable BMC ARP respondingarp generate on|off Enable or disable BMC gratuitous ARP generationarp interval seconds Set gratuitous ARP generation intervalvlan id off|id Disable or enable VLAN and set ID (1-4094)vlan priority priority Set vlan priority (0-7)auth level type,.. Set channel authentication typeslevel CALLBACK, USER, OPERATOR, ADMINtype NONE, MD2, MD5, PASSWORD, OEMipsrc source Set IP Address sourcenone unspecified sourcestatic address manually configured to be staticdhcp address obtained by BMC running DHCPbios address loaded by BIOS or system software4.1 查看当前网络设置ipmitool lan print 1 #默认为channel 1显示如下Set in Progress : Set CompleteAuth Type Support : MD5Auth Type Enable : Callback : MD5: User : MD5: Operator : MD5: Admin : MD5: OEM : MD5IP Address Source : UnspecifiedIP Address : 0.0.0.0Subnet Mask : 0.0.0.0MAC Address : 00:00:00:00:00:00SNMP Community String : AMIIP Header : TTL0x40 Flags0x40 Precedence0x00 TOS0x10BMC ARP Control : ARP Responses Enabled, Gratuitous ARP DisabledGratituous ARP Intrvl : 0.0 secondsDefault Gateway IP : 0.0.0.0Default Gateway MAC : 00:00:00:00:00:00Backup Gateway IP : 0.0.0.0Backup Gateway MAC : 00:00:00:00:00:00802.1q VLAN ID : Disabled802.1q VLAN Priority : 0RMCP Cipher Suites : 0,1,2,3,6,7,8,11,12,15,16,17Cipher Suite Priv Max : caaaaaaaaaaaXXX: XCipher Suite Unused: cCALLBACK: uUSER: oOPERATOR: aADMIN: OOEMBad Password Threshold : 0Invalid password disable: noAttempt Count Reset Int.: 0User Lockout Interval : 04.2 设置IPipmitool lan set 1 ipsrc staticipmitool lan set 1 ipaddr 192.168.1.2ipmitool lan set 1 netmask 255.255.255.0ipmitool lan set 1 defgw ipaddr 192.168.1.15、获取传感器数据ipmitool sdr list # 传感器简洁数据ipmitool -v sdr list # 传感器详细数据6、查看BMC信息ipmitool mc info7、电源管理ipmitool power off # 硬关机直接切断电源ipmitool power soft # 软关机即如同轻按一下开机扭ipmitool power on # 硬开机ipmitool power reset # 硬重启ipmitool power status # 获取当前电源状态ipmitool power cycle # 注意power cycle 和power reset的区别在于前者从掉电到上电有秒钟的间隔而后者是很快上电8、设置启动设备ipmitool chassis bootdev biosipmitool chassis bootdev pxeipmitool chassis bootdev diskipmitool chassis bootdev cdromipmitool chassis bootdev pxe optionsefiboot #设置下次启动为pxe并且固件为efi部分机器很变态即使BIOS里面设置了是UEFI模式ipmitool设置启动设备不加efi参数的话照样进入传统模式9、远程操作ipmitool -I lanplus -H (BMC的管理IP地址) -U (BMC登录用户名) -P (BMC 登录用户名的密码) lan print [ChannelNo]参数说明-I 使用的接口默认使用的是OpenIPMI, 部分是默认编译选项部分需要编译的时候开启比如lanplusInterfaces:open Linux OpenIPMI Interface [default]imb Intel IMB Interfacelan IPMI v1.5 LAN Interfacelanplus IPMI v2.0 RMCP LAN Interfacefree FreeIPMI IPMI Interfaceserial-terminal Serial Interface, Terminal Modeserial-basic Serial Interface, Basic Modedummy Linux DummyIPMI Interfaceusb IPMI USB Interface(OEM Interface for AMI Devices)10、SOL功能说明9.6/19.2/38.4/57.6/115.2其中115.2代表115200即*1000是表示的波特率。1. 设置SOL串口波特率ipmitool –H (BMC的管理IP地址) –I lanplus –U (BMC登录用户名) –P (BMC 登录用户名的密码) sol set volatile-bit-rate 9.6/19.2/38.4/57.6/115.22. 打开SOL功能ipmitool –H (BMC的管理IP地址) –I lanplus –U (BMC登录用户名) –P (BMC 登录用户名的密码) sol activate3. 关闭SOL功能ipmitool –H (BMC的管理IP地址) –I lanplus –U (BMC登录用户名) –P (BMC 登录用户名的密码) sol deactivate11、BMC重启有时BMC访问不了重启可恢复ipmitool mc reset cold12、系统日志类ipmitool sel elist #显示所有系统事件日志ipmitool sel clear #删除所有系统时间日志ipmitool sel delete ID #删除第ID条SELipmitool sel time get #显示当前BMC的时间ipmitool sel time set MM/DD/YYYY HH:MM:SS #设置当前BMC的时间 24小时制发送事件消息到系统消息日志event可接的选项有选项id 含义 日志内容1 温度过高 Temperature - Upper Critical - Going High2 电压过低 Voltage Threshold - Lower Critical - Going Low3 内存ECC错误 Memory - Correctable ECC