跨子网广播数据包

跨子网广播数据包

本文介绍了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.

推荐答案

是,也不是.

它实际上是可行的,只要中间路由器没有没有 ip 定向广播 或类似的配置.然而,现在这是默认设置,因为允许普通广播穿越路由器是一个 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