

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

# 在 AWS Transit Gateway 中为 Windows Server 设置组播
<a name="multicastwin"></a>

 在 Windows Server 2019 或 2022 上设置多播以使用中转网关时，您需要执行其他步骤。要进行此设置，你需要使用 PowerShell，然后运行以下命令：

**使用 PowerShell 为 Windows Server 设置组播**

1. 针对 TCP/IP 堆栈，将 Windows Server 更改为使用 IGMPv2 而不是 IGMPv3：

   `PS C:\> New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters -Name IGMPVersion -PropertyType DWord -Value 3 `
**注意**  
`New-ItemProperty` 是指定 IGMP 版本的属性索引。由于 IGMP v2 是组播支持的版本，因此该属性 `Value` 必须为 `3`。您可运行以下命令将 IGMP 版本设置为 2，而无需编辑 Windows 注册表。：  
`Set-NetIPv4Protocol -IGMPVersion Version2`

1. 默认情况下，Windows 防火墙会丢弃大多数 UDP 流量。您首先需要检查哪个连接配置文件用于多播：

   ```
   PS C:\> Get-NetConnectionProfile | Select-Object NetworkCategory
   
   NetworkCategory
   ---------------
            Public
   ```

1. 更新上一步中的连接配置文件以允许访问所需的 UDP 端口：

   `PS C:\> Set-NetFirewallProfile -Profile Public -Enabled False`

1. 重启 EC2 实例。

1. 测试您的多播应用程序，确保流量按预期流动。