我的博客已迁移到xdoujiang.com请去那边和我交流======================Debian===========================一、Debian安装配置ipmi1、版本cat /etc/debian_version 5.0.22、查询下ipmi安装包apt-cache search ipmiipmitool - utility for IPMI control with kernel driver or LAN interface3、安装ipmitoolapt-get -y install ipmitool --force-yes4、查看已安装的ipmi包dpkg -l|grep ipmiii ipmitool 1.8.9-2 utility for IPMI control with kernel driver or LAN interface5、将ipmivd服务添加到启动项update-rc.d ipmievd defaults6、5.1和5.2二选一查看5.1)、ls /etc/rc2.d/S20ipmievd lrwxrwxrwx 1 root root 17 2014-12-28 11:32 /etc/rc2.d/S20ipmievd -> ../init.d/ipmievd5.2)、sysv-rc-conf --list |grep ipmiipmievd 0:off 1:off 2:on 3:on 4:on 5:on 6:off7、查看相关信息ll /lib/modules/`uname -r`/kernel/drivers/char/ipmitotal 232-rw-r--r-- 1 root root 24164 2009-03-27 15:18 ipmi_devintf.ko-rw-r--r-- 1 root root 59598 2009-03-27 15:18 ipmi_msghandler.ko-rw-r--r-- 1 root root 21698 2009-03-27 15:18 ipmi_poweroff.ko-rw-r--r-- 1 root root 75858 2009-03-27 15:18 ipmi_si.ko-rw-r--r-- 1 root root 39538 2009-03-27 15:18 ipmi_watchdog.ko8、加载ipmi模块modprobe ipmi_si && modprobe ipmi_devintf && modprobe ipmi_msghandler9、查看模块lsmod |grep ipmiipmi_si 43656 0 ipmi_devintf 15632 0 ipmi_msghandler 40308 2 ipmi_si,ipmi_devintf10、相关模块说明1)、ipmi_msghandler(为IPMI接口处理传入和传出的信息)Incoming and outgoing message handler for IPMI interfaces.2)、ipmi_si(一个IPMI的系统消息处理程序接口的驱动程序。该模块支持各种IPMI的系统接口)An IPMI system interface driver for the message handler. This module supports various IPMI system interfaces such as KCS, BT, SMIC, and even SMBus in 2.6 kernels.3)、ipmi_devintf(Linux字符的消息处理设备接口)Linux character device interface for the message handler.11、设置grub参数方便查看Linux启动信息cat /boot/grub/menu.lst|egrep -v "^#|^$"default 2timeout 5color cyan/blue white/bluetitle Debian GNU/Linux, kernel 2.6.26-2-amd64root (hd0,0)kernel /boot/vmlinuz-2.6.26-2-amd64 root=/dev/sda1 console=tty0 console=ttyS1,115200 ro initrd /boot/initrd.img-2.6.26-2-amd64title Debian GNU/Linux, kernel 2.6.26-2-amd64 (single-user mode)root (hd0,0)kernel /boot/vmlinuz-2.6.26-2-amd64 root=/dev/sda1 console=tty0 console=ttyS1,115200 ro singleinitrd /boot/initrd.img-2.6.26-2-amd64PS:添加console=tty0 console=ttyS1,115200在这个配置文件里console=tty0 console=ttyS1,115200参数传递到内核中,实现串口重定向console=tty0 代表显示器输出 console=ttyS0 代表定向到串口1 ,如果是ttyS1代表定向到串口2115200则为串口通信采用的波特率,波特率和bios设置的一样12、通过ipmitool命令还可以对ipmi进行配置1)查看ipmi信息ipmitool lan print 12)设置BMC ip,作为远程管理ipipmitool lan set 1 ipaddr 172.16.*.*3)ip设置成静态ipmitool lan set 1 ipsrc static 4)设置掩码ipmitool lan set 1 netmask 255.255.255.05)设置网关ipmitool lan set 1 defgw ipaddr 0.0.0.06)连接目标终端ipmitool -I lanplus -H 172.16.1. -U root -P 123456 sol activate7)结束目标终端ipmitool -I lanplus -H 172.16.1. -U root -P 123456 sol deactivate8)重启目标终端ipmitool -Ilanplus -H 172.16.1. -U root -P 123456 power reset9)查看电源情况ipmitool -I lanplus -H 172.16.1. -U root -P 123456 power status10)开机ipmitool -I lanplus -H 172.16.1. -U root -P 123456 power on11)关机ipmitool -I lanplus -H 172.16.1. -U root -P 123456 power off12)修改bios启动项为网络启动ipmitool -I lanplus -H 172.16.1. -U root -P 123456 chassis bootdev pxe13)设置channel 1允许访问ipmitool -I open lan set 1 access on14)配置ipmi管理用户ipmitool user set name 2 rootipmitool user set password 2 "123456"15)获取传感器中的各种监测值和该值的监测阈值,包括(CPU温度,电压,风扇转速,电源调制模块温度,电源电压等信息) ipmitool -I open sdr list(ipmitool -I open sensor)16)显示温度ipmitool sdr type TemperatureTemp | 01h | ok | 3.1 | -56 degrees CTemp | 02h | ok | 3.2 | 50 degrees CTemp | 05h | ok | 10.1 | 42 degrees CTemp | 06h | ns | 10.2 | DisabledAmbient Temp | 0Eh | ok | 7.1 | 20 degrees CPlanar Temp | 0Fh | ok | 7.1 | 37 degrees CCPU Temp IF | 76h | ns | 7.1 | DisabledTemp | 0Ah | ok | 8.1 | 31 degrees CTemp | 0Bh | ns | 8.1 | DisabledTemp | 0Ch | unc | 8.1 | 45 degrees CAmbient Temp | 07h | ok | 10.1 | 29 degrees CAmbient Temp | 08h | ns | 10.2 | Disabled当然也可以ipmitool sdr type直接回车ipmitool sdr typeSensor Types: Temperature Voltage Current Fan Physical Security Platform Security Processor Power Supply Power Unit Cooling Device Other Memory Drive Slot / Bay POST Memory Resize System Firmwares Event Logging Disabled Watchdog System Event Critical Interrupt Button Module / Board Microcontroller Add-in Card Chassis Chip Set Other FRU Cable / Interconnect Terminator System Boot Initiated Boot Error OS Boot OS Critical Stop Slot / Connector System ACPI Power State Watchdog Platform Alert Entity Presence Monitor ASIC LAN Management Subsystem Health Battery Session Audit Version Change FRU State17)退出ipmi~.18)保持ssh连接的退出ipmi在使用ipmitool命令进行sol activate连接目标机器时加上-e选项-eUse supplied character for SOL session escape character. The default is to use ~ but this can conflict with ssh sessions.举例(这里的q是自定义 可以随意指定 这样就可以再退出ipmi时保持着ssh sessions)ipmitool -I lanplus -H 172.16.1. -U root -P 123456 -e "q" sol activate[SOL Session operational. Use q? for help]10.1.1.1 login: q. [terminated ipmitool]root@10.1.1.1.:~# 这里实际按的就是q.ipmitool命令参数说明lan用于远程访问,电源管理等。 open用于本地访问。 lanplus用于sol。13、inittab配置(因版本不同 配置有相应的变动)1)配置如下cat /etc/inittab|egrep -v "^#|^$"T1:23:respawn:/sbin/getty -L ttyS1 115200 vt100ipmi必须需要注意 有的时候是ttyS1有的时候ttyS0 根据情况更改ttyS1还是ttyS02)使/etc/inittab配置生效init q (Q or q tell init to re-examine the /etc/inittab file. ) 3)查看ps aux |grep ttyroot 1975 0.0 0.0 3788 548 ttyS1 Ss+ 14:05 0:00 /sbin/getty -L ttyS1 115200 vt100======================Centos===========================二、Centos安装配置ipmi1、发行版本cat /etc/redhat-release CentOS release 6.2 (Final)2、查询下ipmi安装包yum list |grep -i "ipmi"OpenIPMI.x86_64 2.0.16-14.el6 @base OpenIPMI-libs.x86_64 2.0.16-14.el6 @base ipmitool.x86_64 1.8.11-21.el6 @updatesOpenIPMI-devel.i686 2.0.16-14.el6 base OpenIPMI-devel.x86_64 2.0.16-14.el6 base OpenIPMI-libs.i686 2.0.16-14.el6 base OpenIPMI-perl.x86_64 2.0.16-14.el6 base OpenIPMI-python.x86_64 2.0.16-14.el6 base freeipmi.i686 1.2.1-6.el6_5 base freeipmi.x86_64 1.2.1-6.el6_5 base freeipmi-bmc-watchdog.x86_64 1.2.1-6.el6_5 base freeipmi-devel.i686 1.2.1-6.el6_5 base freeipmi-devel.x86_64 1.2.1-6.el6_5 base freeipmi-ipmidetectd.x86_64 1.2.1-6.el6_5 base 3、安装ipmitool OpenIPMIyum -y install ipmitool OpenIPMI4、查看已安装的ipmi包rpm -qa |grep -i "ipmi"OpenIPMI-2.0.16-14.el6.x86_64OpenIPMI-libs-2.0.16-14.el6.x86_64ipmitool-1.8.11-21.el6.x86_645、将ipmi服务添加到启动项chkconfig ipmi on6、5.1和5.2 2选1方式查看是否开机启动1)ls /etc/rc3.d/S13ipmi lrwxrwxrwx 1 root root 14 May 6 16:26 /etc/rc3.d/S13ipmi -> ../init.d/ipmi2)chkconfig --list|grep ipmiipmi 0:off 1:off 2:on 3:on 4:on 5:on 6:off7、启动ipmi服务等于是加载ipmi驱动模块1)/etc/init.d/ipmi startStarting ipmi drivers: [ OK ]2)用服务方式查看模块加载/etc/init.d/ipmi statusipmi_msghandler module in kernel.ipmi_si module in kernel.ipmi_devintf module loaded./dev/ipmi0 exists.3)查看模块加载情况lsmod |grep ipmiipmi_devintf 8049 0 4)查看相关信息ll /lib/modules/`uname -r`/kernel/drivers/char/ipmitotal 84-rwxr--r--. 1 root root 24024 Nov 22 2013 ipmi_devintf.ko-rwxr--r--. 1 root root 19592 Nov 22 2013 ipmi_poweroff.ko-rwxr--r--. 1 root root 40440 Nov 22 2013 ipmi_watchdog.ko8、或直接用modprobe加载上ipmi驱动模块modprobe ipmi_devintf9、相关模块说明1)、ipmi_devintfLinux character device interface for the message handler.10、设置grub参数方便查看Linux启动信息cat /boot/grub/grub.conf|egrep -v "^#|^$"default=0timeout=5title CentOS (2.6.32-220.el6.x86_64) root (hd0,0) kernel /boot/vmlinuz-2.6.32-220.el6.x86_64 ro root=/dev/sda1 selinux=0 console=tty0 console=ttyS1,115200 ro initrd /boot/initramfs-2.6.32-220.el6.x86_64.imgPS:添加console=tty0 console=ttyS1,115200在这个配置文件里console=tty0 console=ttyS1,115200参数传递到内核中,实现串口重定向console=tty0 代表显示器输出 console=ttyS0 代表定向到串口1 ,如果是ttyS1代表定向到串口2115200则为串口通信采用的波特率,波特率和bios设置的一样11、/etc/init/ttyS1.conf配置(因版本不同 配置有相应的变动)1)配置如下cat /etc/init/ttyS1.conf stop on runlevel [S016]respawnexec /sbin/agetty /dev/ttyS0 115200 vt1002)使配置生效start ttyS1ttyS1 start/running, process 279853)查看ps aux |grep ttyroot 2384 0.0 0.0 4132 604 ttyS0 Ss+ Mar23 0:00 /sbin/agetty /dev/ttyS0 115200 vt1004)错误信息解决:modprobe ipmi_si && modprobe ipmi_devintf && modprobe ipmi_msghandlerWARNING: Could not open 'kernel/drivers/char/ipmi/ipmi_msghandler.ko': No such file or directoryFATAL: Could not open 'kernel/drivers/char/ipmi/ipmi_si.ko': No such file or directory如果手动使用modprobe命令出错的话 就先使用depmod解决模块依赖关系 之后再手动加载模块就行了depmod(可检测模块的相依性,供modprobe在安装模块时使用)Linux kernel modules can provide services (called "symbols") for other modules to use (using EXPORT_SYMBOL in the code). If a second module uses this symbol, that second module clearly depends on the first module. These dependencies can get quite complex.三、ipmi的键盘映射Terminate connection #~+.Suspend IPMItool #~+^+ZSend break #~+BPrint escape sequence help #~+?F1 #Esc+1F2 #Esc+2F3 #Esc+3F9 #Esc+9F10 #Esc+0F11 #Esc+!F12 #Esc+@Home #Esc+hEnd #Esc+kInsert #Esc++Delete #Esc+-Page Up #Esc+?Page Down #Esc+/Ctrl+M #Esc+Ctrl+MCtrl+H #Esc+Ctrl+HCtrl+I #Esc+Ctrl+ICtrl+J #Esc+Ctrl+JAlt+x (where x is any letter) #Esc+X+xCtrl+Alt+Del #Esc+R+Esc+r+Esc+R四、参考文章http://blog.chinaunix.net/uid-28705339-id-3513250.htmlhttp://www.ibm.com/developerworks/cn/linux/l-ipmi/index.html