设为首页收藏本站
网站公告 | 这是第一条公告
     

 找回密码
 立即注册
缓存时间00 现在时间00 缓存数据 对自己狠一点,逼自己努力,再过几年你将会感谢今天发狠的自己、恨透今天懒惰自卑的自己。晚安!

对自己狠一点,逼自己努力,再过几年你将会感谢今天发狠的自己、恨透今天懒惰自卑的自己。晚安!

查看: 927|回复: 3

Linux之ipmitool管理BMC详解

[复制链接]

  离线 

TA的专栏

  • 打卡等级:热心大叔
  • 打卡总天数:230
  • 打卡月天数:0
  • 打卡总奖励:3470
  • 最近打卡:2025-09-14 01:35:35
等级头衔

等級:晓枫资讯-上等兵

在线时间
0 小时

积分成就
威望
0
贡献
445
主题
395
精华
0
金钱
4754
积分
899
注册时间
2023-1-4
最后登录
2025-9-14

发表于 2024-11-30 22:09:12 | 显示全部楼层 |阅读模式
目录


  • BMC管理 – ipmitool

    • 老规矩,先 help看看参数
    • 常用的ipmitool命令
    • 关于OS下设定BMC或远程控制服务器的BMC命令等
    • 通过IPMI-over-LAN连接到BMC并进行远程控制的步骤

  • 总结

BMC管理 – ipmitool


老规矩,先 help看看参数
  1. [root@test ~]# ipmitool -h
  2. ipmitool version 1.8.18

  3. usage: ipmitool [options...] <command>

  4.        -h             This help
  5.        -V             Show version information
  6.        -v             Verbose (can use multiple times)
  7.        -c             Display output in comma separated format
  8.        -d N           Specify a /dev/ipmiN device to use (default=0)
  9.        -I intf        Interface to use
  10.        -H hostname    Remote host name for LAN interface
  11.        -p port        Remote RMCP port [default=623]
  12.        -U username    Remote session username
  13.        -f file        Read remote session password from file
  14.        -z size        Change Size of Communication Channel (OEM)
  15.        -S sdr         Use local file for remote SDR cache
  16.        -D tty:b[:s]   Specify the serial device, baud rate to use
  17.                       and, optionally, specify that interface is the system one
  18.        -4             Use only IPv4
  19.        -6             Use only IPv6
  20.        -a             Prompt for remote password
  21.        -Y             Prompt for the Kg key for IPMIv2 authentication
  22.        -e char        Set SOL escape character
  23.        -C ciphersuite Cipher suite to be used by lanplus interface
  24.        -k key         Use Kg key for IPMIv2 authentication
  25.        -y hex_key     Use hexadecimal-encoded Kg key for IPMIv2 authentication
  26.        -L level       Remote session privilege level [default=ADMINISTRATOR]
  27.                       Append a '+' to use name/privilege lookup in RAKP1
  28.        -A authtype    Force use of auth type NONE, PASSWORD, MD2, MD5 or OEM
  29.        -P password    Remote session password
  30.        -E             Read password from IPMI_PASSWORD environment variable
  31.        -K             Read kgkey from IPMI_KGKEY environment variable
  32.        -m address     Set local IPMB address
  33.        -b channel     Set destination channel for bridged request
  34.        -t address     Bridge request to remote target address
  35.        -B channel     Set transit channel for bridged request (dual bridge)
  36.        -T address     Set transit address for bridge request (dual bridge)
  37.        -l lun         Set destination lun for raw commands
  38.        -o oemtype     Setup for OEM (use 'list' to see available OEM types)
  39.        -O seloem      Use file for OEM SEL event descriptions
  40.        -N seconds     Specify timeout for lan [default=2] / lanplus [default=1] interface
  41.        -R retry       Set the number of retries for lan/lanplus interface [default=4]

  42. Interfaces:
  43.         open          Linux OpenIPMI Interface [default]
  44.         imb           Intel IMB Interface
  45.         lan           IPMI v1.5 LAN Interface
  46.         lanplus       IPMI v2.0 RMCP+ LAN Interface
  47.         serial-terminal  Serial Interface, Terminal Mode
  48.         serial-basic  Serial Interface, Basic Mode
  49.         usb           IPMI USB Interface(OEM Interface for AMI Devices)

  50. Commands:
  51.         raw           Send a RAW IPMI request and print response
  52.         i2c           Send an I2C Master Write-Read command and print response
  53.         spd           Print SPD info from remote I2C device
  54.         lan           Configure LAN Channels
  55.         chassis       Get chassis status and set power state
  56.         power         Shortcut to chassis power commands
  57.         event         Send pre-defined events to MC
  58.         mc            Management Controller status and global enables
  59.         sdr           Print Sensor Data Repository entries and readings
  60.         sensor        Print detailed sensor information
  61.         fru           Print built-in FRU and scan SDR for FRU locators
  62.         gendev        Read/Write Device associated with Generic Device locators sdr
  63.         sel           Print System Event Log (SEL)
  64.         pef           Configure Platform Event Filtering (PEF)
  65.         sol           Configure and connect IPMIv2.0 Serial-over-LAN
  66.         tsol          Configure and connect with Tyan IPMIv1.5 Serial-over-LAN
  67.         isol          Configure IPMIv1.5 Serial-over-LAN
  68.         user          Configure Management Controller users
  69.         channel       Configure Management Controller channels
  70.         session       Print session information
  71.         dcmi          Data Center Management Interface
  72.         nm            Node Manager Interface
  73.         sunoem        OEM Commands for Sun servers
  74.         kontronoem    OEM Commands for Kontron devices
  75.         picmg         Run a PICMG/ATCA extended cmd
  76.         fwum          Update IPMC using Kontron OEM Firmware Update Manager
  77.         firewall      Configure Firmware Firewall
  78.         delloem       OEM Commands for Dell systems
  79.         shell         Launch interactive IPMI shell
  80.         exec          Run list of commands from file
  81.         set           Set runtime variable for shell and exec
  82.         hpm           Update HPM components using PICMG HPM.1 file
  83.         ekanalyzer    run FRU-Ekeying analyzer using FRU files
  84.         ime           Update Intel Manageability Engine Firmware
  85.         vita          Run a VITA 46.11 extended cmd
  86.         lan6          Configure IPv6 LAN Channels
复制代码
ipmitool命令的基本格式是:
  1. ipmitool [选项] <命令> [参数]
复制代码
其中:

    1. 选项
    复制代码
    是一些可选的开关,用于设置ipmitool的一些参数。
    1. 命令
    复制代码
    是要执行的操作,如获取传感器信息等。
    1. 参数
    复制代码
    是可选的,它们是指定要执行的特定操作所需的选项和值。

常用的ipmitool命令

1.获取传感器信息
  1. ipmitool sensor get <Sensor ID>
复制代码
其中,
  1. <Sensor ID>
复制代码
是要获取的传感器的ID。
此命令将显示指定传感器的当前状态。
2.显示系统信息
  1. ipmitool fru print
复制代码
此命令将打印系统中所有可用的FRU(固件可重编程单元)信息。
3.电源控制
  1. ipmitool power on   开启电源
  2. ipmitool power off        关闭电源
  3. ipmitool power reset        重置电源,按我的理解是没有完全断电的动作,类似系统的reboot
  4. ipmitool power cycle        先关闭电源,再开启
复制代码
这些命令用于控制服务器的电源状态。
4.显示事件日志
  1. ipmitool sel list
复制代码
此命令将显示系统的事件日志。
5.启用/禁用BMC用户
  1. ipmitool user enable <用户ID>
  2. ipmitool user disable <用户ID>
复制代码
这些命令用于启用或禁用BMC用户。
以上是一些常用的ipmitool命令和它们的基本用法。
更多的ipmitool命令和选项可以通过
  1. ipmitool -h
复制代码
命令查看完整的帮助文档。

关于OS下设定BMC或远程控制服务器的BMC命令等

ipmitool可以通过IPMI-over-LAN(基于LAN的IPMI协议)来远程控制BMC。
要使用IPMI-over-LAN,您需要确保BMC已经配置并连接到网络。

通过IPMI-over-LAN连接到BMC并进行远程控制的步骤

1.确定BMC的IP地址
使用
  1. ipmitool lan print
复制代码
命令可以获取BMC的IP地址、MAC地址和子网掩码等信息。
如果BMC未配置IP地址,则需要在本地物理访问服务器以配置BMC。
2.连接到BMC
使用
  1. ipmitool lan set <参数>
复制代码
命令设置BMC的用户名、密码和IP地址等信息。
例如,下面的命令设置BMC的IP地址为192.168.1.100,并将用户名设置为admin,密码设置为password:
  1. ipmitool lan set 1 ipsrc static
  2. ipmitool lan set 1 ipaddr 192.168.1.100
  3. ipmitool lan set 1 netmask 255.255.255.0
  4. ipmitool lan set 1 defgw ipaddr 192.168.1.1
  5. ipmitool user set name 2 admin
  6. ipmitool user set password 2 password
复制代码
注意:
这里假设BMC使用的是默认的LAN通道1。
如果使用的是其他通道,则需要将
  1. 1
复制代码
替换为相应通道的数字。
3.启用IPMI-over-LAN功能
使用
  1. ipmitool channel info <通道号>
复制代码
命令检查BMC所在通道的IPMI-over-LAN功能是否已经启用。
如果未启用,可以使用以下命令启用:
  1. ipmitool channel setaccess <通道号> 2 ipmi=on auth=off link=on privilege=4
复制代码
这将启用指定通道的IPMI-over-LAN功能,并使得通过此通道的IPMI会话的权限级别为4(ADMINISTRATOR级别)。
4.连接到远程BMC
使用以下命令连接到远程BMC:
  1. ipmitool -H <BMC IP地址> -U <用户名> -P <密码> -I lanplus <命令>
复制代码
注意,这里使用了
  1. -I lanplus
复制代码
选项,以使用基于LAN的IPMI协议。
  1. <命令>
复制代码
是您要执行的ipmitool命令。
例如:
要获取传感器信息,可以使用以下命令:
  1. ipmitool -H 192.168.1.100 -U admin -P password -I lanplus sensor list
复制代码
这将显示远程BMC的传感器列表信息。

总结

以上是通过ipmitool进行远程BMC控制的基本步骤。
请注意,远程BMC的访问权限应该是受限的,只有授权用户才能访问。此外,您还应该确保网络安全措施已经得到了应用,以确保远程访问的安全性。
这些仅为个人经验,希望能给大家一个参考,也希望大家多多支持晓枫资讯。

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
晓枫资讯-科技资讯社区-免责声明
免责声明:以上内容为本网站转自其它媒体,相关信息仅为传递更多信息之目的,不代表本网观点,亦不代表本网站赞同其观点或证实其内容的真实性。
      1、注册用户在本社区发表、转载的任何作品仅代表其个人观点,不代表本社区认同其观点。
      2、管理员及版主有权在不事先通知或不经作者准许的情况下删除其在本社区所发表的文章。
      3、本社区的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,举报反馈:点击这里给我发消息进行删除处理。
      4、本社区一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
      5、以上声明内容的最终解释权归《晓枫资讯-科技资讯社区》所有。
http://bbs.yzwlo.com 晓枫资讯--游戏IT新闻资讯~~~

  离线 

TA的专栏

等级头衔

等級:晓枫资讯-列兵

在线时间
0 小时

积分成就
威望
0
贡献
0
主题
0
精华
0
金钱
21
积分
22
注册时间
2022-12-29
最后登录
2022-12-29

发表于 2024-12-6 08:38:37 | 显示全部楼层
顶顶更健康!!!
http://bbs.yzwlo.com 晓枫资讯--游戏IT新闻资讯~~~

  离线 

TA的专栏

等级头衔

等級:晓枫资讯-列兵

在线时间
0 小时

积分成就
威望
0
贡献
0
主题
0
精华
0
金钱
14
积分
8
注册时间
2022-12-28
最后登录
2022-12-28

发表于 2025-4-6 09:46:28 | 显示全部楼层
路过,支持一下
http://bbs.yzwlo.com 晓枫资讯--游戏IT新闻资讯~~~

  离线 

TA的专栏

等级头衔

等級:晓枫资讯-列兵

在线时间
0 小时

积分成就
威望
0
贡献
0
主题
0
精华
0
金钱
19
积分
18
注册时间
2022-12-25
最后登录
2022-12-25

发表于 3 天前 | 显示全部楼层
感谢楼主,顶。
http://bbs.yzwlo.com 晓枫资讯--游戏IT新闻资讯~~~
严禁发布广告,淫秽、色情、赌博、暴力、凶杀、恐怖、间谍及其他违反国家法律法规的内容。!晓枫资讯-社区
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1楼
2楼
3楼
4楼

手机版|晓枫资讯--科技资讯社区 本站已运行

CopyRight © 2022-2025 晓枫资讯--科技资讯社区 ( BBS.yzwlo.com ) . All Rights Reserved .

晓枫资讯--科技资讯社区

本站内容由用户自主分享和转载自互联网,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。

如有侵权、违反国家法律政策行为,请联系我们,我们会第一时间及时清除和处理! 举报反馈邮箱:点击这里给我发消息

Powered by Discuz! X3.5

快速回复 返回顶部 返回列表