接收从“超级网”发送的本地广播分组
我的问题是针对 Linux 的,在 C 语言中。
假设子网 /16 上的主机 A 正在发送广播 UDP 数据包。 (即通过广播到 xxx.xxx.255.255)
子网掩码为 /24 的子网上的主机 B 是否有办法接收该广播?
我在主机 B 上的测试程序在正确的端口上等待,但如果 A 发送到 xxx.xxx.255.255,则不会收到任何内容。但当使用 xxx.xxx.xxx.255 时就会出现这种情况。
此外,我还有一些限制 1.我无法更改网络配置, 2. 主机A 上运行的旧程序的行为也无法更改。
谢谢!
My question is for Linux, in C.
Say host A on subnet /16 is sending a broadcast UDP packet. (ie. by broadcasting to xxx.xxx.255.255)
Is there a way for host B on the sub-subnet with a subnet mask /24 to receive that broadcast?
My test program on host B waits on the right port but does not receive anything if A sends to xxx.xxx.255.255. But it does when xxx.xxx.xxx.255 is used.
Moreover I have constraints that
1. I cannot change network config,
2. Legacy program running on Host A doing that cannot be changed either.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,听起来您的网络配置不正确。
网络不能重叠。要么您有一个 /16 网络,并且该 /16 中的每台主机都使用
255.255.0.0
作为网络掩码;或者您已将其分成较小的网络,在这种情况下,每个较小的网络将有自己的网络掩码和广播地址。No, and it sounds like your network is configured incorrectly.
You cannot have overlapping networks. Either you have a /16 network, and every host within that /16 uses
255.255.0.0
as the netmask; or you have broken it up into smaller networks, in which case each smaller network will have its own netmask and broadcast address.尝试广播到计算机所在的子网。 xx?.255
例如
由于计算机被锁定到子网 /24,因此它只会锁定到其范围内的 IP。
并且其广播也在其范围之内。
try broadcasting to the subnet that computer is on. x.x.?.255
e.g.
since the computer is locked to the subnet /24 it will be locked only to ip's in its range.
and its broadcast is within its range.