Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

Linux 命令列配置 IPMI 完整指南:ipmitool 設定 IP、網閘、查看狀態

編輯:關於 Linux

IPMI(Intelligent Platform Management Interface) 是伺服器硬體級管理介面,可在作業系統離線、關機狀態下遠端監控硬體狀態、電源控制、KVM over IP 等。本文說明在 Linux 以 ipmitool 指令列配置 IPMI LAN 參數。

IPMI 配置示意圖

配置層級概覽

  1. BIOS/UEFI 階段:開機進入 BIOS,於 Advanced/IPMI 選單設定 IP、子網路遮罩、閘道。
  2. IPMI 獨立韌體介面:開機時依提示按 Ctrl+E 進入 IPMI 設定選單(各廠商熱鍵不同)。
  3. 作業系統層級(Linux ipmitool):本文重點,適合批次自動化、無螢幕伺服器。

Linux 下 ipmitool 配置步驟

1. 啟用 IPMI 服務

service ipmi start
# 或 systemctl start ipmi

2. 設定 LAN 參數(Channel 1 為預設)

# 設定 IP 來源:static 或 dhcp
ipmitool lan set 1 ipsrc static

# 設定靜態 IP
ipmitool lan set 1 ipaddr 192.168.1.2

# 設定子網路遮罩
ipmitool lan set 1 netmask 255.255.255.0

# 設定預設閘道
ipmitool lan set 1 defgw 192.168.1.254

3. 驗證配置

ipmitool lan print 1
# 輸出包含 IP Address, Subnet Mask, Default Gateway, MAC Address 等

Channel 概念與多通道處理

  • 多數伺服器預設啟用 Channel 1。
  • 部分廠商(如 Inspur)預設啟用 Channel 1 與 Channel 3。
  • 若僅使用單一 Channel,建議停用其它 Channel 避免衝突:
ipmitool lan set 3 access off

常用管理指令

指令功能
ipmitool chassis status查看電源狀態
ipmitool chassis power on/off/reset遠端開/關/重啟機
ipmitool sensor list列出所有感測器數值(溫度、風扇、電壓)
ipmitool sel list查看系統事件日誌 (SEL)
ipmitool user list 1列出 Channel 1 使用者帳號
ipmitool user set password 2 <新密碼>修改使用者 2 密碼

自動化腳本範例

#!/bin/bash
# configure_ipmi.sh
IP="192.168.10.100"
MASK="255.255.255.0"
GW="192.168.10.1"
CH=1

service ipmi start
ipmitool lan set $CH ipsrc static
ipmitool lan set $CH ipaddr $IP
ipmitool lan set $CH netmask $MASK
ipmitool lan set $CH defgw $GW
ipmitool lan print $CH

透過 ipmitool 可將 IPMI 配置納入自動化部署流程(Ansible、Kickstart、PXE 後安裝腳本),實現伺服器上架即管理的基礎設施即代碼(IaC)模式。

Copyright © Windows教程網 All Rights Reserved