为什么 SNMP 通常通过 UDP 而不是 TCP/IP 运行? [英] Why is SNMP usually run over UDP and not TCP/IP?

查看:157
本文介绍了为什么 SNMP 通常通过 UDP 而不是 TCP/IP 运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天早上,工作中出现了大问题,因为 SNMP 陷阱没有通过",因为 SNMP 是通过 UDP 运行的.我记得在大学网络课上,UDP 不能像 TCP/IP 那样保证传输.而且维基百科说SNMP可以在TCP/IP上运行,但UDP更常见.

This morning, there were big problems at work because an SNMP trap didn't "go through" because SNMP is run over UDP. I remember from the networking class in college that UDP isn't guaranteed delivery like TCP/IP. And Wikipedia says that SNMP can be run over TCP/IP, but UDP is more common.

我知道 UDP 相对于 TCP/IP 的一些优势是速度、广播和多播.但在我看来,对于网络监控而言,保证交付比广播能力更重要.特别是当存在严重的高安全性需求时.我的一个同事告诉我,当流量变大时,UDP 数据包是第一个被丢弃的.这是在网络监控 (IMO) 方面更喜欢 TCP/IP 而非 UDP 的另一个原因.

I get that some of the advantages of UDP over TCP/IP are speed, broadcasting, and multicasting. But it seems to me that guaranteed delivery is more important for network monitoring than broadcasting ability. Particularly when there are serious high-security needs. One of my coworkers told me that UDP packets are the first to be dropped when traffic gets heavy. That is yet another reason to prefer TCP/IP over UDP for network monitoring (IMO).

那么为什么 SNMP 使用 UDP?我无法弄清楚,也无法在 Google 上找到充分的理由.

So why does SNMP use UDP? I can't figure it out and can't find a good reason on Google either.

推荐答案

实际上,在有损网络(或拥塞网络)中,UDP 预计会比 TCP 工作得更好.TCP 在传输大量数据方面要好得多,但是当网络出现故障时,UDP 更有可能通过.(事实上​​,我最近做了一项测试,发现当 UDP 超时设置正确时,UDP 上的 SNMP 在有损网络中比 TCP 上的 SNMP 成功得多).通常,TCP 在丢包率约为 5% 时开始表现不佳,并在 33% (ish) 时变得完全无用,而 UDP 仍会成功(最终).

UDP is actually expected to work better than TCP in lossy networks (or congested networks). TCP is far better at transferring large quantities of data, but when the network fails it's more likely that UDP will get through. (in fact, I recently did a study testing this and it found that SNMP over UDP succeeded far better than SNMP over TCP in lossy networks when the UDP timeout was set properly). Generally, TCP starts behaving poorly at about 5% packet loss and becomes completely useless at 33% (ish) and UDP will still succeed (eventually).

因此,一如既往,正确的做法是为正确的工作选择正确的工具.如果您正在对大量数据进行例行监控,您可以考虑使用 TCP.但是准备回退到 UDP 来解决问题.现在大多数堆栈实际上可以同时使用 TCP 和 UDP.

So the right thing to do, as always, is pick the right tool for the right job. If you're doing routine monitoring of lots of data, you might consider TCP. But be prepared to fall back to UDP for fixing problems. Most stacks these days can actually use both TCP and UDP.

至于发送 TRAP,是的,TRAP 是不可靠的,因为它们未被确认.但是,SNMP INFORM 是 SNMP TRAP 的公认版本.因此,如果您想知道通知接收者收到消息,请使用 INFORMs.请注意,TCP 不能解决这个问题,因为它只提供消息已收到的第 3 层通知.不能保证通知接收者确实得到了它.SNMP INFORM 执行应用程序级别的确认,并且比假设 TCP 确认表明他们收到了更值得信赖.

As for sending TRAPs, yes TRAPs are unreliable because they're not acknowledged. However, SNMP INFORMs are an acknowledged version of a SNMP TRAP. Thus if you want to know that the notification receiver got the message, please use INFORMs. Note that TCP does not solve this problem as it only provides layer 3 level notification that the message was received. There is no assurance that the notification receiver actually got it. SNMP INFORMs do application level acknowledgement and are much more trustworthy than assuming a TCP ack indicates they got it.

这篇关于为什么 SNMP 通常通过 UDP 而不是 TCP/IP 运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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