概要
IPMI(Intelligent Platform Management Interface)が便利すぎるので、よく使うものをまとめた。
どんな不便が解消できるのか
どう便利になるか
- リモートからコマンドを2つ実行し、待っているだけ。連打する必要もない。
- リモートからコマンドを1つ実行するだけ。
- リモートからできる。モニタもキーボードも接続不要。
どうやるのか
何はともあれ先に結論を。冒頭の例に応える形で具体例を以て。
- キーを連打やタイミング待ち不要でBIOSに入る
ipmitool -I lanplus -H IPアドレス -U ユーザ名 -P パスワード chassis bootdev bios ipmitool -I lanplus -H IPアドレス -U ユーザ名 -P パスワード power cycle
- リモートからマシンを強制リセットする
ipmitool -I lanplus -H IPアドレス -U ユーザ名 -P パスワード power cycle
- リモートからBIOS設定をする
ipmitool -I lanplus -H IPアドレス -U ユーザ名 -P パスワード sol activate
※BIOS設定画面に入っている前提とする。入っていない場合は1つ目の例を実施すれば良い。
前提
遅くなったけど前提。
IPMI搭載機器例
コマンド紹介
powerコマンド
電源の状態を表示
構文
ipmitool -I lanplus -H IPアドレス -U ユーザ名 -P パスワード power status
実行結果
[root@client ~]# ipmitool -I lanplus -H 172.16.0.102 -U Administrator -P Administrator power status Chassis Power is on
電源オン
構文
ipmitool -I lanplus -H IPアドレス -U ユーザ名 -P パスワード power on
実行結果
[root@client ~]# ipmitool -I lanplus -H 172.16.0.102 -U Administrator -P Administrator power on Chassis Power Control: Up/On
電源オフ(電源ボタン長押しなどの強制電源断)
構文
ipmitool -I lanplus -H IPアドレス -U ユーザ名 -P パスワード power off
実行結果
[root@client ~]# ipmitool -I lanplus -H 172.16.0.102 -U Administrator -P Administrator power off Chassis Power Control: Down/Off
ハードリセット(強制リセット?)
構文
ipmitool -I lanplus -H IPアドレス -U ユーザ名 -P パスワード power reset
実行結果
[root@client ~]# ipmitool -I lanplus -H 172.16.0.102 -U Administrator -P Administrator power reset Chassis Power Control: Reset
電源オフ+電源オン
構文
ipmitool -I lanplus -H IPアドレス -U ユーザ名 -P パスワード power cycle
実行結果
[root@client ~]# ipmitool -I lanplus -H 172.16.0.102 -U Administrator -P Administrator power cycle Chassis Power Control: Cycle
電源ボタンの押下をエミュレート(OS上でシャットダウン指示に相当?)
構文
ipmitool -I lanplus -H IPアドレス -U ユーザ名 -P パスワード power soft
実行結果
[root@client ~]# ipmitool -I lanplus -H 172.16.0.102 -U Administrator -P Administrator power soft Chassis Power Control: Soft
chassisコマンド
次回起動時に強制的にBIOS設定画面に入る
構文
ipmitool -I lanplus -H IPアドレス -U ユーザ名 -P パスワード chassis bootdev bios
実行結果
[root@client ~]# ipmitool -I lanplus -H 172.16.0.102 -U Administrator -P Administrator chassis bootdev bios Set Boot Device to bios
次回起動時に強制的にPXEブートする
構文
ipmitool -I lanplus -H IPアドレス -U ユーザ名 -P パスワード chassis bootdev pxe
実行結果
[root@client ~]# ipmitool -I lanplus -H 172.16.0.102 -U Administrator -P Administrator chassis bootdev pxe Set Boot Device to pxe
その他のオプション
[root@client ~]# ipmitool -I lanplus -H 172.16.0.102 -U Administrator -P Administrator chassis bootdev bootdev[clear-cmos=yes|no] bootdev [options=help,...] none : Do not change boot device order pxe : Force PXE boot disk : Force boot from default Hard-drive safe : Force boot from default Hard-drive, request Safe Mode diag : Force boot from Diagnostic Partition cdrom : Force boot from CD/DVD bios : Force boot into BIOS Setup floppy: Force boot from Floppy/primary removable media [root@client ~]#
solコマンド
シリアルコンソールを有効化・接続する
構文
ipmitool -I lanplus -H IPアドレス -U ユーザ名 -P パスワード sol activate
実行結果
[root@client ~]# ipmitool -I lanplus -H 172.16.0.102 -U Administrator -P Administrator sol activate [SOL Session operational. Use ~? for help]
文字が表示されるのを待つ。
例えば、こんな感じ。比較用のGUI画面も載せておく。
4096 MB Installed ProLiant System BIOS - P68 (05/05/2011) Copyright 1982, 2011 Hewlett-Packard Development Company, L.P. 2 Processor(s) detected, 8 total cores enabled, Hyperthreading is enabled Proc 1: Intel(R) Xeon(R) CPU L5630 @ 2.13GHz Proc 2: Intel(R) Xeon(R) CPU L5630 @ 2.13GHz QPI Speed: 5.8 GT/s HP Power Profile Mode: Balanced Power and Performance Power Regulator Mode: Static Low Power - Processor(s) clocked down to 1.60 GHz Advanced Memory Protection Mode: Advanced ECC Support
もう一例。
CentOS Linux (4.18.0-240.1.1.el8_3.x86_64) 8 CentOS Stream (4.18.0-240.el8.x86_64) 8 CentOS Stream (0-rescue-78a98f7f4c164cdc9392bb139bad233b) 8 Use the and keys to change the selection. Press 'e' to edit the selected item, or 'c' for a command prompt.
シリアルコンソール接続から抜ける
構文
~.
※「~(チルダ)キー」→「.(ピリオド)キー」の順に押下する
実行結果
[root@client ~]# ipmitool -I lanplus -H 172.16.0.102 -U Administrator -P Administrator sol activate [SOL Session operational. Use ~? for help] Connection to localhost closed.
なぜか接続元のsshセッションまでログアウトしてしまう。よくわからない。
シリアルコンソール接続を無効化する
構文
ipmitool -I lanplus -H IPアドレス -U ユーザ名 -P パスワード sol deactivate
実行結果
[root@client ~]# ipmitool -I lanplus -H 172.16.0.102 -U Administrator -P Administrator sol deactivate [root@client ~]#
solは非常に便利な機能なのだが、わりと調子が悪い。接続したのに表示されない場合は、deactivateしactivateし直すなどしている。
エスケープシーケンス
シリアルコンソール接続した状態で「~(チルダ)キー」→「?(クエスチョン)キー」の順に押下すると、使えるコマンドが表示される。「escape sequences」と書いてあるのでそう呼ぶらしい。
Supported escape sequences: ~. - terminate connection (and any multiplexed sessions) ~B - send a BREAK to the remote system ~C - open a command line ~R - request rekey ~V/v - decrease/increase verbosity (LogLevel) ~^Z - suspend ssh ~# - list forwarded connections ~& - background ssh (when waiting for connections to terminate) ~? - this message ~~ - send the escape character by typing it twice (Note that escapes are only recognized immediately after newline.)