UDP broadcast packets across subnets

Jon B picture Jon B · Dec 18, 2008 · Viewed 39.7k times · Source

Is it possible to send a UDP broadcast packet to a different subnet through a router? I'm writing an app to discover certain devices on the network, and the PC might be on a different subnet than the devices it's looking for.

Answer

Alnitak picture Alnitak · Dec 18, 2008

Yes, and no.

It's actually do-able, so long as the intervening routers don't have no ip directed-broadcasts or similar configured. However these days that's the default because allowing normal broadcasts to traverse routers is a DoS problem.

If you really want to broadcast across subnets then you should be using IP Multicast instead. That still requires that the intervening routers are configured appropriately, but it is the "right" way to do it.