I am trying to send UDP Packets using Linux Socket. Working inside a Linux VM. Server IP = 172.16.x.x Client IP = 172.21.x.x Both are connected via a Ethernet switch.

Doing a broadcast on company's intranet.

I have only access to the Client, on which i'm working.

Things i have tried:

  1. Output of ping - Host Unreachable
  2. traceroute output

172.21.x.x(172.21.x.x) 2999.524 ms !H 2995.515 ms !H 2999.495 ms !H 3. Also checked and modified iproute tables

While on the server side, I have access to log file. On which I can see that the server is calling a function which reads udp datagrams.

Does UDP broadcast work regardless of the subnet mask of the two devices?

Can anyone please confirm whether my packets are reaching the destination?

Thank you!

  • Is there a router (firewall?) between these networks? Are they in the same broadcast domain (wire, vlan, etc.)?
    – Ricky
    Oct 4, 2022 at 15:21
  • Yes, there is firewall and they are in same LAN Network.
    – shrishri
    Oct 6, 2022 at 8:00

1 Answer 1


No. standard broadcast are limited to the local subnet only. So it will only reach hosts that are in the same subnet and each subnet is tied to its network mask.

So if the subnet mask of the two hosts is (i.e. a single /12 network) for example, that would work (but since ping doesn't work this is unlikely).

If the mask is it wouldn't work.

You could use directed broadcast (a broadcast that is purposefully crafted to aim at a remote network), e.g., but you need to configure the router(s) in between to allow it.

Note that usually relying on broadcast is a bad idea and IPv6 has gotten rid of them, so you may want to reconsider your design.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.