SoFunction
Updated on 2025-03-04

Detailed explanation of ipmitool management of Linux

BMC Management – ​​ipmitool

The old rules, let's take a look at the parameters first

[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

The basic format of the ipmitool command is:

ipmitool [Options] &lt;Order&gt; [parameter]

in:

  • Optionsare some optional switches to set some parameters of ipmitool.
  • OrderIt is the operation to be performed, such as obtaining sensor information, etc.
  • parameterAre optional, they are the options and values ​​required to specify the specific action to be performed.

Commonly used ipmitool commands

1. Obtain sensor information

ipmitool sensor get <Sensor ID>

in,

<Sensor ID>is the ID of the sensor to be obtained.

This command displays the current status of the specified sensor.

2. Display system information

ipmitool fru print

This command prints all available FRU (firmware reprogrammable unit) information in the system.

3. Power control

ipmitool power on   Turn on the power
ipmitool power off	Turn off the power
ipmitool power reset	Reset the power supply,According to my understanding, there is no complete power outage,System-likereboot
ipmitool power cycle	先Turn off the power,Open again

These commands are used to control the power state of the server.

4. Display event log

ipmitool sel list

This command displays the system event log.

5. Enable/disable BMC users

ipmitool user enable &lt;userID&gt;
ipmitool user disable &lt;userID&gt;

These commands are used to enable or disable BMC users.

The above are some commonly used ipmitool commands and their basic usage.

More ipmitool commands and options are available throughipmitool -hCommand to view the complete help documentation.

About setting BMC or remote control server BMC commands under OS

ipmitool can remotely control BMC through IPMI-over-LAN (LAN-based IPMI protocol).

To use IPMI-over-LAN, you need to make sure that the BMC is configured and connected to the network.

Steps to connect to BMC via IPMI-over-LAN and perform remote control

1. Determine the IP address of the BMC

useipmitool lan printThe command can obtain information such as the BMC's IP address, MAC address, and subnet mask.

If the BMC does not configure the IP address, you need to physically access the server locally to configure the BMC.

2. Connect to BMC

useipmitool lan set <parameters>Command to set the BMC username, password, IP address and other information.

For example, the following command sets the IP address of the BMC to 192.168.1.100, and sets the username to admin and password to 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

Notice:

Here it is assumed that the BMC uses the default LAN channel 1.

If you are using another channel, you need to1Replace with the number of the corresponding channel.

3. Enable IPMI-over-LAN function

useipmitool channel info <channel number>The command checks whether the IPMI-over-LAN function of the channel where the BMC is located is enabled.

If not enabled, you can enable it using the following command:

ipmitool channel setaccess &lt;Channel number&gt; 2 ipmi=on auth=off link=on privilege=4

This enables the IPMI-over-LAN function of the specified channel and makes the permission level of the IPMI session through this channel 4 (ADMINISTRATOR level).

4. Connect to remote BMC

Connect to a remote BMC using the following command:

ipmitool -H &lt;BMC IPaddress&gt; -U &lt;username&gt; -P &lt;password&gt; -I lanplus &lt;Order&gt;

Note that this is used-I lanplusOption to use the LAN-based IPMI protocol.

<Command>is the ipmitool command you want to execute.

For example:

To obtain sensor information, you can use the following command:

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

This will display the sensor list information for the remote BMC.

Summarize

The above are the basic steps for remote BMC control through ipmitool.

Please note that the access rights of the remote BMC should be restricted and can only be accessed by authorized users. In addition, you should make sure that your network security measures have been applied to ensure the security of remote access.

These are just personal experience. I hope you can give me a reference and I hope you can support me more.