How to use ipmitool to manage server

Jephe Wu - http://linuxtechres.blogspot.com 
Objective: to use ipmitool under Linux to remote manage servers


Steps:

1. References
http://docs.oracle.com/cd/E19469-01/820-6413-13/IPMI_Overview.html#50446406_95669  Sun server ipmi usage example
http://linux.die.net/man/1/ipmitool   ipmi man page

2. Check if the ipmi port is open
root@jephe:~/bin# nmap -sU -p 623 172.17.2.10

Starting Nmap 5.00 ( http://nmap.org ) at 2013-06-18 20:48 EST
Interesting ports on 172.17.2.10:
PORT    STATE         SERVICE
623/udp open|filtered asf-rmcp

Note: open|filtered doesn't mean it's definitely open. If it shows 'closed' , it means really closed.

how to check if tcp port is open
a. use nmap -sS or nmap -sT
root@jephe ~/bin# nmap -sS -p 22 server1

Starting Nmap 5.00 ( http://nmap.org ) at 2013-06-18 21:00 EST
Interesting ports on server1:
PORT   STATE SERVICE
22/tcp open  ssh

Nmap done: 1 IP address (1 host up) scanned in 0.33 seconds

b. use nc -vz
[root@jephe ~]# nc -vz ovms04 22
Connection to ovms04 22 port [tcp/ssh] succeeded!

3. enable ipmi through CLI or GUI
ssh into DRAC/LOM/ILO NIC, run
-> set /SP/services/ipmi servicestate=enabled
Set ‘servicestate’ to ‘enabled’

4. usage example for ipmitool
[root@ovms03 ~]# ipmitool -H 172.17.2.11 -U root -P calvin chassis status
[root@ovms03 ~]# ipmitool -H 172.17.2.12 -U root -P changeme chassis status

5. useful commands for ipmi

 ipmitool -I lanplus -C 1 -H 172.17.1.17 -U root -P changeme sel list


 ipmitool  -H 172.17.1.12 -U root -P calvin sdr 

[root@ovmm01 /]# ipmitool chassis bootparam
bootparam get <param #>
bootparam set bootflag <flag>
  force_pxe   : Force PXE boot
  force_disk  : Force boot from default Hard-drive
  force_safe  : Force boot from default Hard-drive, request Safe Mode
  force_diag  : Force boot from Diagnostic Partition
  force_cdrom : Force boot from CD/DVD
  force_bios  : Force boot into BIOS Setup

Power On the Host
$ipmitool -H 1.2.3.4 -v -I lanplus -U username -P userpassword chassis power on

Power Off the Host
$ ipmitool -H 1.2.3.4 -v -I lanplus -U username -P userpassword chassis power off

Power Cycle the Host
$ ipmitool -H 1.2.3.4 -v -I lanplus -U username -P userpassword chassis power cycle

Shut Down the Host Gracefully
$ ipmitool -H 1.2.3.4 -v -I lanplus -U username -P userpassword chassis power soft