跨子网的 UDP 广播数据包 [英] UDP broadcast packets across subnets

查看:18
本文介绍了跨子网的 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 ipdirected-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 广播数据包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆