IPMI iBMC remote management configuration query and password reset under Linux

Posted by MalikBB on Mon, 20 Dec 2021 22:16:38 +0100

preface
There are many maintenance servers. Recently, I encountered the situation that the servers handed over by other departments did not register the remote management port. I asked the relevant people who have taken over the server, and all said they did not master the relevant ip, user name and password. In fact, in this case, IPMI provides management port drivers and tools under linux. As long as ssh can log in to the linux system, it can be retrieved. The relevant process records are as follows:

1, Install ipmitool drivers and tools
System environment: Centos 7.3_x64 Centos 7.5_x64

Because it is a redhat operating system, there are two ways to install ipmi: source package installation and rpm installation. The source code of these two methods can be successful under 7.3 and 7.5/ When configure runs, an error is reported. Due to tight time, the installation is successful by using rpm installation instead of finding the reason. The details are as follows:

1.1. Source code installation method
1.1. 1. Download the source installation package
Download connection: https://sourceforge.net/projects/ipmitool/

The downloaded source package is called ipmitool-1.8 18.tar. Bz2, upload the downloaded source package to the linux server to be queried, and perform the following operations to install.

1.1. 2. Extract, compile and install IPMI

# tar -xvf ipmitool-1.8.18.tar.bz2
# cd ipmitool-1.8.18
# ./configure
# make
# make install

1.2 installation method of rpm package
1.2. 1. Download the rpm installation package for IPMI
Ipmitool-1.8 is required for RPM installation 18-9. el7_ 7.x86_ 64.rpm and openipmi-modalias-2.0 27-1. el7. x86_ 64.rpm2 Packages, which can be searched and downloaded on the following connection page. If the directory of the current version does not exist, find the Packages / directory of the latest version according to the splicing of the url. If it is an Internet environment, you can download it directly by performing the following operations.

Download connection: http://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/

Download installation package

wget http://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/ipmitool-1.8.18-9.el7_7.x86_64.rpm
wget http://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/OpenIPMI-modalias-2.0.27-1.el7.x86_64.rpm

1.2. 2. The rpm package of IPMI will be downloaded for installation

#Two rpm packages are installed at the same time
rpm -ivh ipmitool-1.8.18-9.el7_7.x86_64.rpm OpenIPMI-modalias-2.0.27-1.el7.x86_64.rpm

# If the above command prompts a dependent problem, execute the following command
rpm -ivh ipmitool-1.8.18-9.el7_7.x86_64.rpm OpenIPMI-modalias-2.0.27-1.el7.x86_64.rpm

Or directly yum install rpm
#yum install ipmitool –y
 testing ipmitool Is the installation successful
#rpm -qa ipmitool
 see ipmitool edition
# ipmitool -V

2, Load the function module of ipmitool
No matter the installation method of source code or rpm, ipmitool tool can be used only after ipmi function modules are loaded after installation. The relevant operations execute the following commands:

# modprobe ipmi_devintf
# modprobe ipmi_watchdog
# modprobe ipmi_poweroff
# modprobe ipmi_si
# modprobe ipmi_msghandler

3, Query the relevant configuration of IPMI iBMC
After installing and loading the module, ipmitool can be used as a command tool if it is normal. At this time, ipmitool will only be executed separately. Ipmitool will echo the help of the tool. The functions of relevant settings and queries are basically available. The relevant commands used in this process are as follows:

3.1. Query the network configuration of the current BMC management port
The commands to query the current configuration are as follows:

# ipmitool lan print 1

3.2. Query the current BMC user
The command to query the current user is as follows. After executing the command, the first column will display the user's id and the second column will display the current user name. If you need to reset the password, you need to remember the user's id

# ipmitool user list 1

3.3. Modify user name and password
The format of the command to modify the user password is as follows. 2 after the password is the user ID and pass_ STR can be changed to the password to be changed. Please use the web method after changing the password. You will be prompted that the password used is the default password. You can log in to the management page after modifying it once according to the prompt

ipmitool user set password 2 pass_str

4, Summary of other common commands
4.1. Read system status

#Displays a list of all sensors in the system
Ipmitool sensor list	
#Displays a list of all field replaceable devices in the system
Ipmitool fru list		
#Displays a list of all SDRRepository devices in the system
Ipmitool sdr list
#Displays a list of system platform time filters
Ipmitool pef list		

4.2 system related commands

#Display BMC version information
Ipmitool mc info				
#BMC hot start
Ipmitool bmc reset warm
# BMC cold start
Ipmitool bmc reset cold	

4.3 commands related to network interface

# Displays the network configuration information for channel1
Ipmitool lan print 1
# Set the IP address of channel1
Ipmitool lan set 1 ipaddr 10.32.2.2 
# Set netmask for channel1
Ipmitool lan set 1 netmask 255.255.0.0 
# Set gateway for channel4
Ipmitool lan set 4 defgw ipaddr255.255.0.254 
# Set the gateway mac address of channel2
Ipmitool lan set 2 defgw macaddr
# Set the ip source of channel2 in DHCP
Ipmitool lan set 2 ipsrc dhcp
# Set the ip of channel2 to be obtained statically
Ipmitool lan set 3 ipsrc static

4.4 user related commands

# Displays all users on a channel
Ipmitool user list chan-id
# Change a user's password
Ipmitool set password [user_id passwd_str]
# Disable dropping a user
Ipmitool disable
# Enable a user
ipmitool enable
# Modify the permissions of a user on a channel
ipmitool priv []
# Test user
ipmitool test <16|20>[<password]>

4.5. Commands related to reading logs

# Show all system event logs
Ipmitool sel elist
# Delete all system time logs
Ipmitool sel clear 
# Delete article ID SEL
Ipmitool sel delete ID 
# Displays the time of the current BMC
Ipmitool sel time get 
# Sets the time of the current BMC 
Ipmitool sel time set XXX 

4.5 remote power control

Copy after login
# Power off
Ipmitool -I lanplus –H 192.168.200.101 –U username –P Passwordchassis power off
# Power on
Ipmitool -I lanplus –H 192.168.200.101 –U username –P Passwordchassis power on
# Power reset
Ipmitool -I lanplus –H 192.168.200.101 –U username –P Passwordchassis power reset
Ipmitool -I lanplus –H 192.168.200.101 –U username –P Passwordchassis power cycle
# Note: the difference between power cycle and power reset is that the former has an interval of 1 second from power down to power on, while the latter is powered on quickly

Topics: Linux