

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

# 管理目录的 DNS 条件转发器
<a name="ms_ad_conditional_forwarders"></a>

条件转发器是您在中配置的 DNS 设置，用于将特定域的查询路由Active Directory到一组定义的 DNS 服务器。条件转发器是Active Directory信任所必需的，也用于支持私有 DNS 域。每个条件转发器都由远程域的完全限定域名 (FQDN) 和一个或多个 DNS 服务器 IP 地址组成。

**注意**  
在 Amazon 托管 Microsoft AD 上，条件转发器存储在域中的每个域控制器中Active Directory并复制到域中的每个域控制器（其复制范围为`Domain`）。如果您的目录使用[Multi-Region复制](https://docs.amazonaws.cn/directoryservice/latest/admin-guide/multi-region-how-it-works.html)（企业版可用），则条件转发器也会自动复制到每个复制的 Amazon 区域。您可以从任何地区创建、更新或删除条件转发器一次。然后，更改将通过本机Active Directory复制传播到所有区域。

您可以从中运行以下命令 [Amazon CloudShell](https://docs.amazonaws.cn/cloudshell/latest/userguide/welcome.html)，这些命令随PowerShell[预安装的[Amazon CLI](https://docs.amazonaws.cn/cli/latest/userguide/cli-chap-welcome.html)和](https://docs.amazonaws.cn/powershell/latest/userguide/pstools-welcome.html)Amazon 工具一起提供。 Amazon CloudShell 自动配置您的证书。

1. 登录到 Amazon Web Services 管理控制台。

1. 打开 [Amazon CloudShell](https://console.amazonaws.cn/cloudshell/home)。要使用这些PowerShell命令，请运行`pwsh`。

## 在您的目录中列出条件转发器
<a name="ms_ad_conditional_forwarders_list"></a>

您可以使用 Amazon CLI 或PowerShell以下方法在您的目录中列出条件转发器：

------
#### [ Amazon CLI ]

**在您的目录中列出条件转发器**
+ 运行以下命令，将示例值替换为你自己的值：

  ```
  aws ds describe-conditional-forwarders \
    --directory-id {{d-123456abcd}}
  ```

  有关更多信息，请参阅《命令参考》[中的描述条件转发器。](https://docs.amazonaws.cn/cli/latest/reference/ds/describe-conditional-forwarders.html) *Amazon CLI *

------
#### [ PowerShell ]

**在您的目录中列出条件转发器**
+ 运行以下命令，将示例值替换为你自己的值：

  ```
  Get-DSConditionalForwarder `
    -DirectoryId {{d-123456abcd}}
  ```

  有关更多信息，请参阅[Get-DSConditionalForwarder](https://docs.amazonaws.cn/powershell/latest/reference/items/Get-DSConditionalForwarder.html)《 PowerShell Cmdlet *Amazon 工具参考》。*

------

## 为您的目录创建条件转发器
<a name="ms_ad_conditional_forwarders_create"></a>

您可以使用 Amazon CLI 或PowerShell以下方法为您的目录创建条件转发器：

------
#### [ Amazon CLI ]

**为您的目录创建条件转发器**
+ 运行以下命令，将示例值替换为你自己的值：

  ```
  aws ds create-conditional-forwarder \
    --directory-id {{d-123456abcd}} \
    --remote-domain-name {{company.example.com}} \
    --dns-ip-addrs {{10.0.0.20}} {{10.0.0.21}}
  ```

  有关更多信息，请参阅《命令参考》中的 [ create-conditional-forwarder。](https://docs.amazonaws.cn/cli/latest/reference/ds/create-conditional-forwarder.html) *Amazon CLI *

------
#### [ PowerShell ]

**为您的目录创建条件转发器**
+ 运行以下命令，将示例值替换为你自己的值：

  ```
  New-DSConditionalForwarder `
    -DirectoryId {{d-123456abcd}} `
    -RemoteDomainName {{company.example.com}} `
    -DnsIpAddr {{10.0.0.20}},{{10.0.0.21}}
  ```

  有关更多信息，请参阅[New-DSConditionalForwarder](https://docs.amazonaws.cn/powershell/latest/reference/items/New-DSConditionalForwarder.html)《 PowerShell Cmdlet *Amazon 工具参考》。*

------

## 更新目录中的条件转发器
<a name="ms_ad_conditional_forwarders_update"></a>

要更新现有条件转发器的 DNS 服务器，请将相同的远程域名与新的 DNS 服务器 IP 地址集合使用。新地址将覆盖先前的 IP 地址。您可以使用 Amazon CLI 或PowerShell更新条件转发器：

------
#### [ Amazon CLI ]

**更新目录中的条件转发器**
+ 运行以下命令，将示例值替换为你自己的值：

  ```
  aws ds update-conditional-forwarder \
    --directory-id {{d-123456abcd}} \
    --remote-domain-name {{company.example.com}} \
    --dns-ip-addrs {{10.2.0.20}} {{10.2.0.21}}
  ```

  有关更多信息，请参阅《命令参考》中的[更新条件转发器。](https://docs.amazonaws.cn/cli/latest/reference/ds/update-conditional-forwarder.html) *Amazon CLI *

------
#### [ PowerShell ]

**更新目录中的条件转发器**
+ 运行以下命令，将示例值替换为你自己的值：

  ```
  Update-DSConditionalForwarder `
    -DirectoryId {{d-123456abcd}} `
    -RemoteDomainName {{company.example.com}} `
    -DnsIpAddr {{10.2.0.20}},{{10.2.0.21}}
  ```

  有关更多信息，请参阅[Update-DSConditionalForwarder](https://docs.amazonaws.cn/powershell/latest/reference/items/Update-DSConditionalForwarder.html)《 PowerShell Cmdlet *Amazon 工具参考》。*

------

## 从您的目录中移除条件转发器
<a name="ms_ad_conditional_forwarders_remove"></a>

您可以使用 Amazon CLI 或PowerShell以下方法将条件转发器从您的目录中移除：

------
#### [ Amazon CLI ]

**从您的目录中移除条件转发器**
+ 运行以下命令，将示例值替换为你自己的值：

  ```
  aws ds delete-conditional-forwarder \
    --directory-id {{d-123456abcd}} \
    --remote-domain-name {{company.example.com}}
  ```

  有关更多信息，请参阅《命令参考》[中的删除条件转发器。](https://docs.amazonaws.cn/cli/latest/reference/ds/delete-conditional-forwarder.html) *Amazon CLI *

------
#### [ PowerShell ]

**从您的目录中移除条件转发器**
+ 运行以下命令，将示例值替换为你自己的值：

  ```
  Remove-DSConditionalForwarder `
    -DirectoryId {{d-123456abcd}} `
    -RemoteDomainName {{company.example.com}}
  ```

  有关更多信息，请参阅[Remove-DSConditionalForwarder](https://docs.amazonaws.cn/powershell/latest/reference/items/Remove-DSConditionalForwarder.html)《 PowerShell Cmdlet *Amazon 工具参考》。*

------