NetApp上から他のサーバに対してSSH接続する

シリアル接続したNetApp上から他のサーバに対してSSH接続する方法

まず、diagモードになる

netapp1::> set diag

Warning: These diagnostic commands are for use by NetApp personnel only.
Do you want to continue? {y|n}: y

netapp1::*>

次に「system node systemshell -node localhost -command ssh ユーザ名@接続先」で接続する

netapp1::*> system node systemshell -node localhost -command ssh root@ホスト名
The authenticity of host 'xxxxxxx (xxxxxxx)' can't be established.
ECDSA key fingerprint is SHA256:IX4Bar+J8/eOeFoSu+QPIUWxxxxxxxxxxxxxI.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'xxxxxxx' (ECDSA) to the list of known hosts.
root@xxxxxxx's password:
Last login: Wed Apr 20 16:03:51 2022 from xxxxxxx
[root@xxxxxxx ~]#

TeraTermマクロでコマンド出力結果を使って別のコマンドを実行する

NetAppの設定をTeraTermマクロで取得出来るようにマクロを作成中し https://github.com/osakanataro/get-ontap-config で公開中です。

物理ディスク一覧を作成する際、単純に「storage disk show」で取得すると、2ノードの表示が入り交じり、どちらに所属している物理ディスクなのか判別が面倒。

なので、「storage disk show -nodelist ノード名」という形で出力を分けたいのだが、NetAppに対して「system node show -fields node」で取得したノード一覧からノード名を抜き出して、それぞれに対してコマンドを実行するためには、TeraTermマクロで実装できるのかを調査した。

調査

まず、NetAppのノード名一覧の出力を確認

netapp01::> system node show -fields node
node
-------------
netapp01-01
netapp01-02
2 entries were displayed.

netapp01::>

ノードとして「netapp01-01」と「netapp01-02」があることを確認。

また、system node showコマンドの出力のうち最初の2行はヘッダ、そして、ノード名出力後に「~ entries were displayed.」と出力がある。これらは使わないので除外が必要。

スクリプト

サンプルとして、ノード一覧を表示して、各ノードに対して「system node run -node ノード名 hostname」を実行する、というものを作成した。

setsync 1
timeout=60
strdim nodenames 20
I=0
sendln 'system node show -fields node'
recvln ; コマンド入力 のecho出力  をスキップ
recvln ; ヘッダ部分 をスキップ
recvln ; --- 部分 をスキップ

endflag=1
while endflag=1
	recvln
	strscan inputstr 'displayed.'
	if result>0 then
		endflag=0
	else
		nodenames[I] = inputstr
		I=I+1
	endif
endwhile
wait '::> '

J=0
while I > J
	sendln 'system node run -node ' nodenames[J] ' hostname'
	wait '::> '
	J=J+1
endwhile

setsync 0

スクリプトの解説

今回のようなコマンド出力結果を受け取る場合は、「setsync 1」を実行して、確実に出力結果を受け取る設定(同期)とする必要がある。

次に「recvln」する際、TeraTermマクロからNetAppに送信した文字列もrecvlnで受け取ることになっているため、最初の1行は捨てている。(recvlnして、その後、何の処理もしていない)

続けて2行がヘッダなので、「recvln」で2行分受け取り、何も処理していない。

「2 entries were displayed.」というエントリ以降の行は不要なので、whileを終了する処理を入れるが、1台だったりすると1 entry wasとかになったりしそうなのでdisplayed.だけで終了検出。

whileを抜けたあとは、コマンドプロンプトの「::> 」が来るまで待ちを入れる。

スクリプト実行例

netapp01::> system node show -fields node
node
-------------
netapp01-01
netapp01-02
2 entries were displayed.

netapp01::> system node run -node netapp01-01 hostname
netapp01-01
netapp01::> system node run -node netapp01-02 hostname
netapp01-02
netapp01::>

ONTAPで未接続のイーサポートを無効化する手法

NetApp ONTAPのWeb管理画面 ONTAP System Managerは、未使用でネットワークケーブルを接続していないポートがあると、オフラインになってるポートがあるよ、的な警告を表示する。

System Managerからだと簡単にネットワークポートの無効化が設定できる

無効化したいポートを選択して、「無効化」

続行します。

選択したポートのグラフィックが灰色に変化します。

さて、この操作、コマンドで行うにはどうすればいいのか?

まず、状況については「network port show」で確認出来ます。

fas8300::> network port show

Node: fas8300-01
                                                  Speed(Mbps) Health
Port      IPspace      Broadcast Domain Link MTU  Admin/Oper  Status
--------- ------------ ---------------- ---- ---- ----------- --------
a0a       Default      -                up   9000     -/-     healthy
a0a-1000  Default      Storage          up   9000     -/-     healthy
e0M       Default      Default          up   1500  auto/1000  healthy
e0c       Cluster      Cluster          up   9000 100000/100000 healthy
e0d       Cluster      Cluster          up   9000 100000/100000 healthy
e0e       Default      -                up   9000  auto/25000 healthy
e0f       Default      -                up   9000  auto/25000 healthy
e0g       Default      -                up   9000  auto/25000 healthy
e0h       Default      -                down 9000  auto/-     -

Node: fas8300-02
                                                  Speed(Mbps) Health
Port      IPspace      Broadcast Domain Link MTU  Admin/Oper  Status
--------- ------------ ---------------- ---- ---- ----------- --------
a0a       Default      -                up   9000     -/-     healthy
a0a-1000  Default      Storage          up   9000     -/-     healthy
e0M       Default      Default          up   1500  auto/1000  healthy
e0c       Cluster      Cluster          up   9000  auto/100000 healthy
e0d       Cluster      Cluster          up   9000  auto/100000 healthy
e0e       Default      -                up   9000  auto/25000 healthy
e0f       Default      -                up   9000  auto/25000 healthy
e0g       Default      -                up   9000  auto/25000 healthy
e0h       Default      -                up   9000  auto/25000 healthy
18 entries were displayed.

fas8300::>

しかし、network port modifyで指定できるオプションには、link up/downに関する設定がなさそう・・・

fas8300::> network port modify -node fas8300-01 -port e0h -?
  [ -mtu <integer> ]                                            MTU
  [ -autonegotiate-admin {true|false} ]                         Auto-Negotiation Administrative
  [ -duplex-admin {auto|half|full} ]                            Duplex Mode Administrative
  [ -speed-admin {auto|10|100|1000|10000|100000|40000|25000} ]  Speed Administrative
  [ -flowcontrol-admin {none|receive|send|full} ]               Flow Control Administrative
  [ -ipspace <IPspace> ]                                        IPspace Name

fas8300::>

マニュアルの「network port modify」を確認してみると下記の記述がある。

[-up-admin {true|false}] – Up Administrative (privilege: advanced)
The administrative state of the port. If set to true, the port is used if it is operational. If set to false, the port is configured down.

標準の管理CLIではなく、advanced以上の権限であれば実行できる、とのこと。

fas8300::> set advanced

Warning: These advanced commands are potentially dangerous; use them only when directed to do so by NetApp
         personnel.
Do you want to continue? {y|n}: y

fas8300::*>

advancedモードに切り替えてから、再度オプション一覧を確認

fas8300::*> network port modify -node fas8300-01 -port e0h -?
  [ -mtu <integer> ]                                            MTU
  [ -autonegotiate-admin {true|false} ]                         Auto-Negotiation Administrative
  [ -duplex-admin {auto|half|full} ]                            Duplex Mode Administrative
  [ -speed-admin {auto|10|100|1000|10000|100000|40000|25000} ]  Speed Administrative
  [ -flowcontrol-admin {none|receive|send|full} ]               Flow Control Administrative
  [ -up-admin {true|false} ]                                    *Up Administrative
  [ -ipspace <IPspace> ]                                        IPspace Name
  [ -ignore-health-status {true|false} ]                        *Ignore Port Health Status

fas8300::*>

設定出来る項目に現れました。

fas8300::*> network port modify -node fas8300-01 -port e0h -up-admin true

fas8300::*>

設定が反映されたかを確認します

fas8300::*> network port show

Node: fas8300-01
                                                                       Ignore
                                                  Speed(Mbps) Health   Health
Port      IPspace      Broadcast Domain Link MTU  Admin/Oper  Status   Status
--------- ------------ ---------------- ---- ---- ----------- -------- ------
a0a       Default      -                up   9000     -/-     healthy  false
a0a-1000  Default      Storage          up   9000     -/-     healthy  false
e0M       Default      Default          up   1500  auto/1000  healthy  false
e0c       Cluster      Cluster          up   9000 100000/100000 healthy false
e0d       Cluster      Cluster          up   9000 100000/100000 healthy false
e0e       Default      -                up   9000  auto/25000 healthy  false
e0f       Default      -                up   9000  auto/25000 healthy  false
e0g       Default      -                up   9000  auto/25000 healthy  false
e0h       Default      -                up   9000  auto/25000 healthy  false

Node: fas8300-02
                                                                       Ignore
                                                  Speed(Mbps) Health   Health
Port      IPspace      Broadcast Domain Link MTU  Admin/Oper  Status   Status
--------- ------------ ---------------- ---- ---- ----------- -------- ------
a0a       Default      -                up   9000     -/-     healthy  false
a0a-1000  Default      Storage          up   9000     -/-     healthy  false
e0M       Default      Default          up   1500  auto/1000  healthy  false
e0c       Cluster      Cluster          up   9000  auto/100000 healthy false
e0d       Cluster      Cluster          up   9000  auto/100000 healthy false
e0e       Default      -                up   9000  auto/25000 healthy  false
e0f       Default      -                up   9000  auto/25000 healthy  false
e0g       Default      -                up   9000  auto/25000 healthy  false
e0h       Default      -                up   9000  auto/25000 healthy  false
18 entries were displayed.

fas8300::*>

全てのポートがupになりました。

System Managerの方でも表示がupに戻ったかを確認できました。

Web GUIだと簡単に設定変更できるものが、コマンドだとadvanced権限必要だった、というのは驚きでした。

NetAppで電源電圧を確認する方法

NetAppを稼働させていたら電源電圧の警告が出ていたので、その確認手法を調べた。

ONTAP OS側からだと「system node environment sensors show」で現在値のみが確認出来た。

ただ、上記だと各部センサーの情報が全て含まれてしまうので、電源電圧だけを見るのであれば「system node environment sensors show -name *VIN*」と指定することで入力電圧のみを見ることが出来る。

fas8300::> system node environment sensors show -name *VIN*
Node Sensor                 State Value/Units Crit-Low Warn-Low Warn-Hi Crit-Hi
---- --------------------- ------ ----------- -------- -------- ------- -------
fas8300-01
     PSU1 VIN              normal
                                    99840 mV     90480    93600  261040  263120
     PSU2 VIN              normal
                                    94640 mV     90480    93600  261040  263120
fas8300-02
     PSU1 VIN              normal
                                    99840 mV     90480    93600  261040  263120
     PSU2 VIN              normal
                                    94640 mV     90480    93600  261040  263120
4 entries were displayed.

fas8300::>

「Value/Units」が現在値で、それ以外が注意/警告を発令する電圧設定となる。

これまでに電源電圧警報が発令された時に何Vだったのかを確認するには、Service Processor/BMC側にログインして調べる必要があった。

「system log sel」で表示されるIPMIログを見て確認する。

BMC fas8300-01> system log sel
   1 | 11/09/2021 | 09:38:39 | System Firmware Progress | Secondary CPU Initialization | Asserted
   2 | 11/09/2021 | 09:38:39 | System Firmware Progress | USB resource configuration | Asserted
   3 | 11/09/2021 | 09:38:41 | System Firmware Progress | PCI resource configuration | Asserted
   4 | 11/09/2021 | 09:38:41 | System Firmware Progress | Video initialization | Asserted
   5 | 11/09/2021 | 09:38:41 | System Firmware Progress | Keyboard controller initialization | Asserted
   6 | 11/09/2021 | 09:38:42 | System Firmware Progress | Hard-disk initialization | Asserted
   7 | 11/09/2021 | 09:38:50 | System Firmware Progress | Hard-disk initialization | Asserted
   8 | 11/09/2021 | 09:39:01 | System Event |  | Asserted
   9 | 11/09/2021 | 09:39:20 | Voltage #0x50 | Lower Non-critical going low
   a | 11/09/2021 | 09:39:24 | Voltage #0x5a | Lower Non-critical going low
   b | 11/09/2021 | 09:40:29 | Voltage #0x50 | Lower Non-critical going low
   c | 11/09/2021 | 09:40:29 | Voltage #0x5a | Lower Non-critical going low
   d | 11/09/2021 | 09:41:02 | System Event #0xff | Timestamp Clock Sync | Asserted
   e | 11/09/2021 | 09:41:02 | System Event #0xff | Timestamp Clock Sync | Asserted
   f | 11/09/2021 | 10:41:48 | Voltage #0x50 | Lower Non-critical going low
<略>
 b97 | 11/30/2021 | 23:45:25 | Voltage #0x5a | Lower Non-critical going low
 b98 | 11/30/2021 | 23:46:33 | Voltage #0x5a | Lower Non-critical going low
 b99 | 11/30/2021 | 23:46:46 | Voltage #0x5a | Lower Non-critical going low

BMC fas8300-01>

上記の「Voltage #0x50 | Lower Non-critical going low」というのが16進数表記の電圧となる。

0x50=80V、0x5a=90Vとなる。

さすがにAC 80Vは低すぎでしょ!!というわけで、電源経路確認が実施されましたとさ

ONTAP 9.xでntpやDNSの動作確認

NetApp ONTAP 9.x環境でNTPやDNSの設定をした際に、正常に動作しているかを確認する手法

(2022/08/12追記 「ONTAP 9.x環境でActive DirectoryとNISとでユーザ名マッピングを行わせた場合の確認手法」)

NTPの設定確認

NTP設定がされているかどうかを「cluster time-service ntp server show」で確認

::> cluster time-service ntp server show
                                        Is
                                        Authentication
Server                         Version  Enabled        Key ID
------------------------------ -------  -------------- ------
10.20.8.10                     auto     false          -

::>

NTPの動作確認

指定したNTPサーバと同期が取れているかは、adminモードでは確認出来ない。

advancedかdiagモードに切り替えて「cluster time-service ntp status show」を実行して確認。(注:ONTAPバージョンが9.1とかの古いものだと存在しない)

::> set adv

Warning: These advanced commands are potentially dangerous; use them only when
         directed to do so by NetApp personnel.
Do you want to continue? {y|n}: y

::*> cluster time-service ntp status show

Node: netapp_02
Server                  Reachable  Selection State                Offset (ms)
----------------------- ---------  ------------------------------ ------------
10.20.8.10                   true  Currently Selected Server            21.552

Node: netapp_02
Server                  Reachable  Selection State                Offset (ms)
----------------------- ---------  ------------------------------ ------------
10.20.8.10                   true  Currently Selected Server             21.68
2 entries were displayed.

::*>

上記の様に「Reachable:true」となっていればNTPサーバと通信が取れている。

下記の様に「Reachable:false」となっている場合は接続が取れないか、リトライ中である。

::*> cluster time-service ntp status show

Node: netapp_01
Server                  Reachable  Selection State                Offset (ms)
----------------------- ---------  ------------------------------ ------------
10.20.8.10                  false  Server Not Responding or Too              0
                                   Distant

Node: netapp_02
Server                  Reachable  Selection State                Offset (ms)
----------------------- ---------  ------------------------------ ------------
10.20.8.10                  false  Server Not Responding or Too              0
                                   Distant
2 entries were displayed.

::*>

なお、-insオプションを付けると詳細が確認出来る。

::*> cluster time-service ntp status show -ins

                                      Node: netapp_01
NTP Server Host Name, IPv4 or IPv6 Address: 10.20.8.10
                         Server IP Address: 10.20.8.10
Is Peer Reachable and Responding to Polls?: true
         Is Peer Selected as Clock Source?: true
                 State of Server Selection: sys_peer
     Description of Server Selection State: Currently Selected Server
                      Poll Interval (secs): 64
                Time from Last Poll (secs): 9
              Offset from Server Time (ms): -16.61
                 Delay Time to Server (ms): 0.395
                 Maximum Offset Error (ms): 20.946
                    Reachability of Server: 1f
                   Stratum of Server Clock: 2
                 Reference Clock at Server: 133.243.238.163
           Reported Packet and Peer Errors: -

                                      Node: netapp_02
NTP Server Host Name, IPv4 or IPv6 Address: 10.20.8.10
                         Server IP Address: 10.20.8.10
Is Peer Reachable and Responding to Polls?: true
         Is Peer Selected as Clock Source?: true
                 State of Server Selection: sys_peer
     Description of Server Selection State: Currently Selected Server
                      Poll Interval (secs): 64
                Time from Last Poll (secs): 14
              Offset from Server Time (ms): 6.623
                 Delay Time to Server (ms): 0.398
                 Maximum Offset Error (ms): 17.906
                    Reachability of Server: 1f
                   Stratum of Server Clock: 2
                 Reference Clock at Server: 133.243.238.163
           Reported Packet and Peer Errors: -
2 entries were displayed.

::*>

“Stratum of Server Clock”と”Reference Clock at Server”の値が見えてればだいたい大丈夫でしょう。(ちなみに上記の 133.243.238.163 は ntp.nict.jp / ntp.nict.go.jp を構成するIPアドレスの1つです)

diagモードにしてsystemshellが使える状態であれば「systemshell -node local -command “sudo ntpq -pn”」を実行することで各ノードごとで動作しているntpdの状態を取得することもできます。

ontap91::*> systemshell -node local -command "sudo ntpq -pn"
  (system node systemshell)
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 xxx.xx.xx.xxx   133.243.238.164  2 u   33   64    1    0.489   29.541   2.335

ontap91::*>

“Error: command failed: Error: Account currently locked. Contact the storage administrator to unlock it.”と出力される場合は「security login show -username diag」を実行してdiagユーザ「Acct Locked」状態を確認し、「security login unlock -username diag」でロック解除することで実行できるようになります。(詳細→「NetApp ONTAPから他サーバに気軽にsshできる穴がふさがれてしまった」)

DNSの設定確認

DNSに関する設定は「vserver services name-service dns show」を実行する。

ontap98::> vserver services name-service dns show
                                                    Name
Vserver         Domains                             Servers
--------------- ----------------------------------- ----------------
ontap98         adosakana.local                   172.17.44.49
share225        adosakana.local                  172.17.44.49
share228        adosakana.local                  172.17.44.49
3 entries were displayed.

ontap98::>

Active Directoryに参加している場合は、DNSの自動更新に関する設定も重要なので「vserver services name-service dns dynamic-update show」で確認する。

ontap98::> vserver services name-service dns dynamic-update show
Vserver         Is-Enabled Use-Secure Vserver FQDN             TTL
--------------- ---------- ---------- ------------------------ -------
share225        true       false      adosakana.local    24h
share228        false      false      -                        24h
2 entries were displayed.

ontap98::>

上記例では、Storage VM:share225ではDNS自動更新を有効にしている、ということになる。

/etc/hosts ファイルに相当する固定の名前解決を行っているかは「vserver services name-service dns hosts show」で確認する。

注意が必要なのは、「NetAppのクラスタ管理」と「各Storage VM」でそれぞれ別の設定になっているということ。これを勘違いしているとうまく名前解決が実施できない。

ネットワークインタフェースとルーティングの設定も関係してくるので「network interface show」と「network route show」も確認すると良い。

DNSの動作確認

DNSサーバに接続ができているかは「vserver services name-service dns check -vserver SVM名 -ins」で確認出来る。

ontap98::> vserver services name-service dns check  -vserver ontap98 -ins

           Vserver: ontap98
       Name Server: 172.17.44.49
Name Server Status: up
    Status Details: Response time (msec): 1

ontap98::>

上記はStorageVM:ontap98 に対して確認を実施した結果となり、「Name Server status:up」で「Response time(msec)」の値があるのでDNSサーバ応答があった、ということになる。

指定したホスト名が名前解決できるかはadvancedモード/diagモードが必須となる。

コマンドは「vserver services name-service getxxbyyy getaddrinfo -vserver SVM名 -hostname 解決したいホスト名」か「vserver services name-service getxxbyyy gethostbyname -vserver SVM名 -hostname 解決したいホスト名」となる。

ontap98::> set advanced

Warning: These advanced commands are potentially dangerous; use them only when directed to do so by NetApp personnel.
Do you want to continue? {y|n}: y

ontap98::*>vserver services name-service getxxbyyy getaddrinfo -vserver ontap98 -hostname adserver
Host name: adserver
Canonical Name: adserver.adosakana.local
IPv4: 172.17.44.49


ontap98::*>

IPアドレスの逆引きは 「vserver services name-service getxxbyyy getnameinfo -vserver SVM名 -ipaddress IPアドレス」 か 「vserver services name-service getxxbyyy getnameinfo -vserver SVM名 -ipaddress IPアドレス 」 となる

ontap98::*> vserver services name-service getxxbyyy gethostbyaddr -vserver ontap98 -ipaddress 172.17.44.49
IP address: 172.17.44.49
Host name: adserver.adosakana.local


ontap98::*>

Active Directory関連

SVMのCIFSが動いてるかどうか確認

netapp9101::> vserver cifs show
            Server          Status    Domain/Workgroup Authentication
Vserver     Name            Admin     Name             Style
----------- --------------- --------- ---------------- --------------
svm0        SVM0            up        ADOSAKANA              domain

netapp9101::>

Active Directoryへの接続確認

netapp9101::> vserver cifs check -vserver svm0

                              Vserver : svm0
                    Cifs NetBIOS Name : SVM0
                          Cifs Status : Running
                                 Site : Default-First-Site-Name

Node Name       DC Server Name  DC Server IP    Status   Status Details
--------------- --------------  --------------- ------   --------------
netapp9101-01   adosakana.local   172.17.44.49    up       Response time (msec): 51

netapp9101::>

クライアントからアクセスがあった後に確認できるようになる情報

クライアントから共有にアクセスがあったあとに表示されるようになる情報群

どのActive Directoryサーバに接続してるか

netapp9101::> vserver active-directory discovered-servers show

Node: netapp9101-01
Vserver: svm0

Domain Name     Type     Preference DC-Name         DC-Address      Status
--------------- -------- ---------- --------------- --------------- ---------
adosakana.local   MS-LDAP  adequate   adserver      172.17.44.49    OK
adosakana.local   MS-DC    adequate   adserver      172.17.44.49    OK
2 entries were displayed.

netapp9101::>
netapp9101::> vserver active-directory discovered-servers show

Node: netapp9101-01
Vserver: svm0

Domain Name     Type     Preference DC-Name         DC-Address      Status
--------------- -------- ---------- --------------- --------------- ---------
adosakana.local   KERBEROS favored    adserver      172.17.44.49    undetermined
adosakana.local   MS-LDAP  favored    adserver      172.17.44.49    undetermined
adosakana.local   MS-DC    favored    adserver      172.17.44.49    OK
3 entries were displayed.

netapp9101::>

接続しにきたクライアントをどのLIFで受けたのか

netapp9101::> vserver cifs connection show

Node:    netapp9101-01
Vserver: svm0
Connection Session                               Workstation
ID         IDs                   Workstation IP  Port        LIF IP
---------- --------------------- --------------- ----------- ---------------
936674349  3075958545494048785   172.17.44.170   61391       172.17.44.56

netapp9101::>
モバイルバージョンを終了