VMware ESXi 8 使用IPMITool

本文最后更新于 2024年3月26日 下午

简介

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

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

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

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

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

编译教程

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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

1
2
3
md5sum src/ipmitool
5b49339587170d40095b2e6cf5b30007 src/ipmitool

PS:注意校验MD5值

在ESXi 上运行

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

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

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

1
2
3
4
5
6
scp root@192.168.0.1:/root/ipmitool-1.8.18/src/ipmitool /opt/

cd /opt/

[root@localhost:/opt] chmod +x ipmitool

允许ESXi 8 执行第三方程序

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 如果不禁止,就会提示:-sh: ./ipmitool: Operation not permitted



esxcli system settings advanced set -o /User/execInstalledOnly -i 0

# 关闭安全策略,允许未安装的二进制文件运行

esxcli system settings advanced set -o /User/execInstalledOnly -i 1

# 开启安全策略,不允许未安装的二进制文件运行

[root@localhost:/opt] ./ipmitool -V
ipmitool version 1.8.18 for songxwn.com

# 尝试运行,查看版本。

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

常用命令(本地管理)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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

参考

https://www.truesec.com/hub/blog/esxi-8-0-and-execinstalledonly-the-good-the-bad-and-the-ugly

https://www.geekzu.cn/archives/compile-ipmitool-for-vmware-esxi-server.html

https://www.zhaowenyu.com/linux-doc/ipmi/ipmitool.html

https://blog.csdn.net/liwei924/article/details/80529881

https://vswitchzero.com/ipmitool-vib/


VMware ESXi 8 使用IPMITool
https://songxwn.com/ESXi8_IPMI/
作者
Song
发布于
2023年4月15日
更新于
2024年3月26日
许可协议