如何为我的应用程序选择多播地址?

时间:2022-03-08 07:20:20

How should I choose an IPv4 multicast address for my application's use? I may need more than one (a whole range perhaps ultimately) but just want to avoid conflicts with other applications.

我应该如何为我的应用程序选择IPv4多播地址?我可能需要不止一个(最终可能是一个整个范围),但只是想避免与其他应用程序冲突。

  • Packets will be entirely contained within an administrative domain, probably a LAN
  • 数据包将完全包含在管理域中,可能是LAN

  • If several independent instances of my application are in use on the same network, they could each use their own multicast address - but if they don't, they will be able to coexist anyway, they'll just have a small amount of overhead ignoring each others' packets.
  • 如果我的应用程序的几个独立实例在同一个网络上使用,它们每个都可以使用自己的多播地址 - 但如果它们没有,它们将能够共存,它们只会有少量的开销忽略彼此的包裹。

  • My packets already contain a "magic number" to avoid problems
  • 我的数据包已经包含一个“幻数”以避免出现问题

  • I will be checking the originator address (which I know can be spoofed of course), TTL and other things to try to prevent unexpected packets mucking things up.
  • 我将检查发起人地址(我知道当然可以欺骗),TTL和其他事情,以防止意外的数据包混乱。

Ideas please :)

想法请:)

Currently I've just allocated an arbitrary one from the "local use" space, 239.255.42.99

目前我刚从“本地使用”空间分配了一个任意的空间,239.255.42.99

5 个解决方案

#1


31  

It seems you've already found http://www.iana.org/assignments/multicast-addresses, so you've done the right thing by picking an address from the 239.255/16 range.

看来你已经找到了http://www.iana.org/assignments/multicast-addresses,所以你通过选择239.255 / 16范围内的地址做了正确的事情。

As those ranges are entirely for site-local use it's no ones else's business which particular address you pick, but you may need to coordinate with the network manager (assuming that's not you) to pick an alternate address pool.

由于这些范围完全用于站点本地使用,因此您选择的特定地址不是别人的业务,但您可能需要与网络管理员(假设不是您)协调以选择备用地址池。

As others have suggested, just make sure there's an easy way to change the address just in case it does conflict with another address on the local LAN.

正如其他人所建议的那样,只要确保有一种简单的方法来改变地址,以防它与本地局域网上的另一个地址发生冲突。

If the multiple applications issue becomes a problem, provide a (locally) well-known multicast address which the applications can talk to which will issue unique local-scope IP addresses for clients' use.

如果多个应用程序问题成为问题,请提供应用程序可以与之通信的(本地)众所周知的多播地址,该地址将发出唯一的本地范围IP地址供客户端使用。

#2


4  

As already suggested, allow the range to be configured. But taking that further, don't require configuration. You pick the range and allow configuration to override if necessary.

如已经建议的那样,允许配置范围。但进一步说,不要求配置。您可以选择范围并允许配置在必要时覆盖。

You should have some logic in your application to handle foreign packets, to alert the user, through logs, or some other mechanism, that your application has detected multicast packets from another app, with instructions on how to change the configuration.

您的应用程序中应该有一些逻辑来处理外部数据包,通过日志或其他一些机制警告用户您的应用程序检测到来自另一个应用程序的多播数据包,并提供有关如何更改配置的说明。

If it turns out that there is a conflict, play those numbers in the lottery!

如果事实证明存在冲突,请在彩票中播放这些数字!

#3


3  

Have you seen this ?

你见过这个吗 ?

MADCAP

#4


1  

If it is just for internal use then why not just externalize the address range as configuration and continue to use internal use.

如果它仅供内部使用,那么为什么不将地址范围外部化为配置并继续使用内部使用。

The Internet Assigned Numbers Authority is responsible for assigning IP addresses. They do not allocate to ISPs or individuals but on they have information where to get numbers allocated depending on your region.

Internet Assigned Numbers Authority负责分配IP地址。它们不分配给ISP或个人,但是他们有信息可以根据您所在的地区分配数字。

#5


0  

ZMAAP is a zero-configuration alternative to MADCAP. I doubt there are any public source implementations of it. If you find one, then I'd like to know about it.

ZMAAP是MADCAP的零配置替代方案。我怀疑它有任何公共源实现。如果你找到一个,那么我想知道它。

#1


31  

It seems you've already found http://www.iana.org/assignments/multicast-addresses, so you've done the right thing by picking an address from the 239.255/16 range.

看来你已经找到了http://www.iana.org/assignments/multicast-addresses,所以你通过选择239.255 / 16范围内的地址做了正确的事情。

As those ranges are entirely for site-local use it's no ones else's business which particular address you pick, but you may need to coordinate with the network manager (assuming that's not you) to pick an alternate address pool.

由于这些范围完全用于站点本地使用,因此您选择的特定地址不是别人的业务,但您可能需要与网络管理员(假设不是您)协调以选择备用地址池。

As others have suggested, just make sure there's an easy way to change the address just in case it does conflict with another address on the local LAN.

正如其他人所建议的那样,只要确保有一种简单的方法来改变地址,以防它与本地局域网上的另一个地址发生冲突。

If the multiple applications issue becomes a problem, provide a (locally) well-known multicast address which the applications can talk to which will issue unique local-scope IP addresses for clients' use.

如果多个应用程序问题成为问题,请提供应用程序可以与之通信的(本地)众所周知的多播地址,该地址将发出唯一的本地范围IP地址供客户端使用。

#2


4  

As already suggested, allow the range to be configured. But taking that further, don't require configuration. You pick the range and allow configuration to override if necessary.

如已经建议的那样,允许配置范围。但进一步说,不要求配置。您可以选择范围并允许配置在必要时覆盖。

You should have some logic in your application to handle foreign packets, to alert the user, through logs, or some other mechanism, that your application has detected multicast packets from another app, with instructions on how to change the configuration.

您的应用程序中应该有一些逻辑来处理外部数据包,通过日志或其他一些机制警告用户您的应用程序检测到来自另一个应用程序的多播数据包,并提供有关如何更改配置的说明。

If it turns out that there is a conflict, play those numbers in the lottery!

如果事实证明存在冲突,请在彩票中播放这些数字!

#3


3  

Have you seen this ?

你见过这个吗 ?

MADCAP

#4


1  

If it is just for internal use then why not just externalize the address range as configuration and continue to use internal use.

如果它仅供内部使用,那么为什么不将地址范围外部化为配置并继续使用内部使用。

The Internet Assigned Numbers Authority is responsible for assigning IP addresses. They do not allocate to ISPs or individuals but on they have information where to get numbers allocated depending on your region.

Internet Assigned Numbers Authority负责分配IP地址。它们不分配给ISP或个人,但是他们有信息可以根据您所在的地区分配数字。

#5


0  

ZMAAP is a zero-configuration alternative to MADCAP. I doubt there are any public source implementations of it. If you find one, then I'd like to know about it.

ZMAAP是MADCAP的零配置替代方案。我怀疑它有任何公共源实现。如果你找到一个,那么我想知道它。