向导出策略添加规则
如果没有规则,导出策略就无法向客户端提供对数据的访问权限。要新建导出规则,必须确定客户端并选择客户端匹配格式、选择访问和安全类型、指定匿名用户标识映射、选择规则索引号,并选择访问协议。然后,可以使用 vserver export-policy rule create 命令为导出策略添加新的规则。
开始之前
要添加导出规则的导出策略必须已存在。
必须在数据 SVM 上正确配置 DNS,且 DNS 服务器必须具有 NFS 客户端的正确条目。
这是因为 ONTAP 会针对某些客户端匹配格式使用数据 SVM 的 DNS 配置执行 DNS 查找,而导出策略规则匹配失败可能会妨碍客户端访问数据。
如果使用 Kerberos 进行认证,必须已确定在 NFS 客户端上将使用以下哪种安全方法:
- krb5(Kerberos V5 协议)
- krb5i(使用校验和进行完整性检查的 Kerberos V5 协议)
- krb5p(带隐私服务的 Kerberos V5 协议)
关于本任务
如果导出策略中的现有规则可满足您的客户端匹配和访问要求,则不必创建新规则。如果使用 Kerberos 进行认证,且通过 Kerberos 访问 SVM 的所有卷,则可将根卷的导出规则选项 -rorule、-rwrule 和 -superuser 设置为 krb5、krb5i 或 krb5p。
示例
以下命令在名为 vs1 的 SVM 上,为名为 rs1 的导出策略创建导出规则,并验证是否已创建。此规则的索引号为 1。此规则匹配 eng.company.com 域中和 netgroup @netgroup1 中的任何客户端。此规则启用所有 NFS 访问。对于使用 AUTH_SYS 认证的用户,它可启用只读和读写访问权限。除非使用 Kerberos 进行认证,否则 UNIX 用户标识为 0(零)的客户端均是匿名的。
vs1::> vserver export-policy rule create -vserver vs1 -policyname exp1 -ruleindex 1 -protocol nfs
-clientmatch eng.company.com,@netgoup1 -rorule sys -rwrule sys -anon 65534 -superuser krb5
vs1::> vserver export-policy rule show -policyname nfs_policy
Virtual Policy Rule Access Client RO
Server Name Index Protocol Match Rule
------------ -------------- ------ -------- ---------------- ------
vs1 exp1 1 nfs eng.company.com, sys
@netgroup1
vs1::> vserver export-policy rule show -policyname exp1 -vserver vs1 -ruleindex 1
Vserver: vs1
Policy Name: exp1
Rule Index: 1
Access Protocol: nfs
Client Match Hostname, IP Address, Netgroup, or Domain: eng.company.com,@netgroup1
RO Access Rule: sys
RW Access Rule: sys
User ID To Which Anonymous Users Are Mapped: 65534
Superuser Security Types: krb5
Honor SetUID Bits in SETATTR: true
Allow Creation of Devices: true
以下命令在名为 vs2 的 SVM 上,为名为 expol2 的导出策略创建导出规则,并验证是否已创建。规则的索引号为 21。此规则匹配的客户端是 netgroup dev_netgroup_main 的成员。此规则启用所有 NFS 访问。对于使用 AUTH_SYS 认证的用户,它可启用只读访问权限,对于读写访问和根访问,需要 Kerberos 认证。除非使用 Kerberos 进行认证,否则 UNIX 用户标识为 0(零)的客户端根访问将被拒绝。
vs2::> vserver export-policy rule create -vserver vs2 -policyname expol2 -ruleindex 21 -protocol nfs
-clientmatch @dev_netgroup_main -rorule sys -rwrule krb5 -anon 65535 -superuser krb5
vs2::> vserver export-policy rule show -policyname nfs_policy
Virtual Policy Rule Access Client RO
Server Name Index Protocol Match Rule
-------- ------------ ------ -------- ------------------ ------
vs2 expol2 21 nfs @dev_netgroup_main sys
vs2::> vserver export-policy rule show -policyname expol2 -vserver vs1 -ruleindex 21
Vserver: vs2
Policy Name: expol2
Rule Index: 21
Access Protocol: nfs
Client Match Hostname, IP Address, Netgroup, or Domain:
@dev_netgroup_main
RO Access Rule: sys
RW Access Rule: krb5
User ID To Which Anonymous Users Are Mapped: 65535
Superuser Security Types: krb5
Honor SetUID Bits in SETATTR: true
Allow Creation of Devices: true