IPMI interface and BMC controller
1. Introduction to IPMI and BMC
The core of the IPMI (Intelligent Platform Management Interface) intelligent platform management interface is the BMC (Baseboard Management Controller) baseboard management controller. BMC does not depend on the server's processor, BIOS or operating system. It can work as long as the firmware has been programmed. It is usually an independent board installed on the server motherboard. The good autonomy characteristics of IPMI also overcome the limitations of previous operating system-based management methods. For example, when the operating system does not respond or is not loaded, it can still perform operations such as power on and off and information extraction.
Usually, the function of IPMI is accomplished by sending commands to the BMC using the ipmitool tool. Commands Using the instructions specified in the IPMI specification, the BMC receives and records event messages in the system event log, maintaining sensor data records that describe the conditions of the sensors in the system.
For more information, please refer to:
https://en.wikipedia.org/wiki/Intelligent_Platform_Management_Interface
2. Introduction to ipmitool
In short, under linux, ipmitool can send commands to the target server BMC based on the ipmi protocol (specification) through the command line to realize the operations that the user needs to achieve, including: booting, shutting down, restarting, monitoring the remote screen, setting temporary startup items, etc.
3. Download and install ipmitool:
Ubuntu:# apt install ipmitool
CentOS:# yum install ipmitool
There is also corresponding software under Windows that can realize the ipmi management function, which is not detailed.
4. Common commands
After installing ipmitool under Linux, you can view the usage method through ipmitool -h, or through man ipmitool.
In addition, whether the function can be realized after the ipmitool command is executed also depends on the firmware of the target BMC. Since only some models of BMCs have been tried in practice, it is not guaranteed whether the following commands are applicable to all models.
Commonly used commands are as follows:
0. View the local BMC ip address:
ipmitool lan print 1
1. Power on:
ipmitool -I lanplus -H<BMC ip> -U<BMC USER>-P<BMC PSWD> power on
ipmitool -I lanplus -H<BMC ip> -U<BMC USER> -P<BMC PSWD> chassis power on
2. Power off:
ipmitool -I lanplus -H<BMC ip> -U<BMC USER> -P<BMC PSWD> power off
ipmitool -I lanplus -H<BMC ip> -U<BMC USER> -P<BMC PSWD> chassis power off
3. Hard reboot:
ipmitool -I lanplus -H<BMC ip> -U<BMC USER> -P<BMC PSWD> power reset
ipmitool -I lanplus -H<BMC ip> -U<BMC USER> -P<BMC PSWD> chassis power reset
4. Check the power status:
ipmitool -I lanplus -H<BMC ip> -U<BMC USER> -P<BMC PSWD> power status
ipmitool -I lanplus -H<BMC ip> -U<BMC USER> -P<BMC PSWD> chassis power status
5. Check the motherboard status:
ipmitool -I lanplus -H<BMC ip> -U<BMC USER> -P<BMC PSWD> chassis status
6. Set the default startup item for the next startup:
ipmitool -I lanplus -H<IP> -U<USER> -P<PSWD> chassis bootdev <DEV>
<DEV> includes:
none : Do not change boot device order ## Do not change the boot device order
pxe : Force PXE boot ## Traverse the network card
disk : Force boot from default Hard-drive ##boot from disk
safe : Force boot from default Hard-drive, request Safe Mode
## Force boot from default hard drive, requires safe mode
diag : Force boot from Diagnostic Partition ## Boot from the diagnostic partition
cdrom : Force boot from CD/DVD ##boot from cdrom
bios : Force boot into BIOS Setup ##boot into BIOS setup
floppy: Force boot from Floppy/primary removable media ## boot from floppy/primary removable media
7. Remote access to the system text console:
ipmitool -I lanplus -H<IP> -U<USER> -P<PSWD> sol activate
Description: SOL (Serial Over LAN) intercepts data through IPMI firmware, and then re-sends it to the remote serial port through the LAN to remotely access Windows' Emergency Management Console (EMS), Special Management Console (SAC), or access LINUX Serial console. It should be noted that only one sol is allowed to be enabled on an IPMI interface at the same time. When sol is occupied, it can be forcibly closed with the following command:
ipmitool -I lanplus -H<IP> -U<USER> -P<PSWD> sol deactivate
You can also view sol information with the following command:
ipmitool -I lanplus -H<IP> -U<USER> -P<PSWD> sol info
5. Log in to BMC through ssh and execute commands
Due to the small number of models that have been practiced, the following operations are not guaranteed to be applicable to all models and firmware versions.
1. Log in to BMC with ssh
sshpass -p '<PSWD>' <USER>@<IP>
2. Implement vmm mount
ipmcset -t vmm -d connect -v nfs://<NFS SERVER IP>/<NFS PATH>/<iso NAME>.iso
Simulate the iso file as a cdrom mount through vmm, so that when you choose to boot from cdrom, you can directly install the mounted iso.
You can execute the above command after ssh login, or you can execute it directly through ssh in the local terminal:
sshpass -p '<PSWD>' <USER>@<IP>ipmcset -t vmm -d connect -v nfs://<NFS SERVER IP>/<NFS PATH>/<iso NAME>.iso
3. Unmount the virtual optical drive (vmm)
ipmcset -t vmm -d disconnect
or execute in local terminal:
sshpass -p '<BMC PSWD>' ssh <BMC USER>@<BMC IP> ipmcset -t vmm -d disconnect