通过ipmitool找回遗忘的iDrac地址
Background:
在使用Dell服务器的过程中,如果发生一下情况:可以进入系统,但是忘记iDrac卡的地址,在系统的某个Linux下,可以使用ipmitool这个工具来get一下硬件的信息,从而也能获得iDrac的地址。
ipmitool是什么:
对于我这类网工来说,百度百科给的解释已经够用了,简单说就是“IPMI(Intelligent Platform Management Interface)即智能平台管理接口是使硬件管理具备“智能化”的新一代通用接口标准。用户可以利用 IPMI 监视服务器的物理特征,如温度、电压、电扇工作状态、电源供应以及机箱入侵等。(来自百度百科的词条解释)”。
在IBM的官网上的一张图片也很有意思:
当然想要使用ipmi的话,需要先安装,默认的许多Linux是没有的,具体版本记不清了,Ubuntu和CentOS都是默认不带的。Ubuntu安装的方法如下,其实一个apt-get就搞定了,出那么一大坨东西,其实就是让你选个Y,然后就装好了。
root@cn-pek1-ubuntu-1:~# ipmitool lan print The program 'ipmitool' is currently not installed. You can install it by typing: apt-get install ipmitool root@cn-pek1-ubuntu-1:~# apt-get install ipmitool Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libopenipmi0 libperl5.18 libsensors4 libsnmp-base libsnmp30 openipmi Suggested packages: lm-sensors snmp-mibs-downloader The following NEW packages will be installed: ipmitool libopenipmi0 libperl5.18 libsensors4 libsnmp-base libsnmp30 openipmi 0 upgraded, 7 newly installed, 0 to remove and 120 not upgraded. Need to get 2,459 kB of archives. After this operation, 9,189 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main libsensors4 i386 1:3.3.4-2ubuntu1 [26.1 kB] Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main libperl5.18 i386 5.18.2-2ubuntu1 [624 kB] Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty/main libsnmp-base all 5.7.2~dfsg-8.1ubuntu3 [203 kB] Get:4 http://us.archive.ubuntu.com/ubuntu/ trusty/main libsnmp30 i386 5.7.2~dfsg-8.1ubuntu3 [735 kB] Get:5 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/universe ipmitool i386 1.8.13-1ubuntu0.1 [325 kB] Get:6 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main libopenipmi0 i386 2.0.18-0ubuntu7.1 [425 kB] Get:7 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main openipmi i386 2.0.18-0ubuntu7.1 [121 kB] Fetched 2,459 kB in 20s (119 kB/s) Selecting previously unselected package libsensors4:i386. (Reading database ... 56122 files and directories currently installed.) Preparing to unpack .../libsensors4_1%3a3.3.4-2ubuntu1_i386.deb ... Unpacking libsensors4:i386 (1:3.3.4-2ubuntu1) ... Selecting previously unselected package libperl5.18. Preparing to unpack .../libperl5.18_5.18.2-2ubuntu1_i386.deb ... Unpacking libperl5.18 (5.18.2-2ubuntu1) ... Selecting previously unselected package libsnmp-base. Preparing to unpack .../libsnmp-base_5.7.2~dfsg-8.1ubuntu3_all.deb ... Unpacking libsnmp-base (5.7.2~dfsg-8.1ubuntu3) ... Selecting previously unselected package libsnmp30:i386. Preparing to unpack .../libsnmp30_5.7.2~dfsg-8.1ubuntu3_i386.deb ... Unpacking libsnmp30:i386 (5.7.2~dfsg-8.1ubuntu3) ... Selecting previously unselected package ipmitool. Preparing to unpack .../ipmitool_1.8.13-1ubuntu0.1_i386.deb ... Unpacking ipmitool (1.8.13-1ubuntu0.1) ... Selecting previously unselected package libopenipmi0. Preparing to unpack .../libopenipmi0_2.0.18-0ubuntu7.1_i386.deb ... Unpacking libopenipmi0 (2.0.18-0ubuntu7.1) ... Selecting previously unselected package openipmi. Preparing to unpack .../openipmi_2.0.18-0ubuntu7.1_i386.deb ... Unpacking openipmi (2.0.18-0ubuntu7.1) ... Processing triggers for man-db (2.6.7.1-1) ... Processing triggers for ureadahead (0.100.0-16) ... ureadahead will be reprofiled on next reboot Setting up libsensors4:i386 (1:3.3.4-2ubuntu1) ... Setting up libperl5.18 (5.18.2-2ubuntu1) ... Setting up libsnmp-base (5.7.2~dfsg-8.1ubuntu3) ... Setting up libsnmp30:i386 (5.7.2~dfsg-8.1ubuntu3) ... Setting up ipmitool (1.8.13-1ubuntu0.1) ... * Starting IPMI event daemon Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory Could not set IPMB address: Bad file descriptor ipmievd: using pidfile /var/run/ipmievd.pid0 Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory Unable to open interface ...fail! invoke-rc.d: initscript ipmievd, action "start" failed. Unable to start ipmievd during installation. Trying to disable. Setting up libopenipmi0 (2.0.18-0ubuntu7.1) ... Setting up openipmi (2.0.18-0ubuntu7.1) ... Processing triggers for libc-bin (2.19-0ubuntu6) ... Processing triggers for ureadahead (0.100.0-16) ... root@cn-pek1-ubuntu-1:~#
安装好了之后,还有一步要做的就是载入支持 ipmi 功能的系统模块,这个步骤在IBM那个页面上也提到了,我自己的简单的理解就是安装驱动,也许这么理解是不对的
root@linux:~ # modprobe ipmi_msghandler
root@linux:~ # modprobe ipmi_devintf
root@linux:~ # modprobe ipmi_si
用这三条命令,就可以完成了,下面IPMI就可以使用了。
下面这个ipmitool lan print是一条显示lan的相关信息的命令,这里头就可以看到iDrac的地址了。
root@cn-pek1-ubuntu-1:~# ipmitool lan print Set in Progress : Set Complete Auth Type Support : NONE MD2 MD5 PASSWORD Auth Type Enable : Callback : MD2 MD5 : User : MD2 MD5 : Operator : MD2 MD5 : Admin : MD2 MD5 : OEM : IP Address Source : Static Address IP Address : 10.19.90.97 Subnet Mask : 255.255.255.0 MAC Address : f0:1f:af:ec:0e:73 SNMP Community String : public IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10 BMC ARP Control : ARP Responses Enabled, Gratuitous ARP Disabled Gratituous ARP Intrvl : 2.0 seconds Default Gateway IP : 10.19.90.1 Default Gateway MAC : 00:00:00:00:00:00 Backup Gateway IP : 0.0.0.0 Backup Gateway MAC : 00:00:00:00:00:00 802.1q VLAN ID : Disabled 802.1q VLAN Priority : 0 RMCP+ Cipher Suites : 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14 Cipher Suite Priv Max : Xaaaaaaaaaaaaaa : X=Cipher Suite Unused : c=CALLBACK : u=USER : o=OPERATOR : a=ADMIN : O=OEM root@cn-pek1-ubuntu-1:~#
当然IPMI的功能不仅限于此,还有N多命令可以拿来好好耍耍。