Last active
October 3, 2020 14:59
-
-
Save FlorianHeigl/4d90261ceabd056ebb6ab2ca6aa814ac to your computer and use it in GitHub Desktop.
script for ipmi setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Base ipmi access setup script to be run from BMC | |
set -u | |
tgtip=xxx.xxx.xxx.xxx | |
tgtnet=$(echo $tgtip | cut -f1-3 -d\.) | |
# intel S2600: 2 | |
# supermicro: 0 | |
lanchannel=2 | |
identify_sys(){ | |
sleep 30 ; ipmitool chassis identify | |
} | |
show_current_cfg() { | |
ipmitool lan print 2 | |
ipmitool user list 2 | |
} | |
set_nic_to_shared() { | |
# here is the command for supermicro | |
# for intel, the channel ID seems to be sufficient. | |
# this info is from the following thread (as usual, scroll down for the valuable answers) | |
# https://serverfault.com/questions/361940/configuring-supermicro-ipmi-to-use-one-of-the-lan-interfaces-instead-of-the-ipmi | |
# To get LAN mode: ipmitool raw 0x30 0x70 0x0c 0. | |
# To set LAN mode dedicated: ipmitool raw 0x30 0x70 0x0c 1 0. | |
# To set LAN mode onboard/shared: ipmitool raw 0x30 0x70 0x0c 1 1. | |
# To set LAN mode failover: ipmitool raw 0x30 0x70 0x0c 1 2. | |
echo "not implemented" | |
} | |
set_ip_params(){ | |
ipmitool lan set "${lanchannel}" ipaddr "${tgtip}" | |
ipmitool lan set "${lanchannel}" netmask 255.255.255.0 | |
ipmitool lan set "${lanchannel}" defgw ipaddr ${tgtnet}.1 | |
} | |
set_user_params() { | |
ipmitool user set password "${lanchannel}" superuser | |
ipmitool lan set "${lanchannel}" access on | |
ipmitool user enable "${lanchannel}" | |
ipmitool lan set "${lanchannel}" user | |
} | |
main() { | |
identify_sys | |
show_current_cfg | |
set_ip_params | |
set_user_params | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment