LENOVO服务器批量升级BMC固件

https://www.cnblogs.com/zhangxinglong/p/5923826.html

需求:通过服务器远程管理IP批量升级IMM、UEFI固件

工具:asu64、ipmitool、iflash64、cdc_interface.sh

下载:http://pan.baidu.com/s/1pL1uOaB

第一步,将要更新BMC IP写入 ip.conf

10.17.2.34
10.17.6.54
10.17.22.80
10.17.5.74
10.17.5.3
第二步,验证当前BMC帐号 userlist.sh
#!/bin/bash
true > userlist.txt
while read line;
do
ip=echo $line|awk '{print $1}'
ipmitool -H i p − I l a n p l u s − U u s e r i d − P p a s s w o r d u s e r l i s t > / d e v / n u l l r e t = ip -I lanplus -U userid -P password user list >/dev/null ret= ipIlanplusUuseridPpassworduserlist>/dev/nullret=?
if [ r e t − e q 0 ] t h e n p r i n t f " ret -eq 0 ] then printf " reteq0]thenprintf"ip OK\n">>userlist.txt
else printf “$ip ERR\n”>>userlist.txt
fi
done < ./ip.conf
第三步,编辑批量ping脚本 server_ping.sh
#!/bin/bash
true > out.txt
while read line;
do
ip=echo $line|awk '{print $1}'
ping -w 1 -c 1 i p > / d e v / n u l l r e t = ip>/dev/null ret= ip>/dev/nullret=?
if [ r e t − e q 0 ] t h e n p r i n t f " ret -eq 0 ] then printf " reteq0]thenprintf"ip OK\n">>out.txt
else printf “$ip ERR\n”>>out.txt
fi
done < ./ip.conf
第四步,编辑批量关机脚步 power_off.sh
#!/bin/bash
user=userid
password=password
while read ip; do
ipmitool -H $ip -I lanplus -U $user -P $password power off
done < ./ip.conf
第五步,编写批量升级uefi脚本 iflash.sh
#!/bin/bash
user=userid
password=password
while read ip; do
./iflash64 --package ibm_fw_uefi_d7e154b-2.21_anyos_32-64.uxz --host $ip --user $user --password $password --force
done < ./ip.conf
第六步,执行批量ping 查看结果全部ok

[root@asu64]# sh server_ping.sh
[root@asu64]# cat out.txt
10.17.2.34 OK
10.17.6.54 OK
10.17.22.80 OK
10.17.5.74 OK
10.17.5.33 OK
第七步,执行power_off.sh 批量关机
[root@asu64]# sh power_off.sh
Chassis Power Control: Down/Off
Chassis Power Control: Down/Off
Chassis Power Control: Down/Off
Chassis Power Control: Down/Off
Chassis Power Control: Down/Off
第八步,执行批量升级脚本

[root@asu64]# sh iflash.sh
第九步,升级完成提示需要重启服务器
IBM Command Line IMM Flash Update Utility v1.12.24
Licensed Materials - Property of IBM
© Copyright IBM Corp. 2009 - 2013 All Rights Reserved.

Pinging IMM IP address 10.17.5.33 …OK
Connected to IMM at IP address 10.17.5.33.
Update package firmware type: uEFI
Update package build level: D7E154B
Target’s current build level: D7E136A

The IMM is preparing to receive the update.

Transferring image: 98%
Transfer complete.
Validating image.
Updating firmware: 100%
Update complete.

Firmware flashed successfully
Following the UEFI flash update, allow the system to reboot to the F1 prompt to complete the update process.
Fail to take down the LAN-over-USB interface.
第十步,批量重启服务器,升级完成。
[root@asu64]# sh power_on.sh
Chassis Power Control: Down/On
Chassis Power Control: Down/On
Chassis Power Control: Down/On
Chassis Power Control: Down/On
Chassis Power Control: Down/On
登陆BMC界面验证升级是否成功
在这里插入图片描述

Guess you like

Origin blog.csdn.net/GSWWJM/article/details/111612729