

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 驗證 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 Managed Microsoft Active Directory 或自我管理 Active Directory 組態，都可以使用此測試。網域控制站網路連線測試 (Test-FSxADControllerConnection) 不會對網域中的每個網域控制站執行完整的網路連線檢查套件。反之，請使用此測試對一組特定的網域控制站執行網路連線驗證。<a name="test-ad-controller-connectivity"></a>

**驗證與 Active Directory 網域控制站的連線**

1. 在相同子網路中啟動 Amazon EC2 Windows 執行個體，並使用您將用於 FSx for Windows File Server 檔案系統的相同 Amazon VPC 安全群組。對於異地同步備份部署類型，請將子網路用於偏好的作用中檔案伺服器。

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 使用者指南*》中的[連線至您的 Windows 執行個體](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` Runbook 驗證自我管理的 Active Directory 組態。如需詳細資訊，請參閱 *AWS Systems Manager Automation Runbook 參考* 中的 [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)。