vSphere ESXiでNetApp ONTAP9のNFS4.1を使う


NetApp ONTAP 9.7環境にてNFS4.1を有効にして、vSphere ESXi 6.7のNFSデータストアにしてみた。

NetApp ONTAP9側

NFS 4.1有効化

ONTAP 9.7管理画面でNFSを有効にした場合、NFS v3.0のみが有効化されている。

プロトコルの「NFS」から編集を選ぶと以下の様に設定変更ができる。

とりあえず「バージョン4のサポートを有効にする」と「バージョン4.1のサポートを有効にする」にチェックを入れると下記のようになる。

「pNFS」にもチェックが入っている状態になるが、このまま設定する。

設定後のプロトコル表示は下記の様になる。

通常のNFSと同じくエクスポートルールの設定などはちゃんと行うこと。

ONTAPでNFS経由のVAAIを許可するエクスポート ポリシーの設定

NFS vStorage Support有効化

NetAppのStorage VM(SVM)に対してNFS vStorage Support(VAAI連携)を有効化する。

現在値の確認は「vserver nfs show -ins」で「NFS vStorage Support」の値を確認する。

ontap-select-cluster::> vserver nfs show -ins

                                        Vserver: svm0
                             General NFS Access: true
                                         NFS v3: enabled
                                       NFS v4.0: enabled
                                   UDP Protocol: enabled
                                   TCP Protocol: enabled
                           Default Windows User: -
                            NFSv4.0 ACL Support: disabled
                NFSv4.0 Read Delegation Support: disabled
               NFSv4.0 Write Delegation Support: disabled
                        NFSv4 ID Mapping Domain: defaultv4iddomain.com
            NFSv4 Grace Timeout Value (in secs): 45
Preserves and Modifies NFSv4 ACL (and NTFS File Permissions in Unified Security Style): enabled
                  NFSv4.1 Minor Version Support: enabled
                                  Rquota Enable: disabled
                   NFSv4.1 Parallel NFS Support: enabled
                            NFSv4.1 ACL Support: disabled
                           NFS vStorage Support: disabled
            NFSv4 Support for Numeric Owner IDs: enabled
                          Default Windows Group: -
                NFSv4.1 Read Delegation Support: disabled
               NFSv4.1 Write Delegation Support: disabled
                            NFS Mount Root Only: enabled
                                  NFS Root Only: disabled
            Permitted Kerberos Encryption Types: des, des3, aes-128, aes-256
                              Showmount Enabled: enabled
Set the Protocol Used for Name Services Lookups for Exports: udp
                    NFSv3 MS-DOS Client Support: disabled
     Idle Connection Timeout Value (in seconds): 360
             Are Idle NFS Connections Supported: disabled
Hide Snapshot Directory under NFSv3 Mount Point: disabled
           Provide Root Path as Showmount State: disabled

ontap-select-cluster::> 

vStorage Supportの項目だけ確認する場合は「vserver nfs show -fields vstorage」でも良い。

ontap-select-cluster::> vserver nfs show -fields vstorage
vserver vstorage
------- --------
svm0    disabled

ontap-select-cluster::>

有効にする場合は「vserver nfs modify -vserver SVM名 -vstorage enabled」を実行する。

ontap-select-cluster::> vserver nfs modify -vserver svm0 -vstorage enabled

ontap-select-cluster::> vserver nfs show

変更後は以下のような出力結果となる。

ontap-select-cluster::> vserver nfs show -ins

                                        Vserver: svm0
                             General NFS Access: true
                                         NFS v3: enabled
                                       NFS v4.0: enabled
                                   UDP Protocol: enabled
                                   TCP Protocol: enabled
                           Default Windows User: -
                            NFSv4.0 ACL Support: disabled
                NFSv4.0 Read Delegation Support: disabled
               NFSv4.0 Write Delegation Support: disabled
                        NFSv4 ID Mapping Domain: defaultv4iddomain.com
            NFSv4 Grace Timeout Value (in secs): 45
Preserves and Modifies NFSv4 ACL (and NTFS File Permissions in Unified Security Style): enabled
                  NFSv4.1 Minor Version Support: enabled
                                  Rquota Enable: disabled
                   NFSv4.1 Parallel NFS Support: enabled
                            NFSv4.1 ACL Support: disabled
                           NFS vStorage Support: enabled
            NFSv4 Support for Numeric Owner IDs: enabled
                          Default Windows Group: -
                NFSv4.1 Read Delegation Support: disabled
               NFSv4.1 Write Delegation Support: disabled
                            NFS Mount Root Only: enabled
                                  NFS Root Only: disabled
            Permitted Kerberos Encryption Types: des, des3, aes-128, aes-256
                              Showmount Enabled: enabled
Set the Protocol Used for Name Services Lookups for Exports: udp
                    NFSv3 MS-DOS Client Support: disabled
     Idle Connection Timeout Value (in seconds): 360
             Are Idle NFS Connections Supported: disabled
Hide Snapshot Directory under NFSv3 Mount Point: disabled
           Provide Root Path as Showmount State: disabled

ontap-select-cluster::> vserver nfs show -fields vstorage
vserver vstorage
------- --------
svm0    enabled

ontap-select-cluster::>

vSphere側

データストアの追加から「NFS」の「NFS 4.1」を追加する

VAAIプラグインを追加

ESXiに「NetApp NFS Plug-in for VMware VAAI」をインストールすることで、VAAI機能が有効になる。

すでにNFSマウントされているデータストアがVAAIでアクセスされているか確認するにはESXi shellでコマンドを実行する。

[root@esxiserver:~] esxcli storage nfs41 list
Volume Name  Host(s)        Share     Accessible  Mounted  Read-Only  Security   isPE  Hardware Acceleration
-----------  -------------  --------  ----------  -------  ---------  --------  -----  ---------------------
nfsv4test    172.17.44.108  /testvol        true     true      false  AUTH_SYS  false  Not Supported
[root@esxiserver:~]

「Hardware Acceleration」が「Not Supported」となっている場合、VAAIが有効な状態ではない。

また「vmkfstools -Ph /vmfs/volumes/<データストア名>」を実行した結果内の「NAS VAAI Supported」でも確認できる。

[root@esxiserver:~] vmkfstools -Ph /vmfs/volumes/nfsv4test
NFS41-4.01 (Raw Major Version: 0) file system spanning 1 partitions.
File system label (if any): nfsv4test
Mode: public
Capacity 50 GB, 48.0 GB available, file block size 4 KB, max supported file size 16.0 TB
Disk Block Size: 512/512/0
UUID: a135f63e-34806068-0000-000000000000
Partitions spanned (on "notDCS"):
        NFS41:a135f63e-34806068-0000-000000000000
NAS VAAI Supported: NO
Is Native Snapshot Capable: NO
[root@esxiserver:~]

ESXi shellからVAAIプラグインをインストールする。

[root@esxiserver:~] esxcli software vib install -d /vmfs/volumes/software/netapp
/nfs_plugin_VAAI/1.1.2/NetAppNasPlugin.v23.zip
Installation Result
   Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
   Reboot Required: true
   VIBs Installed: NetApp_bootbank_NetAppNasPlugin_1.1.2-3
   VIBs Removed:
   VIBs Skipped:
[root@esxiserver:~]

「Reboot Required: true」と再起動が要求されたので、ESXiを再起動します。

再起動後、「esxcli storage nfs41 list」で確認すると「Hardware Acceleration Supported」。

[root@esxiserver:~] esxcli storage nfs41 list
Volume Name  Host(s)        Share     Accessible  Mounted  Read-Only  Security   isPE  Hardware Acceleration
-----------  -------------  --------  ----------  -------  ---------  --------  -----  ---------------------
nfsv4test    172.17.44.108  /testvol        true     true      false  AUTH_SYS  false  Supported
[root@esxiserver:~]

「vmkfstools -Ph /vmfs/volumes/<データストア名>」は「NAS VAAI Supported: YES」に変わります。

[root@esxiserver:~] vmkfstools -Ph /vmfs/volumes/nfsv4test
NFS41-4.01 (Raw Major Version: 0) file system spanning 1 partitions.
File system label (if any): nfsv4test
Mode: public
Capacity 50 GB, 48.0 GB available, file block size 4 KB, max supported file size 16.0 TB
Disk Block Size: 512/512/0
UUID: a135f63e-34806068-0000-000000000000
Partitions spanned (on "notDCS"):
        NFS41:a135f63e-34806068-0000-000000000000
NAS VAAI Supported: YES
Is Native Snapshot Capable: YES
[root@esxiserver:~]

2020/08/04追記

export policy関連設定

svmのrootボリュームのexport policyをread onlyの0.0.0.0/0にして、vSphere用NFS共有のexport policyをread/write 0.0.0.0/0にしておいたところ、ESXi 7.0からのNFS4.1データストア登録に失敗。

svmのrootボリュームへの書き込み権限も必要だった。

ONTAP 9.5でsambaドメインに参加できない & ONTAP 9.7で失敗


samba 4.11.6で作ったActive DirectoryにONTAP 9.5を参加させようとするとエラーになる。

ONTAP API が失敗しました: Failed to create the Active Directory machine account "ファイルサーバ名". Reason: LDAP Error: Strong authentication is required Details: Error: Machine account creation procedure failed [ 136] Loaded the preliminary configuration. [ 215] Successfully connected to ip ADサーバIP, port 88 using TCP [ 284] Successfully connected to ip ADサーバIP, port 389 using TCP [ 308] Unable to connect to LDAP (Active Directory) service on ADサーバホスト名 (Error: Strong(er) authentication required) **[ 308] FAILURE: Unable to make a connection (LDAP (Active ** Directory):AD名), result: 7609 . (エラー:13001)

調べたところ、sambaのglobal設定で「ldap server require strong auth = no」を設定する、とのこと。

これを設定し、sambaを再起動したところ、参加できた。


ONTAP 9.7にて、上記手順を実施した上で参加を試みたところ「Unable to connect to NetLogon service on」というエラーになった。

netapp::> vserver cifs create -vserver ファイルサーバ名 -cifs-server ファイルサーバ名 -domain AD名 -ou CN=Computers -default-site "" -status-admin up -comment "" -netbios-aliases ファイルサーバ名

In order to create an Active Directory machine account for the CIFS server, you
must supply the name and password of a Windows account with sufficient
privileges to add computers to the "CN=Computers" container within the
"AD名" domain.

Enter the user name: administrator

Enter the password:

Warning: An account by this name already exists in Active Directory at
         CN=ファイルサーバ名,CN=Computers,DC=xx,DC=xx.
         If there is an existing DNS entry for the name ファイルサーバ名, it must be
         removed. Data ONTAP cannot remove such an entry.
         Use an external tool to remove it after this command completes.
         Ok to reuse this account? {y|n}: y

Error: Machine account creation procedure failed
  [    31] Loaded the preliminary configuration.
  [   107] Created a machine account in the domain
  [   108] SID to name translations of Domain Users and Admins
           completed successfully
  [   113] Modified account 'cn=ファイルサーバ名,CN=Computers,dc=xx
           =CO,dc=JP'
  [   114] Successfully connected to ip xx.xx.xx.xx, port 88 using
           TCP
  [   129] Successfully connected to ip xx.xx.xx.xx, port 464
           using TCP
  [   216] Kerberos password set for 'ファイルサーバ名$@AD名'
           succeeded
  [   216] Set initial account password
  [   223] Successfully connected to ip xx.xx.xx.xx, port 445
           using TCP
  [   274] Successfully connected to ip xx.xx.xx.xx, port 88 using
           TCP
  [   297] Successfully authenticated with DC
           adserver.AD名
  [   322] Unable to connect to NetLogon service on
           adserver.AD名 (Error:
           RESULT_ERROR_GENERAL_FAILURE)
**[   322] FAILURE: Unable to make a connection
**         (NetLogon:AD名), result: 3
  [   322] Unable to make a NetLogon connection to
           adserver.AD名 using the new machine account

Error: command failed: Failed to create the Active Directory machine account
       "ファイルサーバ名". Reason: general failure.

netapp::>

このとき「vserver cifs security show -vserver ファイルサーバ名」で確認する「SMB? Enabled for DC Connections」は下記の通り。

netapp::> vserver cifs security show -vserver ファイルサーバ名

Vserver: ファイルサーバ名

                            Kerberos Clock Skew:                   - minutes
                            Kerberos Ticket Age:                   - hours
                           Kerberos Renewal Age:                   - days
                           Kerberos KDC Timeout:                   - seconds
                            Is Signing Required:                   -
                Is Password Complexity Required:                   -
           Use start_tls for AD LDAP connection:               false
                      Is AES Encryption Enabled:               false
                         LM Compatibility Level:  lm-ntlm-ntlmv2-krb
                     Is SMB Encryption Required:                   -
                        Client Session Security:                none
                SMB1 Enabled for DC Connections:               false
                SMB2 Enabled for DC Connections:      system-default
  LDAP Referral Enabled For AD LDAP connections:               false
               Use LDAPS for AD LDAP connection:               false

netapp::>

「SMB1 Enabled for DC Connections」をtrueに変更しても状況は変わらず。

Sambaサーバの /usr/local/samba/var/log.samba を確認すると、以下の出力があった。

[2020/08/07 14:26:55.226653,  0] ../../source4/rpc_server/netlogon/dcerpc_netlogon.c:284(dcesrv_netr_ServerAuthenticate3_helper)
  dcesrv_netr_ServerAuthenticate3_helper: schannel required but client failed to offer it. Client was ファイルサーバ名$

「schannel」というオプションが必要らしい。

Netlogon Issue “schannel required”」を参考に設定してみたところ、schannelというオプションはないというエラー…「Bug 13464 – smb.conf-configuration “server schannel = auto” needed in future versions」を見ると「server schannel = auto」が正しい模様。

/usr/local/samba/etc/smb.conf を下記の様に修正して、sambaを再起動したところ、ONTAP 9.7でのActive Directoryの参加が可能になった。

# Global parameters
[global]
        netbios name = ADサーバ名
        realm = AD名
        server role = active directory domain controller
        workgroup = AD名
        idmap_ldb:use rfc2307 = yes
        ldap server require strong auth = no
        server schannel = auto

[netlogon]
        path = /usr/local/samba/var/locks/sysvol/AD名/scripts
        read only = No

[sysvol]
        path = /usr/local/samba/var/locks/sysvol
        read only = No

samba 4で構築したドメインにNetApp 9.5が登録できない


注:この記事での事象はsamba 4で使用していた証明書の期限切れが原因でした。
「LDAP Error: Strong authentication is required Details」もしくは「「Unable to connect to NetLogon service on」」というエラーがでる場合については別途「ONTAP 9.5でsambaドメインに参加できない & ONTAP 9.7で失敗」という記事にしています。


テスト環境作成のためNetAppシミュレータの9.5P6を作ってsamba 4で構築したActive Directory環境に登録しようとした・・・

netapp95sim::*> vserver cifs create -cifs-server netappcifs -domain ad.osakana.net -ou CN=Computers -vserver netappcifs -netbios-aliases netappcifs

In order to create an Active Directory machine account for the CIFS server, you must supply the name and password of a
Windows account with sufficient privileges to add computers to the "CN=Computers" container within the "AD.OSAKANA.NET"
domain.

Enter the user name: administrator

Enter the password:

Error: Machine account creation procedure failed
  [   215] Loaded the preliminary configuration.
  [   267] Successfully connected to ip 172.17.44.49, port 88 using
           TCP
  [   342] Successfully connected to ip 172.17.44.49, port 636 using
           TCP
  [   379] Required certificate with CA ADSERVER.ad.osakana.net is
           not installed
  [   381] Unable to start LDAPS: Can't contact LDAP server
  [   381] Additional info: error:14090086:SSL
           routines:ssl3_get_server_certificate:certificate verify
           failed
  [   381] Unable to connect to LDAP (Active Directory) service on
           adserver.ad.osakana.net (Error: Can't contact LDAP
           server)
**[   381] FAILURE: Unable to make a connection (LDAP (Active
**         Directory):AD.OSAKANA.NET), result: 7642

Error: command failed: Failed to create the Active Directory machine account "netappcifs". Reason: LDAP Error: Cannot
       contact the LDAP server.

netapp95sim::*>

エラー発生。

なんか調べたところ、active-directoryというコマンドでも登録できるらしいのでそれでもテストしてみる。

netapp95sim::*> active-directory create -vserver netappcifs -account-name adserver -domain ad.osakana.net
  (vserver active-directory create)

In order to create an Active Directory machine account, you must supply the name and password of a Windows account with
sufficient privileges to add computers to the "CN=Computers" container within the "AD.OSAKANA.NET" domain.

Enter the user name: administrator

Enter the password:

Error: Machine account creation procedure failed
  [   179] Loaded the preliminary configuration.
  [   230] Successfully connected to ip 172.17.44.49, port 88 using
           TCP
  [   298] Successfully connected to ip 172.17.44.49, port 636 using
           TCP
  [   333] Required certificate with CA ADSERVER.ad.osakana.net is
           not installed
  [   335] Unable to start LDAPS: Can't contact LDAP server
  [   335] Additional info: error:14090086:SSL
           routines:ssl3_get_server_certificate:certificate verify
           failed
  [   336] Unable to connect to LDAP (Active Directory) service on
           adserver.ad.osakana.net (Error: Can't contact LDAP
           server)
**[   336] FAILURE: Unable to make a connection (LDAP (Active
**         Directory):AD.OSAKANA.NET), result: 7642

Error: command failed: Failed to create the Active Directory machine account "ADSERVER". Reason: LDAP Error: Cannot
       contact the LDAP server.

netapp95sim::*>

同じようにエラー。

この後いろいろ試行錯誤した結果、自己証明CAをNetAppに入れればいいのでは?とやってみた。(「クラスタまたはSVMがクライアントであるSSLサーバを認証するためのサーバCA証明書のインストール」)

netapp95sim::*> security certificate install -vserver netappcifs -type server-ca

Please enter Certificate: Press <Enter> when done
-----BEGIN CERTIFICATE-----
<sambaの/usr/local/samba/private/tls/ca.pemの内容を張り付け>
-----END CERTIFICATE-----


Error: command failed: The certificate has expired.

netapp95sim::*>

ん?「The certificate has expired.」???

samba公式「Configuring LDAP over SSL (LDAPS) on a Samba AD DC」の「Verifying the certificate」に書いてある手法で確認してみます。

# ls -l  /usr/local/samba/private/tls
合計 12
-rw-r--r--. 1 root root 2041  3月 27  2018 ca.pem
-rw-r--r--. 1 root root 2045  3月 27  2018 cert.pem
-rw-------. 1 root root 3243  3月 27  2018 key.pem
#

# openssl verify /usr/local/samba/private/tls/cert.pem -CApath /usr/local/samba/private/tls/ca.pem
/usr/local/samba/private/tls/cert.pem: O = Samba Administration, OU = Samba - temporary autogenerated HOST certificate, CN = ADSERVER.AD.OSAKANA.NET
error 20 at 0 depth lookup:unable to get local issuer certificate
Error opening certificate file -CApath
140285523859344:error:02001002:system library:fopen:No such file or directory:bss_file.c:402:fopen('-CApath','r')
140285523859344:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:404:
unable to load certificate
/usr/local/samba/private/tls/ca.pem: O = Samba Administration, OU = Samba - temporary autogenerated CA certificate, CN = ADSERVER.AD.OSAKANA.NET
error 18 at 0 depth lookup:self signed certificate
O = Samba Administration, OU = Samba - temporary autogenerated CA certificate, CN = ADSERVER.AD.OSAKANA.NET
error 10 at 0 depth lookup:certificate has expired
OK
#

はい。証明書の有効期限切れでした。

手順がめんどいので、/usr/local/samba/private/tlsにあるファイルをリネームしてから「systemctl stop samba-ad-dc.service」「systemctl start samba-ad-dc.service」で強制再作成させました。

ONTAP9でボリューム削除して再作成しようとしたら空き容量がないと言われる


NetApp ONTAP8 7-modeで使用中のボリュームがあり、それをNetApp ONTAP9.5環境に対してtransitionのsnapmirrorを行った。

が・・・元ボリュームがqtree snapmirror中であったため、最後の処理で失敗した。(event log showの結果より)

1/14/2020 05:52:49  netapp95         ERROR         smc.snapmir.init.fail: Initialize from source volume 'netapp7mode:vol211' to destination volume 'netapp95svm:vol211' failed with error 'Transfer failed.'. Relationship UUID 'a3555a83-3360-11ea-a0b6-00a098f844df'.
1/14/2020 05:52:49  netapp95         ERROR         replication.dst.err: SnapMirror: destination transfer from netapp7mode:vol211 to vol211 : replication transfer failed to complete.
1/14/2020 05:52:49  netapp95         ERROR         snapmirror.dst.OnlineErr: SnapMirror not able to bring destination volume vol211 online, CR_TRANS_QTREE_REPLICA.
1/14/2020 05:52:46  netapp95         ERROR         wafl.voltrans.qtree.replica: The source of volume vol211 is a qtree replica. It cannot be transitioned to clustered Data ONTAP.

これについては、元のボリューム(netapp7mode:vol211)が受け側となっているqtree snapmirror全てに対して、「snapmirror quiesce netapp7mode:/vol/vol211/~」 と「snapmirror break netapp7mode:/vol/vol211/~」 を実行し、snapmirrorのステータスが「Broken-off」であれば7mode→ONTAP9へのtransition snapmirrorが成功することを確認。

で、snapmirrorの初期化(snapmirror initialize)にした場合、受け側のボリューム(今回はnetapp95svm:vol211)を削除して、再作成する必要がある。

netapp95上で「snapmirror delete -destination-path netapp95svm:vol211」でsnapmirror登録を消した後、ボリュームを「volume offline -vserver netapp95svm -volume vol211」でオフラインにしてから「volume delete -vserver netapp95svm -volume vol211」 で削除。

そして、「volume create -vserver netapp95svm -volume vol211 -aggregate aggr名 -size 22t -state online -type DP」で作成!

netapp95::> volume create -vserver netapp95svm -volume vol211 -aggregate aggr名 -size 22t -state online -type DP
[Job 351] Job is queued: Create vol211.                                        

Error: command failed: [Job 351] Job failed: Failed to create the volume on
       node "netapp95svm". Reason: Request to create volume "vol211" failed
       because there is not enough space in aggregate "aggr名". Either
       create 10.9TB of free space in the aggregate or select a size of at most
       11.2TB for the new volume. 
netapp95::>

おや?

netapp95::> storage aggregate show
Aggregate     Size Available Used% State   #Vols  Nodes            RAID Status
--------- -------- --------- ----- ------- ------ ---------------- ------------
<略>
aggr名 
           29.41TB   11.29TB   62% online       2 netapp95svm      raid_dp,
                                                                   normal
<略>
netapp95::>

まだ使用中という認識になっている???

いろいろ調べた結果、ONTAP 8.3より導入されたVolume Recovery Queueにより、削除したボリュームは12時間残しておく、という機能によるものだった。

How to use the Volume Recovery Queue feature in clustered Data ONTAP 8.3
How to enable the volume recovery queue in clustered Data ONTAP 8.3
After deleting a volume, the volume is brought offline with type DEL

強制的に削除するにはdiagモードにあるvolume recovery-queue purgeを使用する。

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

netapp95::*> volume recovery-queue show
Vserver   Volume      Deletion Request Time     Retention Hours
--------- ----------- ------------------------  ---------------
netapp95svm vol211_1032_1032 
                      Thu Jan 16 14:33:18 2020               12

netapp95::*> 

上記の「volume recovery-queue show」で現在保持している削除したボリュームを確認できる。

削除は「volume recovery-queue purge -vserver netapp95svm -volume vol211_1032_1032」というような感じで実行する。

netapp95::*> volume recovery-queue purge -vserver netapp95svm -volume vol211_1032_1032 
Queued private job: 251                                                        

netapp95::*> volume recovery-queue show
This table is currently empty.

netapp95::*> 

消えたのでaggregateは復活したはず!!!

netapp95::*> df -A -h
Aggregate                total       used      avail capacity
<略>
aggr名                    29TB       18TB       11TB      61%
aggr名/.snapshot            0B         0B         0B       0%
<略>
netapp95::*>

あれ????

なぜだろー??

なぜだろー???としばらく検索してから、再度実行

netapp95::*> df -A -h
Aggregate                total       used      avail capacity
<略>
aggr名                    29TB       16TB       12TB      57%
aggr名/.snapshot            0B         0B         0B       0%
<略>
netapp95::*> 

おや?空き容量が少し増えてる?

「df -A」の実行に切り替えてみると、徐々に空き容量が増えていっていることが判明。

どうやら内部処理に時間がかかっているだけのようでした。

ちなみに別件でトラブった時にサポートに聞いたら、この徐々に空き容量が増える、という内部処理を無くすことはできない、とのことでした。

cluster ONTAP/ONTAP9のNFS exports設定にNISホスト名が使えないのでdnsmasqでごまかすことにした


NetAppのcluster ONTAP8.x/ONTAP9はNISを使える、と書いてあるものの、詳細を確認すると、NISホスト名は使用できず、NISユーザとパスワード、NISグループ、NIS netgroup(ホスト名用のグループ)しか使えないとのこと。

NIS netgroup対応といっても、netgroupに含まれるホスト名にNIS ホスト名が許されるわけではなく、DNS起因のホスト名の使用が許される、というものでした。(ONTAPシミュレータで確認)

既存のDNSサーバにエントリを追加してもらえれば解決ではありますが、できるかどうかわからないので、お手軽にできる回避策として、RHEL6/RHEL7などの標準パッケージ群に含まれているdnsmasqを使用した簡易DNSサーバを立ててみることにした。

dnsmasqは/etc/hostsもしくはhostsフォーマットに準じたファイルを指定して、そこのエントリを元にDNS応答を返すことができる。

NISホスト名を「ypcat hosts」で一括出力するとhostsフォーマットでエントリが取得できるので、crontabで定期的に「ypcat hosts」を実行して情報更新を行い、dnsmasqでDNSで応答を返せるようにした。

まずは、DNSサーバのインストール。

[root@nisclient ~]# yum install dnsmasq
読み込んだプラグイン:fastestmirror
インストール処理の設定をしています
Loading mirror speeds from cached hostfile
 * base: ftp.nara.wide.ad.jp
 * extras: ftp.nara.wide.ad.jp
 * updates: ftp.nara.wide.ad.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> Package dnsmasq.x86_64 0:2.48-18.el6_9 will be インストール
--> 依存性解決を終了しました。

依存性を解決しました

================================================================================
 パッケージ       アーキテクチャ  バージョン                リポジトリー   容量
================================================================================
インストールしています:
 dnsmasq          x86_64          2.48-18.el6_9             base          150 k

トランザクションの要約
================================================================================
インストール         1 パッケージ

総ダウンロード容量: 150 k
インストール済み容量: 294 k
これでいいですか? [y/N]y
パッケージをダウンロードしています:
dnsmasq-2.48-18.el6_9.x86_64.rpm                         | 150 kB     00:00
rpm_check_debug を実行しています
トランザクションのテストを実行しています
トランザクションのテストを成功しました
トランザクションを実行しています
  インストールしています  : dnsmasq-2.48-18.el6_9.x86_64                    1/1
  Verifying               : dnsmasq-2.48-18.el6_9.x86_64                    1/1

インストール:
  dnsmasq.x86_64 0:2.48-18.el6_9

完了しました!
[root@nisclient ~]#

/etc に配置された設定ファイルを確認。

[root@nisclient ~]# ls -l /etc/dnsmasq.*
-rw-r--r--. 1 root root 21214 10月  3 08:18 2017 /etc/dnsmasq.conf

/etc/dnsmasq.d:
合計 0
[root@nisclient ~]#

NISで配布されたhostsを/etc/hosts-from-nisに保存するということにして、/etc/hosts は使用しない、ということにして、/etc/dnsmasq.conf の以下を変更

変更前
# If you don't want dnsmasq to read /etc/hosts, uncomment the
# following line.
#no-hosts
# or if you want it to read another file, as well as /etc/hosts, use
# this.
#addn-hosts=/etc/banner_add_hosts
変更後
# If you don't want dnsmasq to read /etc/hosts, uncomment the
# following line.
no-hosts
# or if you want it to read another file, as well as /etc/hosts, use
# this.
addn-hosts=/etc/hosts-from-nis

上記以外のエントリは標準設定のままです。NISから配布されたhostsを/etc/hosts-from-nisに保存

[root@nisclient ~]# ypcat hosts > /etc/hosts-from-nis
[root@nisclient ~]# cat /etc/hosts-from-nis
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
172.17.44.100   nfstest
172.17.44.49    server49      server49.vm2.example.com
172.17.44.49    server49      server49.vm2.example.com
172.17.44.87    server87
172.17.44.88    server88
172.17.44.89    server89
[root@nisclient ~]#

続いてfirewalld/iptablesの設定変更して、ポート53のtcp/udpを許可。

[root@nisclient ~]# cat /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 53 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 53 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
[root@nisclient ~]# service iptables restart
iptables: チェインをポリシー ACCEPT へ設定中filter         [  OK  ]
iptables: ファイアウォールルールを消去中:                  [  OK  ]
iptables: モジュールを取り外し中:                          [  OK  ]
iptables: ファイアウォールルールを適用中:                  [  OK  ]
[root@nisclient ~]#

firewalldの場合は以下

-bash-4.2# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens192
  sources:
  services: dhcpv6-client ssh
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

-bash-4.2# firewall-cmd --permanent --zone=public --add-service=dns
success
-bash-4.2# firewall-cmd --reload
success
-bash-4.2# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens192
  sources:
  services: dhcpv6-client dns ssh
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

-bash-4.2#

で、dnsmasqを起動して、DNSにより名前解決ができるか確認してみます。

[root@nisclient ~]# service dnsmasq status
dnsmasq は停止しています
[root@nisclient ~]# service dnsmasq start
Starting dnsmasq:                                          [  OK  ]
[root@nisclient ~]# service dnsmasq status
dnsmasq (pid  1556) を実行中...
[root@nisclient ~]#

[root@nisclient ~]# nslookup nfstest 127.0.0.1
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   nfstest
Address: 172.17.44.100

[root@nisclient ~]#