Linux -- ipmitool管理BMC

BMC管理 – ipmitool

1,老规矩,先 help看看参数

[root@test ~]# ipmitool -h
ipmitool version 1.8.18

usage: ipmitool [options...] <command>

       -h             This help
       -V             Show version information
       -v             Verbose (can use multiple times)
       -c             Display output in comma separated format
       -d N           Specify a /dev/ipmiN device to use (default=0)
       -I intf        Interface to use
       -H hostname    Remote host name for LAN interface
       -p port        Remote RMCP port [default=623]
       -U username    Remote session username
       -f file        Read remote session password from file
       -z size        Change Size of Communication Channel (OEM)
       -S sdr         Use local file for remote SDR cache
       -D tty:b[:s]   Specify the serial device, baud rate to use
                      and, optionally, specify that interface is the system one
       -4             Use only IPv4
       -6             Use only IPv6
       -a             Prompt for remote password
       -Y             Prompt for the Kg key for IPMIv2 authentication
       -e char        Set SOL escape character
       -C ciphersuite Cipher suite to be used by lanplus interface
       -k key         Use Kg key for IPMIv2 authentication
       -y hex_key     Use hexadecimal-encoded Kg key for IPMIv2 authentication
       -L level       Remote session privilege level [default=ADMINISTRATOR]
                      Append a '+' to use name/privilege lookup in RAKP1
       -A authtype    Force use of auth type NONE, PASSWORD, MD2, MD5 or OEM
       -P password    Remote session password
       -E             Read password from IPMI_PASSWORD environment variable
       -K             Read kgkey from IPMI_KGKEY environment variable
       -m address     Set local IPMB address
       -b channel     Set destination channel for bridged request
       -t address     Bridge request to remote target address
       -B channel     Set transit channel for bridged request (dual bridge)
       -T address     Set transit address for bridge request (dual bridge)
       -l lun         Set destination lun for raw commands
       -o oemtype     Setup for OEM (use 'list' to see available OEM types)
       -O seloem      Use file for OEM SEL event descriptions
       -N seconds     Specify timeout for lan [default=2] / lanplus [default=1] interface
       -R retry       Set the number of retries for lan/lanplus interface [default=4]

Interfaces:
        open          Linux OpenIPMI Interface [default]
        imb           Intel IMB Interface
        lan           IPMI v1.5 LAN Interface
        lanplus       IPMI v2.0 RMCP+ LAN Interface
        serial-terminal  Serial Interface, Terminal Mode
        serial-basic  Serial Interface, Basic Mode
        usb           IPMI USB Interface(OEM Interface for AMI Devices)

Commands:
        raw           Send a RAW IPMI request and print response
        i2c           Send an I2C Master Write-Read command and print response
        spd           Print SPD info from remote I2C device
        lan           Configure LAN Channels
        chassis       Get chassis status and set power state
        power         Shortcut to chassis power commands
        event         Send pre-defined events to MC
        mc            Management Controller status and global enables
        sdr           Print Sensor Data Repository entries and readings
        sensor        Print detailed sensor information
        fru           Print built-in FRU and scan SDR for FRU locators
        gendev        Read/Write Device associated with Generic Device locators sdr
        sel           Print System Event Log (SEL)
        pef           Configure Platform Event Filtering (PEF)
        sol           Configure and connect IPMIv2.0 Serial-over-LAN
        tsol          Configure and connect with Tyan IPMIv1.5 Serial-over-LAN
        isol          Configure IPMIv1.5 Serial-over-LAN
        user          Configure Management Controller users
        channel       Configure Management Controller channels
        session       Print session information
        dcmi          Data Center Management Interface
        nm            Node Manager Interface
        sunoem        OEM Commands for Sun servers
        kontronoem    OEM Commands for Kontron devices
        picmg         Run a PICMG/ATCA extended cmd
        fwum          Update IPMC using Kontron OEM Firmware Update Manager
        firewall      Configure Firmware Firewall
        delloem       OEM Commands for Dell systems
        shell         Launch interactive IPMI shell
        exec          Run list of commands from file
        set           Set runtime variable for shell and exec
        hpm           Update HPM components using PICMG HPM.1 file
        ekanalyzer    run FRU-Ekeying analyzer using FRU files
        ime           Update Intel Manageability Engine Firmware
        vita          Run a VITA 46.11 extended cmd
        lan6          Configure IPv6 LAN Channels

ipmitool命令的基本格式是:

ipmitool [选项] <命令> [参数]

其中,选项是一些可选的开关,用于设置ipmitool的一些参数。命令是要执行的操作,如获取传感器信息等。参数是可选的,它们是指定要执行的特定操作所需的选项和值。

以下是一些常用的ipmitool命令:

  1. 获取传感器信息
ipmitool sensor get <Sensor ID>

其中,<Sensor ID>是要获取的传感器的ID。此命令将显示指定传感器的当前状态。

  1. 显示系统信息
ipmitool fru print

此命令将打印系统中所有可用的FRU(固件可重编程单元)信息。

  1. 电源控制
ipmitool power on   开启电源
ipmitool power off	关闭电源
ipmitool power reset	重置电源,按我的理解是没有完全断电的动作,类似系统的reboot
ipmitool power cycle	先关闭电源,再开启

这些命令用于控制服务器的电源状态。

  1. 显示事件日志
ipmitool sel list

此命令将显示系统的事件日志。

  1. 启用/禁用BMC用户
ipmitool user enable <用户ID>
ipmitool user disable <用户ID>

这些命令用于启用或禁用BMC用户。

以上是一些常用的ipmitool命令和它们的基本用法。更多的ipmitool命令和选项可以通过ipmitool -h命令查看完整的帮助文档。

另外关于OS下设定BMC或远程控制服务器的BMC命令等:
ipmitool可以通过IPMI-over-LAN(基于LAN的IPMI协议)来远程控制BMC。要使用IPMI-over-LAN,您需要确保BMC已经配置并连接到网络。

下面是通过IPMI-over-LAN连接到BMC并进行远程控制的步骤:

  1. 确定BMC的IP地址

使用ipmitool lan print命令可以获取BMC的IP地址、MAC地址和子网掩码等信息。如果BMC未配置IP地址,则需要在本地物理访问服务器以配置BMC。

  1. 连接到BMC

使用ipmitool lan set <参数>命令设置BMC的用户名、密码和IP地址等信息。例如,下面的命令设置BMC的IP地址为192.168.1.100,并将用户名设置为admin,密码设置为password:

ipmitool lan set 1 ipsrc static
ipmitool lan set 1 ipaddr 192.168.1.100
ipmitool lan set 1 netmask 255.255.255.0
ipmitool lan set 1 defgw ipaddr 192.168.1.1
ipmitool user set name 2 admin
ipmitool user set password 2 password

注意,这里假设BMC使用的是默认的LAN通道1。如果使用的是其他通道,则需要将1替换为相应通道的数字。

  1. 启用IPMI-over-LAN功能

使用ipmitool channel info <通道号>命令检查BMC所在通道的IPMI-over-LAN功能是否已经启用。如果未启用,可以使用以下命令启用:

ipmitool channel setaccess <通道号> 2 ipmi=on auth=off link=on privilege=4

这将启用指定通道的IPMI-over-LAN功能,并使得通过此通道的IPMI会话的权限级别为4(ADMINISTRATOR级别)。

  1. 连接到远程BMC

使用以下命令连接到远程BMC:

ipmitool -H <BMC IP地址> -U <用户名> -P <密码> -I lanplus <命令>

注意,这里使用了-I lanplus选项,以使用基于LAN的IPMI协议。<命令>是您要执行的ipmitool命令。例如,要获取传感器信息,可以使用以下命令:

ipmitool -H 192.168.1.100 -U admin -P password -I lanplus sensor list

这将显示远程BMC的传感器列表信息。

以上是通过ipmitool进行远程BMC控制的基本步骤。请注意,远程BMC的访问权限应该是受限的,只有授权用户才能访问。此外,您还应该确保网络安全措施已经得到了应用,以确保远程访问的安全性。

  • 1
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值