V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Songxwn
V2EX  ›  分享发现

VMware ESXi 8 使用 IPMITool

  •  1
     
  •   Songxwn · 2023-04-16 09:50:57 +08:00 · 1173 次点击
    这是一个创建于 389 天前的主题,其中的信息可能已经有所发展或是发生改变。

    个人博客: https://songxwn.com/ESXi8_IPMI/

    知乎: https://zhuanlan.zhihu.com/p/622282076

    简介

    本教程适用于在 VMware ESXi 8 上使用 ipmitool 工具进行本地管理 BMC 。

    因 8.0 无法正常安装社区打包的 VIB 版本,所以需要自行编译二进制文件,上传到 esxi 使用。

    7.0 版本之前的建议安装 VIB 包的ipmitools

    IPMITool 可以用来获取和设置服务器带外管理口的网络配置、用户配置、传感器、重启 BMC 等等。

    项目地址:https://github.com/ipmitool/ipmitool

    编译教程

    使用 Ubuntu 18.04 (编译要求的 openssl 较低)

    apt update
    
    apt install gcc-multilib libc6-i386 libc6-dev-i386 wget -y
    
    wget https://nchc.dl.sourceforge.net/project/ipmitool/ipmitool/1.8.18/ipmitool-1.8.18.tar.bz2
    
    tar -xjvf ipmitool-1.8.18.tar.bz2
    
    cd ipmitool-1.8.18/
    
    ./configure CFLAGS=-m64 LDFLAGS=-static
    
    make
    
    # 指定架构为 X86-64 ( ESXi 8 不支持 32bit 程序),且进行静态库编译,防止系统缺依赖库。
    
    
    ls ./src/ipmitool
    
    # 二进制可执行文件路径
    
    

    直接下载编译好的

    下载链接:https://songxwn.com/file/ipmitool

    md5sum src/ipmitool
    5b49339587170d40095b2e6cf5b30007  src/ipmitool
    
    

    PS:注意校验 MD5 值

    在 ESXi 上运行

    1 、开启 ESXi Shell 和 SSH 服务。(使用完成之后建议关闭)

    2 、使用 SSH 登录到 ESXi ,可以使用 SCP 或 SFTP 上传 ipmitool 到 ESXi 的 opt 文件夹

    3 、使用 chmod 命令给予 ipmitool 执行权限。

    scp [email protected]:/root/ipmitool-1.8.18/src/ipmitool /opt/
    
    cd /opt/
    
    [root@localhost:/opt] chmod +x ipmitool 
    
    

    允许 ESXi 8 执行第三方程序

    ESXi 8 为了安全性考虑,不允许第三方程序运行,需要手动禁止。

    # 如果不禁止,就会提示:-sh: ./ipmitool: Operation not permitted
    
    
    
    esxcli system settings advanced set -o /User/execInstalledOnly -i 0
    
    # 关闭安全策略,允许未安装的二进制文件运行
    
    esxcli system settings advanced set -o /User/execInstalledOnly -i 
    
    # 开启安全策略,不允许未安装的二进制文件运行
    
    [root@localhost:/opt] ./ipmitool -V
    ipmitool version 1.8.18 for songxwn.com
    
    # 尝试运行,查看版本。
    
    

    PS:这将允许在主机上执行未安装的二进制文件。未知内容可能会导致类似勒索软件的恶意软件攻击。建议使用之后关闭。

    常用命令(本地管理)

    ipmitool sensor list
    
    # 查看传感器信息
    
    ipmitool lan print
    
    # 查看 ipmi 网络信息
    
    ipmitool lan set 1 ipsrc static
    ipmitool lan set 1 ipaddr 192.168.142.100
    ipmitool lan set 1 netmask 255.255.255.0
    ipmitool lan set 1 defgw ipaddr 192.168.142.1
    
    # 配置静态 IP ,也可以配置使用 VLAN 。1 代表通道,可以用 print 命令确认。
    
    ipmitool user list 1
    
    # 查看用户列表
    
    ipmitool user set password 1 ABC111@
    
    # 将用户 ID 为 1 的用户配置重置密码。
    
    ipmitool mc reset warm
    
    # 重启 BMC
    
    
    2 条回复    2023-04-16 21:51:57 +08:00
    customsshen
        1
    customsshen  
       2023-04-16 21:49:23 +08:00
    按照您这个教程走了一遍 不行啊
    customsshen
        2
    customsshen  
       2023-04-16 21:51:57 +08:00
    可以了 谢谢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2843 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 00:03 · PVG 08:03 · LAX 17:03 · JFK 20:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.