

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 验证与 Active Directory 域控制器的连接
<a name="validate-ad-domain-controllers"></a>

 在创建已加入 Active Directory 的 FSx for Windows File Server 文件系统之前，请使用 Amazon FSx Active Directory 验证工具来验证与 Active Directory 域之间的连接。无论您与 FSx for Windows File Server 结合使用的是 AWS 托管 Microsoft Active Directory，还是自行管理的 Active Directory 配置，都可以使用此测试。域控制器网络连接测试（test-fsxadControllerConnection）不会对域中的每个域控制器运行整套网络连接检查。相反，应使用此测试针对一组特定的域控制器运行网络连接验证。<a name="test-ad-controller-connectivity"></a>

**验证与 Active Directory 域控制器的连接**

1. 在同一个子网中，启动一个具有相同 Amazon VPC 安全组且您要将其用于 FSx for Windows File Server 文件系统的 Amazon EC2 Windows 实例。对于多可用区部署类型，请使用首选活动文件服务器的子网。

1. 将 EC2 Windows 实例加入 Active Directory 有关更多信息，请参阅《AWS Directory Service 管理指南》**中的[手动加入 Windows 实例](https://docs.aws.amazon.com/directoryservice/latest/admin-guide/join_windows_instance.html)。

1. 连接到您的 EC2 实例。有关详细信息，请参阅《Amazon EC2 用户指南》中的 [Connecting to Your Windows Instance](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/connecting_to_windows_instance.html)**。

1. 在 EC2 实例上打开 Windows PowerShell 窗口（使用**以管理员身份运行**）。

   请使用以下测试命令测试是否已安装 Windows PowerShell 所需的 Active Directory 模块。

   

   ```
   PS C:\> Import-Module ActiveDirectory
   ```

   

   如果上一操作返回错误，请使用以下命令进行安装。

   

   ```
   PS C:\> Install-WindowsFeature RSAT-AD-PowerShell
   ```

1. 使用以下命令下载网络验证工具。

   

   ```
   PS C:\> Invoke-WebRequest "https://docs.aws.amazon.com/fsx/latest/WindowsGuide/samples/AmazonFSxADValidation.zip" -OutFile "AmazonFSxADValidation.zip"
   ```

1. 使用以下命令下载 zip 文件。

   ```
   PS C:\> Expand-Archive -Path "AmazonFSxADValidation.zip"
   ```

1. 将 AmazonFSxADValidation 模块添加到当前会话。

   ```
   PS C:\> Import-Module .\AmazonFSxADValidation
   ```

1. 设置 Active Directory 域控制器 IP 地址的值，然后使用以下命令运行连接测试：

   ```
   $ADControllerIp = '10.0.75.243'
   $Result = Test-FSxADControllerConnection -ADControllerIp $ADControllerIp
   ```

1. 以下示例所示为检索包含结果为连接测试成功的测试输出。

   ```
   PS C:\AmazonFSxADValidation> $Result
   
   Name                           Value
   ----                           -----
   TcpDetails                     {@{Port=88; Result=Listening; Description=Kerberos authentication}, @{Port=135; Resul...
   Server                         10.0.75.243
   UdpDetails                     {@{Port=88; Result=Timed Out; Description=Kerberos authentication}, @{Port=123; Resul...
   Success                        True
   
   
   PS C:\AmazonFSxADValidation> $Result.TcpDetails
   
   Port Result    Description
   ---- ------    -----------
     88 Listening Kerberos authentication
    135 Listening DCE / EPMAP (End Point Mapper)
    389 Listening Lightweight Directory Access Protocol (LDAP)
    445 Listening Directory Services SMB file sharing
    464 Listening Kerberos Change/Set password
    636 Listening Lightweight Directory Access Protocol over TLS/SSL (LDAPS)
   3268 Listening Microsoft Global Catalog
   3269 Listening Microsoft Global Catalog over SSL
   9389 Listening Microsoft AD DS Web Services, PowerShell
   ```

    以下示例所示为运行测试以及获得失败的结果。

   ```
   PS C:\AmazonFSxADValidation> $Result = Test-FSxADControllerConnection -ADControllerIp $ADControllerIp
   WARNING: TCP 9389 failed to connect. Required for Microsoft AD DS Web Services, PowerShell. 
   Verify security group and firewall settings on both client and directory controller.
   WARNING: 1 ports failed to connect to 10.0.75.243. Check pre-requisites in
   https://docs.aws.amazon.com/fsx/latest/WindowsGuide/self-managed-AD.html#self-manage-prereqs
   
   PS C:\AmazonFSxADValidation> $Result
   
   Name                           Value
   ----                           -----
   TcpDetails                     {@{Port=88; Result=Listening; Description=Kerberos authentication}, @{Port=135; Resul...
   Server                         10.0.75.243
   UdpDetails                     {@{Port=88; Result=Timed Out; Description=Kerberos authentication}, @{Port=123; Resul...
   Success                        False
   FailedTcpPorts                 {9389}
   
   
   PS C:\AmazonFSxADValidation> $Result.FailedTcpPorts
   9389
   ```
   
   Windows socket error code mapping
   
   https://msdn.microsoft.com/en-us/library/ms740668.aspx
   ```

**注意**  
作为上述过程的替代方法，您可以使用 `AWSSupport-ValidateFSxWindowsADConfig` 运行手册，验证自行管理的 Active Directory 配置。有关更多信息，请参阅《AWS Systems Manager Automation 运行手册参考》**中的 [https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/awssupport-validate-fsxwindows-adconfig.html](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/awssupport-validate-fsxwindows-adconfig.html)。