環境準備:#
(1)使用腳本安裝 docker、docker-compose
bash <(curl -sSL https://linuxmirrors.cn/docker.sh)
(2)配置鏡像加速
vi /etc/docker/daemon.json
{
"data-root": "/data/dockerData",
"registry-mirrors": ["https://registry.cn-hangzhou.aliyuncs.com",
"https://huecker.io",
"https://docker.rainbond.cc",
"https://dockerhub.timeweb.cloud",
"https://dockerhub.icu",
"https://docker.registry.cyou",
"https://docker-cf.registry.cyou",
"https://dockercf.jsdelivr.fyi",
"https://docker.jsdelivr.fyi",
"https://dockertest.jsdelivr.fyi",
"https://mirror.aliyuncs.com",
"https://dockerproxy.com",
"https://mirror.baidubce.com",
"https://docker.m.daocloud.io",
"https://docker.nju.edu.cn",
"https://docker.mirrors.sjtug.sjtu.edu.cn",
"https://docker.mirrors.ustc.edu.cn",
"https://mirror.iscas.ac.cn",
"https://docker.rainbond.cc",
"https://docker.kubesre.xyz"],
"log-driver":"json-file",
"log-opts":{"max-size" :"50m","max-file":"3"}
}
(3)啟動 docker 服務
systemctl start docker
systemctl enable docker
systemctl status docker
部署 IPMI Simulator 容器#
(1)在 IPMI Simulator 官方倉庫中下載源碼包
(2)下載完成並解壓後,修改 Dockerfile 文件
FROM alpine
LABEL maintainer="[email protected]"
RUN apk --update --no-cache add openipmi-lanserv
# Create the directories that will be used to persist state information
# for the IPMI simulator instance.
RUN mkdir -p /tmp/chassis
COPY . /tmp/ipmisim
# 新加部分
RUN chmod +x /tmp/ipmisim/bin/chassis_control.sh
# 新加部分
EXPOSE 623
EXPOSE 623/udp
CMD ["ipmi_sim", "-n", "-c", "/tmp/ipmisim/lan.conf", "-f", "/tmp/ipmisim/sim.emu"]
(3)生成鏡像文件,運行容器
docker build -f Dockerfile -t vaporio/ipmi-simulator .
docker run -d --name ipmi-simulator --restart always -p 623:623/udp -p 623:623/tcp vaporio/ipmi-simulator
(4) 配置防火牆策略
firewall-cmd --add-port=623/tcp --permanent
firewall-cmd --add-port=623/udp --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --list-all
(5)在主機上查看模擬 IPMI 的底盤和電源狀態
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN chassis status
System Power : on
Power Overload : false
Power Interlock : inactive
Main Power Fault : false
Power Control Fault : false
Power Restore Policy : always-off
Last Power Event :
Chassis Intrusion : inactive
Front-Panel Lockout : inactive
Drive Fault : false
Cooling/Fan Fault : false
擴展命令:
IPMI 設備的電源狀態
#打開
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN chassis power on
#關閉
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN chassis power off
#重啟
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN chassis power reset
#標識機箱(使指示燈閃爍)
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN chassis identify 5
讀取系統狀態
#顯示系統傳感器
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN sensor list
#顯示系統現有可替代器件列表
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN fru list
#顯示系統SDR Repository設備列表
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN sdr list
#顯示系統平台事件過濾的列表
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN pef filter list
#顯示系統平台策略列表
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN pef policy list
系統日誌
#顯示所有系統事件日誌
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN sel elist
#顯示當前BMC的時間
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN sel time get
#修改當前BMC的時間
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN sel time set "09/25/2024 18:29:20"
系統相關
#查看BMC信息
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN bmc info
#BMC冷啟動
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN bmc reset cold
#BMC啟動
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN bmc reset warm
#顯示系統默認通道
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN channel info
#顯示所有用戶
ipmitool -I lan -H 主機ip -p 623 -U ADMIN -P ADMIN user list