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 us开发者_StackOverflow社区ed.
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!
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.
try broadcasting to the subnet that computer is on. x.x.?.255
e.g.
ip is 24.234.123.?
broadcast to 24.234.123.255
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.
精彩评论