用 IPMI 远程重启机器
•
服务器主板通常支持 IPMI,是主板上的硬件控制的,可以获取一个 IP 远程重启系统,妈妈再也不用担心机器挂掉了。首先安装 ipmitool、加载内核模块,就会生成 /dev/ipmi0
设备。然后进行网络配置。
apt-get install ipmitool
modprobe ipmi_devintf
ipmitool lan set 1 ipsrc dhcp
ipmitool lan set 1 arp respond on
ipmitool lan set 1 auth ADMIN MD5
ipmitool lan set 1 access on
然后检查 IPMI 网卡的网络配置:
# ipmitool lan print 1
Set in Progress : Set Complete
Auth Type Support : NONE MD5 PASSWORD
Auth Type Enable : Callback :
: User :
: Operator :
: Admin : MD5
: OEM :
IP Address Source : DHCP Address
IP Address : 114.214.197.69
Subnet Mask : 255.255.255.0
MAC Address : 00:15:17:65:03:0a
SNMP Community String :
IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
BMC ARP Control : ARP Responses Enabled, Gratuitous ARP Disabled
Gratituous ARP Intrvl : 2.0 seconds
Default Gateway IP : 114.214.197.254
Default Gateway MAC : 00:00:00:00:00:00
Backup Gateway IP : 0.0.0.0
Backup Gateway MAC : 00:00:00:00:00:00
RMCP+ Cipher Suites : 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
Cipher Suite Priv Max : XXXXXXXXXXXXXXX
: X=Cipher Suite Unused
: c=CALLBACK
: u=USER
: o=OPERATOR
: a=ADMIN
: O=OEM
继续设置管理员用户和密码:
ipmitool user set name 2 admin
ipmitool user set password 2
# 这里输入密码
ipmitool channel setaccess 1 2 link=on ipmi=on callin=on privilege=4
ipmitool user enable 2
然后检查用户密码设置:
# ipmitool user list 1
ID Name Callin Link Auth IPMI Msg Channel Priv Limit
2 admin true true true ADMINISTRATOR
现在就算是配好了。
软重启机器:
ipmitool -U admin -H $hostname power cycle
硬重启机器:
ipmitool -U admin -H $hostname power reset
多谢 @zhsj 给我们科普!