Location>code7788 >text

Detailed tutorial on using IPMITool tools

Popularity:90 ℃/2025-02-20 23:08:10

Detailed tutorial on using IPMITool tools

1. Introduction to IPMI and IPMITool

1. IPMI Overview

Intelligent Platform Management Interface (IPMI) is an open standard hardware management interface specification that defines a specific method for embedded management subsystems to communicate. It is independent of the system's CPU, BIOS and operating system, and can monitor, manage and maintain the system when the system is not turned on. Through IPMI, administrators can remotely monitor the server's hardware status (such as temperature, voltage, fan speed, etc.), control the server's power status, and perform system logging and other operations.

2. Overview of IPMITool

IPMITool is an open source command line tool for interacting with systems that support IPMI standards. It provides rich features that allow users to perform various administrative tasks through the IPMI interface. IPMITool can run on a variety of operating systems, such as Linux, Windows, etc., providing administrators with a convenient and flexible way to manage and monitor server hardware.

2. IPMITool installation

1. Linux system installation

Debian/Ubuntu System

Run the following command in the terminal to install:

sudo apt-get update
sudo apt-get install ipmitool

Red Hat/CentOS System

Use the following command to install:

sudo yum install ipmitool

2. Windows system installation

  • Visit the official download page of IPMITool or related software sources to download the IPMITool installation package for Windows.
  • Run the installation package and follow the installation wizard prompts to complete the installation. After the installation is complete, the installation directory of IPMITool needs to be added to the system's environment variables so that it can be used directly in the command prompt.

3. Basic use of IPMITool

1. Connect to the target server

Before using IPMITool, you need to establish a connection with the target server that supports IPMI. To connect to the server, you need to know the IP address, username, and password of the server's IPMI interface. Connect using the following command:

ipmitool -I lanplus -H <IP address> -U <username> -P <password> <command>
  • -I lanplus: Specify the connection using the LAN protocol, which is the most commonly used connection method.
  • -H <IP Address>: Specify the IP address of the target server IPMI interface.
  • -U <Username>: Specify the user name for logging into the IPMI interface.
  • -P <Password>: Specify the password for logging into the IPMI interface.

For example, the connection to the IP address is192.168.1.100, username isadmin, the password ispasswordand view the server system information:

ipmitool -I lanplus -H 192.168.1.100 -U admin -P password chassis status

2. Check the server hardware status information

View sensor information

Sensor information can reflect the hardware status of the server, such as temperature, voltage, fan speed, etc. Use the following command to view sensor information:

ipmitool -I lanplus -H <IP address> -U <username> -P <password> sensor

This command will output detailed information of all sensors on the server, including sensor name, current value, status, etc. For example:

CPU Temp         | 32.000     | degrees C  | ok    | na        | 5.000     | 10.000    | 80.000    | 85.000    | 90.000    
MB Temp          | 28.000     | degrees C  | ok    | na        | 5.000     | 10.000    | 70.000    | 75.000    | 80.000    
Fan1             | 3000       | RPM        | ok    | na        | 1000      | 1500      | 8000      | 8500      | 9000    

View System Event Log (SEL)

The system event log records various event information of the server hardware, such as hardware failures, sensor alarms, etc. Use the following command to view the system event log:

ipmitool -I lanplus -H <IP address> -U <username> -P <password> sel list

This command will output detailed information of the system event log, including the time of the event occurrence, event type, event description, etc. For example:

1 | 01/01/2025 | 12:00:00 | Temperature Sensor | CPU Temp | Going High
2 | 01/01/2025 | 12:05:00 | Temperature Sensor | CPU Temp | Going Normal

3. Control the server power status

Check the power status

Use the following command to view the power status of the server:

ipmitool -I lanplus -H <IP address> -U <username> -P <password> chassis power status

This command will output the server's power status, such asPower is onorPower is off

Turn on

Use the following command to power on the server:

ipmitool -I lanplus -H <IP address> -U <username> -P <password> chassis power on

Shut down

Use the following command to power off the server:

ipmitool -I lanplus -H <IP address> -U <username> -P <password> chassis power off

Restart

Restart the server with the following command:

ipmitool -I lanplus -H <IP address> -U <username> -P <password> chassis power reset

4. Remote Console (SOL) Function

The remote console (Serial over LAN, SOL) allows users to remotely access the server's serial console through the network. Use the following command to enable the SOL feature:

ipmitool -I lanplus -H <IP address> -U <username> -P <password> sol activated

After enabling the SOL function, users can operate the server in the terminal like operating the local serial console. To exit the SOL session, pressCtrl + ]Key combination.

4. Advanced use

1. Set IPMI interface parameters

You can use IPMITool to set parameters of the server IPMI interface, such as IP address, subnet mask, gateway, etc. Here is an example of setting up the IP address of an IPMI interface:

ipmitool -I lanplus -H <IP address> -U <username> -P <password> lan set 1 ipsrc static
 ipmitool -I lanplus -H <IP address> -U <username> -P <password> lan set 1 ipaddr <new IP address>
 ipmitool -I lanplus -H <IP address> -U <username> -P <password> lan set 1 netmask <subnet mask>
 ipmitool -I lanplus -H <IP address> -U <username> -P <password> lan set 1 defgw ipaddr <gateway address>

2. Batch operation

If you need to perform the same operation on multiple servers, you can write scripts to implement batch operations. Here is an example of using Bash scripts to view sensor information for multiple servers in batches:

#!/bin/bash

 # Define the server list
 servers=(
 "192.168.1.100"
 "192.168.1.101"
 "192.168.1.102"
 )

 # Define username and password
 username="admin"
 password="password"

 # traverse the server list
 for server in "${servers[@]}"
 do
     echo "View the sensor information of the server $server:"
     ipmitool -I lanplus -H $server -U $username -P $password sensor
     echo "------------------------------"
 done

Save the above script asbatch_sensor.sh, and grant execution permissions:

chmod +x batch_sensor.sh

Then run the script:

./batch_sensor.sh

3. User Management

Create a user

You can use IPMITool to create new IPMI users so that different administrators can use different accounts for administrative operations. The command to create a user is as follows:

ipmitool -I lanplus -H <IP address> -U <username> -P <password> user set name <user ID> <new username>
 ipmitool -I lanplus -H <IP address> -U <username> -P <password> user set password <user ID> <new password>
 ipmitool -I lanplus -H <IP address> -U <user name> -P <password> user enable <user ID>
  • <User ID>: is a unique number used to identify the user, and the range is usually 1 - 16.
  • <New Username>: Specify the name of the new user to create.
  • <New Password>: Specify the login password of the new user.

For example, create a user ID of 3 and usernamenewuser, the password isnewpasswordNew users:

ipmitool -I lanplus -H 192.168.1.100 -U admin -P password user set name 3 newuser
ipmitool -I lanplus -H 192.168.1.100 -U admin -P password user set password 3 newpassword
ipmitool -I lanplus -H 192.168.1.100 -U admin -P password user enable 3

Modify user permissions

After creating a user, you can assign different permissions to the user as needed. Permissions are divided into different levels, such asCALLBACKUSEROPERATORADMINISTRATORwait. Use the following command to modify user permissions:

ipmitool -I lanplus -H <IP address> -U <username> -P <password> channel setaccess <channel ID> <user ID> privilege=<permission level>
  • <Channel ID>: Usually 1, indicating the LAN channel.
  • <Permission Level>: Can beCALLBACKUSEROPERATORADMINISTRATORwait.

For example, set user permissions with user ID 3 toADMINISTRATOR

ipmitool -I lanplus -H 192.168.1.100 -U admin -P password channel setaccess 1 3 privilege=ADMINISTRATOR

Delete users

If a user is no longer needed, you can delete the user using the following command:

ipmitool -I lanplus -H <IP address> -U <user name> -P <password> user disable <user ID>
 ipmitool -I lanplus -H <IP address> -U <user name> -P <password> user delete <user ID>

For example, delete a user with a user ID of 3:

ipmitool -I lanplus -H 192.168.1.100 -U admin -P password user disable 3
ipmitool -I lanplus -H 192.168.1.100 -U admin -P password user delete 3

4. Modify the IPMI interface password

You can use IPMITool to modify the administrator password of the IPMI interface. Use the following command to modify the password:

ipmitool -I lanplus -H <IP address> -U <username> -P <old password> user set password <user ID> <new password>

For example, use the password with user ID 1 (usually an administrator user) fromoldpasswordModified tonewpassword

ipmitool -I lanplus -H 192.168.1.100 -U admin -P oldpassword user set password 1 newpassword

5. Sensor Threshold Setting

You can use IPMITool to set the threshold of the sensor. When the sensor's value exceeds or is lower than the threshold, the system will trigger the corresponding alarm. Here is an example of setting the high threshold of the CPU temperature sensor:

ipmitool -I lanplus -H <IP address> -U <username> -P <password> sensor thresh <sensor name> upper <high ​​threshold>

For example, set the high threshold of the CPU temperature sensor to 85 degrees Celsius:

ipmitool -I lanplus -H 192.168.1.100 -U admin -P password sensor thresh "CPU Temp" upper 85

6. Remote firmware upgrade

Some IPMI-enabled servers can perform remote firmware upgrades through IPMITool. Firmware upgrades usually require downloading the latest firmware file first, then uploading and performing an upgrade using IPMITool. The firmware upgrade commands for different servers may vary, and you generally need to refer to the server's user manual. Here is a simple example:

ipmitool -I lanplus -H <IP address> -U <username> -P <password> raw <upgrade command> <firmware file path>

5. Frequently Asked Questions and Solutions

1. Connection failed

  • reason: It may be because the IP address, username or password is wrong, or the IPMI interface of the target server is not enabled.
  • Solution: Check whether the IP address, username and password are correct to ensure that the IPMI interface of the target server is enabled. You can check and set up through the server's BIOS or BMC management interface.

2. The command execution is unresponsive

  • reason: It may be a network problem or the server load is too high.
  • Solution: Check whether the network connection is normal and try to usepingCommands test network connectivity with the target server. If the server load is too high, you can wait for a while before trying to execute the command.

3. Insufficient permissions

  • reason: It may be that the username used does not have sufficient permission to execute the corresponding command.
  • Solution: Log in to the IPMI interface with a username with higher privileges, or assign the corresponding permissions to the current user in the BMC management interface of the server.

4. User creation or permission modification failed

  • reason: It may be that the user ID has been used, or the permission level is specified incorrectly.
  • Solution: Check whether the user ID is available and make sure that the permission level is specified correctly. Availableipmitool user listCommand to view existing user information.

6. Summary

IPMITool is a powerful tool that allows easy management and monitoring of servers that support IPMI standards. This article details the installation, basic use, advanced use, and solutions to common problems of IPMITool. I hope that through the introduction of this article, you can master the use of IPMITool and improve the efficiency of server management.