IPMI简介

1、什么是IPMI

    IPMI是智能型平台管理接口(Intelligent Platform Management Interface)的缩写,管理基于 Intel结构的企业系统中所使用的外围设备采用的一种工业标准。
    IPMI信息通过基板管理控制器BMC进行交流。BMC,是底板管理控制器 (Baseboard Management Controller)的缩写,BMC是以嵌入式Linux操作系统为平台,基于IPMI规范协议,实现对服务器的运行状态监控,以及远程控制管理等功能。
    管理员通过IPMI管理界面,能够轻易实现对服务器的管理和监控。
    通俗的说,IPMI就是一个管理服务器的接口。用户无论在开机还是关机的状态下,只要接通电源就可以实现对服务器的监控。通过IPMI接口,管理员可以实现对服务器的带内管理、带外管理、远程管理、统一管理。
    IPMI通过使用低级硬件智能管理,而不使用操作系统进行管理,具有两个主要优点: 首先,此配置允许进行带外服务器管理;其次,操作系统不必负担传输系统状态数据的任务。

2、IPMI主要功能

    1) 可以在服务接通电源(没有启动操作系统)的情况下,对它进行远程管理:开机、关机、重启。
    2) 控制台重定向。可以远程登陆控制台查看修改bios设置、设置系统启动引导方式、远程安装系统、登入系统等,效果相当于直接在服务器上连接一台显示器键盘鼠标执行操作。
    3) 故障日志记录和SNMP 警报发送,访问系统事件日志和传感器状况。
3、IPMI 工作原理
   IPMI的核心是BMC,即基板管理控制器,其并不依赖于服务器的处理器、BIOS或操作系统来工作,是一个单独运行的无代理管理子系统,只要有BMC与IPMI固件(运行在ROM里的只读程序)其便可开始工作,BMC通常是一个安装在服务器主板上的独立板卡。
    在工作时,所有的IPMI功能都是向BMC发送命令来完成的,命令使用IPMI规范中规定的指令,BMC接收并在系统事件日志中记录事件消息,维护描述系统中传感器情况的传感器数据记录。
4、ipmitool工具

实现IPMI协议的工具有多个,以ipmitool工具为例。
  ipmitool 命令需要通过相应的interface来访问BMC,IPMItool命令包含的接口有open、lan、lanplus。

1)本地管理

本地管理,Inband (In-Band),一般是由服务器内安装的操作系统实现,使用应用层工具ipmitool,发送指令通过OS内核提供的接口(如上图①)和bmc进行通信。流程为:服务器本地ipmitool软件-->服务器本地OS内核接口-->服务器硬件bmc

在本地获取信息时候采用的是-I open,即为OpenIPMI接口,其中open是指的是OpenIPMI与 BMC通信。

通过本地管理的方式控制IPMI时,有绝对的权限。不需要知道原始IPMI密码,就可以任意修改任何一个用户的密码。

2)远程管理

远程管理,Outband (Out-of-Band),是由局域网内可联通IPMI地址的操作系统实现,网络(如上图②)以udp报文形式与远端服务器bmc进行通信。流程为:远程OS的ipmitool软件--->网卡(udp)--->服务器硬件bmc

远程获取信息时候采用的是-Ilan/lanplus,Lan和lanplus都是通过Ethernet LAN网用IPV4的udp协议与BMC通信,UDP的数据段包含了IPMI request/resoponse消息,消息具有一个IPMI session 头和RMCP 头。

其中lan/lanplus分别是v1.5/v2.0的标准。

Lan:通过网络UDP,使用RMCP协议;

Lanplus:与Lan相同,但使用RMCP+协议,应用于IPMI v2.0版本。目前,多用lanplus。

5、Ironic中IPMITool的使用

Ironic创建实例的生命周期中,是通过Lanplus的远程管理方式,对服务器进行控制。用到IPMITool的命令有:开关机、重启、获取电源状态;设置引导顺序、获取引导顺序。

1)ironic驱动支持ipmitool

首先,需要修改ironic支持的驱动,在配置文件/etc/ironic/ironic.conf的ennabled_drivers字段添加支持。如果没有配置,默认情况下,ironic使用的是pxe_ipmitool驱动。

2)创建node时,指定驱动

# ironic node-create -d pxe_ipmitool -i ipmi_address=<address> -i ipmi_username=<username> -i ipmi_password=<password>

其中,-d指定使用的驱动, -i指定驱动的信息。一般需要driver_info需要指定如下信息:
    ipmi_address、ipmi_username、ipmi_password、ipmi_port (远程IPMI RMCP端口,默认使用623端口)

若还有其它指定项,例如ironic适配Moonshot之类微服务器,还需要额外指定-B、-b、-T、-t,来指定单个IPMI地址下,多个微卡的偏移地址。

3)ironic程序调用的ipmitool命令

原始结构:(信息基本都是从driver_info中获取)

#ipmitool -I lanplus -H driver_info['address'] -L driver_info['priv_level'] -p driver_info['dest_port']
-U driver_info['username'] -R str(CONF.ipmi.retry_timeout // CONF.ipmi.min_command_interval) -N str(CONF.ipmi.min_command_interval) 

以及可能添加的-B、-b、-T、-t参数。

ipmitool -I lanplus -H 192.168.1.100 -U Administrator -P password -B 0 -T 0x9E -b 7 -t 0x72 chassis bootdev pxe

新创建微服务器某个微卡为裸金属节点:

POST:/v1/nodes

body:

{

"name":"test_Moonshot_node",

"driver":"agent_ipmitool",

"driver_info":{

"ipmi_username":"ADMIN"

"ipmi_password":"password"

"transit_address":0x86

"transit_channel":0

"target_channel":7

"target_address":0x72

"ipmi_bridging":'dual'

}

}

ironic用到的ipmitool命令:

#ipmitool -I lanplus -H 192.168.0.100 -U admin -P 123456 -R 5 -N 12 chassis raw  0x00 0x08 0x03 0x08 
ipmitool -I lanplus -H 192.168.0.100 -U admin -P 123456 -R 5 -N 12 chassis power on
ipmitool -I lanplus -H 192.168.0.100 -U admin -P 123456 -R 5 -N 12 chassis power off
ipmitool -I lanplus -H 192.168.0.100 -U admin -P 123456 -R 5 -N 12 chassis power status
ipmitool -I lanplus -H 192.168.0.100 -U admin -P 123456 -R 5 -N 12 chassis bootdev disk
ipmitool -I lanplus -H 192.168.0.100 -U admin -P 123456 -R 5 -N 12 chassis bootdev pxe

6,IPMI channel

ipmitool -I open lan print 1  打印当前channel 1的信息,显示BMC通道的信息

1)一共有16个channel,如果不知道BMC使用的是哪个通道,需要首先找到所使用的channel:
# for i in `seq 1 16`; do ipmitool lan print $i 2>/dev/null | grep -q ^Set && echo Channel $i; done
Channel 1
然后,使用下面的命令确认:
ipmitool -I open channel info 1

执行命令ipmitool -I open lan print 1 ,可以查看当前BMC的详细信息,包括IP地址及类型、mac、掩码、网关等信息。之后可以使用相关命令进行修改。

ipmitool -I open lan set 1 ipsrc static                设置本地BMC地址为静态,才能设置IP
ipmitool -I open lan set 1 ipaddr 192.168.1.100        设置本地BMC的IP地址
ipmitool -I open lan set 1 netmask 255.255.255.0       子网掩码
ipmitool -I open lan set 1 defgw ipaddr 192.168.1.1    网关
ipmitool user list 1                                   查看BMC用户列表
ipmitool user set name 2 wyp                           对BMC的1号用户设置用户名wyp
ipmitool user set password 2 Passw0rd                  对BMC的1号用户设置密码Passw0rd

2)多数服务器的BMC可以设置两个IP,一个专用接口,一个共享接口。

例如浪潮服务器管理芯片BMC IP设置,IPMI主板集成管理芯片BMC IP 设置,开机按DEL键进入BIOS设置,选择"Server Mgmt"---"BMC Network Configuration"---"lan channel 1/2"---"static ip address"

lan channel 1:指的是复用管理网口,网卡1接口

lan channel 2:指的是IPMI管理专用接口,一般需要设置这个接口

3)ironic_python_agent中channel的使用

在OpenStack最新的P版ironic_python_agent组件hardware.py代码中,get_bmc_address()方法中遍历的channel是1-7,对于部分服务器如果channel为8,则会执行硬件自检错误,需要修改(1,8)为(1,16)

代码链接:

https://github.com/openstack/ironic-python-agent/blob/master/ironic_python_agent/hardware.py

7,IPMI使用问题

1)IPMI安全风险

很多人希望使用IPMI做带外管理。如果直接使用是有问题的。

在OS层面上,是可以随意修改IPMI的设置。也就是说,对于linux来说,有专门的驱动工具ipmitool,可以修改底层IPMI的设置,包括修改IPMI的用户名和密码。

这样在多层级权限场景下就不适合直接做带外管理,只能做带外辅助工具,因为使用者可以随意修改管理员用于管理的账号密码。

2)引导顺序可能导致的问题

bootdev方法设置的引导顺序,只作用一次。效果相当于进入BIOS后通过设置(例如F12)配置One-Time Boot.

If you do have access to IPMI for the box, you may be able to force it to do a one-time boot into the BIOS setup.as follows:

ipmitool -I lanplus -H 192.168.0.100 -U admin -P 123456 -R 5 -N 12 chassis bootdev disk
ipmitool -I lanplus -H 192.168.0.100 -U admin -P 123456 -R 5 -N 12 chassis bootdev pxe

由于引导顺序只作用一次,若部署的裸金属实例有二次重启操作,那么第二次重启的引导顺序不再受ipmitool设置的影响,而是由系统本身的BIOS引导顺序决定。

如果通过ironic调用IPMItool工具,设置系统部署完后从disk引导,此时一次性配置完成并失效,系统从disk启动。但是如果之后系统再次重启后,引导顺序就由BIOS本身设置的引导顺序决定(可以自定义顺序),如果disk引导顺序排序在网络引导之后,则重启之后系统就会一直pxe引导,导致无法正常从磁盘引导进入系统。
规避方法:可以在BIOS设置里,把disk引导优先级高于网络引导优先级。

8,理解ipmi raw命令

raw:发送一个原始的IPMI请求,并且打印回复信息。
http://www.dell.com/downloads/global/power/ps4q07-20070387-Babu.pdf
To help maximize the available BMC capabilities, administrators can instead access hardware functions using raw commands。
Using IPMItool raw commands
The IPMI specification defines many more management capabilities than the IPMItool command-line options can provide.
Administrators can take advantage of these capabilities by framing raw command requests and sending them to BMCs.
IPMItool raw commands have the following format:
ipmitool –I interface options raw netfn cmd data
In this format, interface can be open, lan, or lanplus. If open is used, options is not included;
otherwise, options is -H ipaddress -U username -P password.
The netfn element is the network function,which identifies the functional message class and clusters IPMI commands
into different sets.
The cmd element represents a unique one-byte command value within a given network function. Finally, the data element
provides additional parameters for a request or response, if any.
    Three examples can help demonstrate using raw commands: changing the power cycle interval, creating custom LCD messages, and generating
platform event messages.
9,IPMI在OpenStack的应用
1),Overview
IPMI drivers使用 IPMI 2.0或1.5协议来管理节点。使用  IPMItool开源命令行CLI工具来管理支持IPMI的设备。
下面是使用 IPMItool 来执行电源和管理的hardware types和 classic drivers:
  • hardware types:
    • ipmi
  • classic drivers:
    • agent_ipmitool
    • pxe_ipmitool
    • agent_ipmitool_socat
    • pxe_ipmitool_socat
2),Glossary术语
  • IPMI - Intelligent Platform Management Interface.
  • IPMB - Intelligent Platform Management Bus/Bridge.
  • BMC - Baseboard Management Controller.
  • RMCP - Remote Management Control Protocol.
3),启用IPMItool driver(s)
(3.1),在 ironic.conf 配置文件中,明确的使能 ipmi hardware type
[DEFAULT]
enabled_hardware_types = ipmi
(3.2), pxe_ipmitool classic driver默认开启,如果要开启其他  IPMI classic drivers,则需要在 ironic.conf 配置文件中的 enabled_drivers 中配置,如下,同时开启 pxe_ipmitool and agent_ipmitool
[DEFAULT]
enabled_drivers = pxe_ipmitool,agent_ipmitool
(3.3),重启  Ironic conductor服务
4),使用IPMItool driver注册裸金属节点
使用ipmitool注册裸金属节点
使用 IPMItool drivers的节点需要在driver字段设置硬件类型为ipmi,或者classic drivers支持IPMItool
下面的配置项需要添加到裸金属节点的 driver_info字段中:
ipmi_address:BMC的IP地址或主机名
ipmi_username: 访问BMC的用户名,默认为 NULL用户
ipmi_password: 访问BMC的密码,默认为 NULL
ipmi_port:远程 IPMI RMCP端口, ipmitool 默认使用623
ironic node-create命令可以基于 IPMItool driver,注册一个裸金属节点,例如
ironic node-create -d ipmi -i ipmi_address=<address> \
    -i ipmi_username=<username> -i ipmi_password=<password>
5),高级配置
5.1)  Single/Double bridging functionality
注意:若要使用bridging功能,IPMItool版本需要大于等于1.8.12
基于 IPMItool的drivers支持两种不同的bridging功能: single bridge 和 dual bridge
以下配置需要添加到节点的 driver_info中,bridging才能被使用:
  • ipmi_bridging: bridging类型; 默认值为no; 可修改为single 支持single bridge ,或修改为 dual 支持double bridge.
  • ipmi_local_address: 本地 IPMB地址,用于bridged请求.
    只有当 ipmi_bridging 设置为single或 dual时才需要, 此配置可选配,如果没有配置则会被IPMItool自动发现.

  • ipmi_target_address: bridge请求的目标地址. 只有当 ipmi_bridging 设置为single或dual.时才需要配置。
  • ipmi_target_channel: bridge请求的目标通道channel. 只有当 ipmi_bridging 设置为single或dual.时才需要配置。
Double bridge指定选项:
  • ipmi_transit_address: bridge请求的发送地址. 只有当 ipmi_bridging 设置为single或dual.时才需要配置。
  • ipmi_transit_channel: bridge请求的发送通道channel. 只有当 ipmi_bridging 设置为single或dual.时才需要配置。
 ironic node-update命令可以用于已经使用 IPMItool  driver注册成功的裸金属节点 bridging 信息的设置,例如:
  • Single Bridging:

    ironic node-update add <UUID or name> driver_info/ipmi_local_address=<address> \driver_info/ipmi_bridging=single driver_info/ipmi_target_channel=<channel> \driver_info/ipmi_target_address=<target address>

  • Double Bridging:

    ironic node-update add <UUID or name> driver_info/ipmi_local_address=<address> \
        driver_info/ipmi_bridging=dual driver_info/ipmi_transit_channel=<transit channel> \
        driver_info/ipmi_transit_address=<transit address> driver_info/ipmi_target_channel=<target channel> \
        driver_info/ipmi_target_address=<target address>
5.2) 更改IPMI协议版本
基于 IPMItool的drivers使用IPMI 协议1.5或2.0版本。默认是2.0版本。
如果要修改裸金属节点的IPMI协议版本,可以配置以下选项,设置节点的 driver_info 字段。
ipmi_protocol_version:指定IPMI协议版本
ironic node-update add <UUID or name> driver_info/ipmi_protocol_version=<version>
1.5版本不支持加密。

参考:

https://docs.openstack.org/ironic/pike/admin/drivers/ipmitool.html

http://www.taodocs.com/p-78411748.html

Ironic Key Technologies--IPMI相关推荐

  1. 【ironic】ironic介绍与原理

    [ironic]ironic介绍与原理 零,配置文件 0.1 配置驱动 文件ironic.conf, ipmi硬件类型,默认值也是ipmi, pxe_ipmitool驱动也是默认值,配置驱动 [DEF ...

  2. Openstack Ironic Bare metal 实操

    概述: 纸上得来终觉浅,绝知此事要躬行 Ironic作为Openstack中的一个模块,和Openstack其他模块相互配合工作,用来操作和管理裸机. 虽然官方提供了较全的文档,对我来说,不自己实操一 ...

  3. 先进机器人系统中的关键技术

    先进机器人系统中的关键技术 Key technologies coalesce in advanced robotic systems 就在机器人设计进入商业领域,服务于制造业.物流业和服务业之际,概 ...

  4. 代码改变世界_改变世界,一次只写一行代码

    代码改变世界 People like to look at changing the world as a big task. I believe changing the world can be ...

  5. uber_Uber是如何制成的

    uber by Dmytro Brovkin 由Dmytro Brovkin Uber是如何制成的 (How Uber was made) Uber has transformed the world ...

  6. 渐进式web应用程序_渐进式Web应用程序简介

    渐进式web应用程序 Interested in learning JavaScript? Get my ebook at jshandbook.com 有兴趣学习JavaScript吗? 在jsha ...

  7. NDC 2010视频下载:看看其他微软平台程序员们都在做什么

    原文地址:<NDC 2010视频下载:看看其他微软平台程序员们都在做什么> NDC(Norwegian Developers Conference,挪威开发者大会)是一年一度的挪威最大的微 ...

  8. 基于jquery的ajax聊天室系统,基于jQuery的Ajax聊天室应用毕业设计(含外文翻译)...

    基于jQuery的Ajax聊天室应用毕业设计(含外文翻译) 毕业设计(论文) I 基于基于 jQuery 的的 Ajax 聊天室应用聊天室应用 摘摘 要要 随着网络的逐渐普及,以及网络技术的不断发展, ...

  9. Struts2官网翻译

    翻译一下Struts 2 官网,方便下载:跟踪最新技术等: http://struts.apache.org/ Apache Struts is a free, open-source, MVC fr ...

最新文章

  1. 编程之美:编程判断两个链表是否相交
  2. wordpress启动初始化过程
  3. memcache的深度解析(转)
  4. 本地安装magento无法登陆后台的问题
  5. python datatime 平均值_python-熊猫时间序列:时间戳列的平均值
  6. anaconda navigator更新_Python 数据分析答疑 1:安装 Anaconda
  7. Android系统使用感受——记录我的三星GT-S5830
  8. 【scala】 scala xml 处理(⑨)
  9. flume 整合kafka
  10. fedora html 编辑器,分享|在 Fedora 上使用 Pitivi 编辑视频
  11. 2022年PMP考试模拟题1(含答案解析)
  12. tensorflow cnn文本分类
  13. 《腾讯传》六、“红衣大炮”轰杀“狗日的腾讯”—3Q大战
  14. 学习计算机基本知识,怎样按序学习计算机基本知识
  15. A Comparison of CNN-Based and Hand-Crafted Keypoint Descriptors论文阅读笔记
  16. [高数][高昆轮][高等数学上][第一章-函数与极限]10.闭区间上连续函数的性质
  17. SpringMVC+Mybatis+Maven搭建 简单配置双数据源
  18. 乐高机器人编程主要学什么
  19. 复旦大学计算机专业博士生导师,危辉 - 复旦大学 - 计算机科学技术学院
  20. 关于poi导出excel浏览器不下载的问题

热门文章

  1. 图解跨域请求、反向代理原理,对前端更友好的反向代理服务器 - Caddy
  2. Tor 浏览器存在严重漏洞 或泄露用户真实 IP 地址
  3. 解决app在没有上传app store前大规模安装测试问题的一些办法与思路
  4. [深入研究4G/5G/6G专题-50]: URLLC-16-《3GPP URLLC相关协议、规范、技术原理深度解读》-10-高可靠性技术-1-低编码率编码调制方案MCS与高可靠性DRB
  5. 精准防疫有“利器”| 芯讯通助力数字哨兵护航复市
  6. Flink大数据实时计算系列-Flink的Sliding Windows使用
  7. 【U盘启动盘】Liunx系统制作Windows系统启动盘
  8. [Ynoi2006]rsrams
  9. 程序设计基础之面向对象设计
  10. 前端使用html5、ffmpeg实现录屏摄像等功能