How to Change HPE ILO5 default gateway configuration by script

Kevin W Tech Notes
1 min readFeb 11, 2021

--

If you have many HPE servers need to manage and requires to configure default gateway, here is an easy way to do it.

We’re going to use the following command to configure default gateway.

[admin@sv-sitectl-node01 ~]$ ssh admin@172.23.8.41 " set /map1/gateway1 AccessInfo=172.23.8.1"
admin@172.23.8.41's password:
set /map1/gateway1 AccessInfo=172.23.8.1
status=0
status_tag=COMMAND COMPLETED
Tue Oct 6 23:08:51 2020
Network settings change applied.
Settings change applied, iLO 5 will now be reset.
Logged Out: It may take several minutes before you can log back in.
CLI session stopped
Connection to 172.23.8.41 closed by remote host.

Configure it by shell script

ipmi=(172.23.9.54
172.23.9.53
172.23.9.52
172.23.8.42
172.23.8.41)
password="your-password"function auto_config_gw() {
expect -c "
set timeout 30
spawn ssh -o StrictHostKeyChecking=no $2
expect {
\"*assword\" {set timeout 600; send $password\r; }
\"yes/no\" {send \"yes\n\"; }
}
expect {
\"*hpiLO*\" {send \"set /map1/gateway1 AccessInfo=172.23.8.1\r\";}
}
interact
"
}
for ip in ${ipmi[@]}; do
auto_config_gw $password admin@$ip
done

This will allow you to configure default gateway without login into ilo.

--

--

No responses yet