In general, the BMC must be set up from within the OS unless you feel like going through the console on quite a few servers. Each manufacturer is of course different.
==== Dell ====
Dell is pretty good about using IPMItool for everything. The iDRAC 6 Express tends to flake out though. Script to set it up is below:
#!/bin/sh
IPSRC_DEVICE=eth0
IPMITOOL_LAN="ipmitool lan set 1"
IPMITOOL_USER="ipmitool user"
PASSWORD="somepasshere"
/sbin/service ipmi start
bmcip=`/sbin/ifconfig $IPSRC_DEVICE | awk '/inet addr/ {print $2}' | sed s/addr:// | awk -F. '{print $1 "." $2 "." $3+16 "." $4}'`
$IPMITOOL_LAN ipsrc static
$IPMITOOL_LAN ipaddr $bmcip
$IPMITOOL_LAN netmask 255.255.240.0
$IPMITOOL_LAN defgw ipaddr 10.128.16.100
$IPMITOOL_LAN access on
$IPMITOOL_USER set password 2 $PASSWORD
/sbin/service ipmi stop
==== HP ====
HP's ILO is somewhat non-standard. You have to set parts of it up with hponcfg from their [[http://h20565.www2.hp.com/portal/site/hpsc/template.PAGE/public/psi/swdDetails/?sp4ts.oid=4198402&spf_p.tpst=swdMain&spf_p.prp_swdMain=wsrp-navigationalState%3Didx%253D%257CswItem%253DMTX_9a9cb07091534f2f940f7a203d%257CswEnvOID%253D4004%257CitemLocale%253D%257CswLang%253D%257Cmode%253D%257Caction%253DdriverDocument&javax.portlet.begCacheTok=com.vignette.cachetoken&javax.portlet.endCacheTok=com.vignette.cachetoken|Scripting Toolkit for Linux]]. Hponcfg script:
#!/bin/bash
export PATH=/sbin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=/home/mfenn/hp-psp/psp-8.70.rhel5.x86_64.en/hp-health-8.7.0.22-11.rhel5.x86_64/usr/lib:$LD_LIBRARY_PATH
cd /home/mfenn/hp-sstools/ss-scripting-toolkit-linux-8.70/utilities
./hponcfg -f hponcfg-setshared.xml
./hponcfg -f hponcfg-setuser.xml
The rest is ipmitool as normal. The ILO seems to not like issuing command too quickly, hence the sleeps:
#!/bin/sh
IPMITOOL_LAN="ipmitool lan set 2"
/sbin/service ipmi start
bmcip=`/sbin/ifconfig eth0 | awk '/inet addr/ {print $2}' | sed s/addr:// | awk -F. '{print $1 "." $2 "." $3+16 "." $4}'`
$IPMITOOL_LAN ipsrc static
sleep 60
$IPMITOOL_LAN ipaddr $bmcip
sleep 60
$IPMITOOL_LAN netmask 255.255.240.0
sleep 60
$IPMITOOL_LAN defgw ipaddr 10.128.16.100
sleep 60
==== IBM ====
IBM can be standard or nonstandard depending on the server.
=== System x3755 ===
Easy, standard IPMItool:
#!/bin/sh
IPMITOOL_LAN="ipmitool lan set 1"
IPMITOOL_USER="ipmitool user"
PASSWORD="somepasshere"
/sbin/service ipmi start
bmcip=`/sbin/ifconfig eth0 | awk '/inet addr/ {print $2}' | sed s/addr:// | awk -F. '{print $1 "." $2 "." $3+16 "." $4}'`
$IPMITOOL_LAN ipsrc static
$IPMITOOL_LAN ipaddr $bmcip
$IPMITOOL_LAN netmask 255.255.240.0
$IPMITOOL_LAN defgw ipaddr 10.128.16.100
$IPMITOOL_LAN access on
$IPMITOOL_USER set name 2 root
$IPMITOOL_USER set password 2 $PASSWORD
/sbin/service ipmi stop
=== System x3450 794852X ===
Uses IPMItool, but requires some [[http://www-947.ibm.com/support/entry/portal/docdisplay?brand=5000008&lndocid=MIGR-5078398|magic]].
#!/bin/sh
# based on http://www-947.ibm.com/support/entry/portal/docdisplay?brand=5000008&lndocid=MIGR-5078398
IPMITOOL_LAN="ipmitool lan set 1"
IPMITOOL_USER="ipmitool user"
IPMITOOL_RAW="ipmitool raw"
IPMITOOL_CHANNEL="ipmitool channel"
PASSWORD="somepasshere"
/sbin/service ipmi start
$IPMITOOL_RAW 0x30 0x13 0xff 0x0 0x0 0x0
$IPMITOOL_LAN ipsrc static
$IPMITOOL_USER disable 1
$IPMITOOL_USER disable 3
$IPMITOOL_USER disable 4
$IPMITOOL_USER enable 2
$IPMITOOL_USER priv 2 4 1
$IPMITOOL_CHANNEL setaccess 1 2 callin=on ipmi=on link=off privilege=4
$IPMITOOL_USER set name 2 root
$IPMITOOL_USER set password 2 $PASSWORD
$IPMITOOL_USER list 1
$IPMITOOL_RAW 0x6 0x40 0x1 0x42 0x44
$IPMITOOL_RAW 0x6 0x40 0x1 0x82 0x84
$IPMITOOL_LAN arp respond on
$IPMITOOL_LAN auth admin md5
$IPMITOOL_LAN cipher_privs uaaaXXXXXXXXXXX
bmcip=`/sbin/ifconfig eth0 | awk '/inet addr/ {print $2}' | sed s/addr:// | awk -F. '{print $1 "." $2 "." $3+16 "." $4}'`
$IPMITOOL_LAN ipaddr $bmcip
$IPMITOOL_LAN netmask 255.255.240.0
$IPMITOOL_LAN defgw ipaddr 10.128.16.100
/sbin/service ipmi stop