本文介绍了跨子网的UDP广播数据包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过路由器将UDP广播数据包发送到其他子网?我正在编写一个应用程序以发现网络上的某些设备,而PC可能与它要查找的设备位于不同的子网中.

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.

推荐答案

是的,不是.

实际上是可行的,只要中间路由器未配置no ip directed-broadcasts或类似路由器即可.但是,如今这已成为默认设置,因为允许正常广播遍历路由器是DoS问题.

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.

如果您真的想跨子网广播,则应该改用 IP组播.仍然需要适当配置中间路由器,但这是正确"的方法.

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.

这篇关于跨子网的UDP广播数据包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 21:48