使用 TTL 加入多播组

JoinMulticastGroup with TTL

我正在使用 C# .net 框架 4.7。我的应用程序正在尝试加入几个路由器(跃点)之外的多播组。因此,我尝试发送 TTL > 1 的 IGMP 数据包。目前,我使用 UdpClient.JoinMulticastGroup() 并将 TTL 参数设置为 3,但是当我使用 Wireshark 检查 IGMP 数据包时,TTL 保持不变在 1.

这是我的代码

        UdpClient udpClient = new UdpClient();
        // Creates an IPAddress to use to join and drop the multicast group.
        IPAddress multicastIpAddress = IPAddress.Parse("239.192.16.107");
        udpClient.Client.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.IpTimeToLive, 10);
        udpClient.Client.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 10);
        udpClient.Ttl = 10;
        // The packet dies after 10 router hops.
        udpClient.JoinMulticastGroup(multicastIpAddress, 10);

网上的几个帖子好像说IGMP是针对本地网络的,所以TTL一直是1;但是,如果这是真的,为什么 JoinMulticastGroup 允许我们设置 TTL?但是另一方面,为什么我设置TTL为3时TTL没有改变?

有人可以确认多播加入数据包 (IGMP) 的 TTL 值是否可以不是 1?如果可以,那么我的代码中是否缺少某些内容?

更新: 我将 TTL 设置为 10,Wireshark 仍然显示 TTL=1

指定的 TTL 仅适用于传出的多播数据包。来自备注下的Microsoft Docs

The timeToLive parameter specifies how many router hops will be allowed for a multicasted datagram before being discarded.

IGMP 消息的 TTL 始终为 1,因为它们只需要由本地路由器接收。然后路由器将根据需要将自己的消息发送到其他路由器。有关详细信息,请参阅 https://networkengineering.stackexchange.com/questions/9636/why-ttl-value-1-in-igmp