互联网上最大的安全UDP数据包大小是多少?(What is the largest Safe UDP Packet Size on the Internet)

编程入门 行业动态 更新时间:2024-10-25 04:14:11
互联网上最大的安全UDP数据包大小是多少?(What is the largest Safe UDP Packet Size on the Internet)

我已经阅读了许多关于UDP数据包大小的文章,但是无法得出关于什么是正确的结论。

许多服务将最大的UDP数据包限制为512字节(如dns)

给定互联网上最小MTU为576,IPv4头的大小为20字节,UDP头为8字节。 这使548字节可用于用户数据

我能够使用大小为548的数据包,而不会发生数据包碎片? 还是有一些DNS知识的创造者,以及为什么他们将其限制在512字节。

我甚至可以安全地高于548字节吗?

I've read a number of articles about UDP packet sizes but have been unable to come to a conclusion on whats correct.

A number of services restrict the largest UDP packet to 512 bytes (like dns)

Given the minimum MTU on the internet is 576 , and the size of the IPv4 header is 20 bytes, and the UDP header 8 bytes. This leaves 548 bytes available for user data

Would I be able to use packets up to the size of 548 without packet fragmentation? Or is there something the creators of DNS knew about, and that why they restricted it to 512 bytes.

Could I even go higher than 548 bytes safely?

最满意答案

的确, 典型的 IPv4报头是20字节,UDP头是8字节。 然而,可以包括可以将IP报头的大小增加到多达60个字节的IP选项。 此外,有时中间节点需要将数据报封装在诸如IPsec (用于VPN等)之类的另一协议内,以便将数据包路由到其目的地。 因此,如果您不了解特定网络路径上的MTU ,最好为您可能没有预料到的其他头信息留下合理的余地。 通常认为512字节的UDP有效载荷可以做到这一点,尽管即使这样做并不能为最大大小的IP报头留出足够的空间。

It is true that a typical IPv4 header is 20 bytes, and the UDP header is 8 bytes. However it is possible to include IP options which can increase the size of the IP header to as much as 60 bytes. In addition, sometimes it is necessary for intermediate nodes to encapsulate datagrams inside of another protocol such as IPsec (used for VPNs and the like) in order to route the packet to its destination. So if you do not know the MTU on your particular network path, it is best to leave a reasonable margin for other header information that you may not have anticipated. A 512-byte UDP payload is generally considered to do that, although even that does not leave quite enough space for a maximum size IP header.

更多推荐

本文发布于:2023-07-27 05:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1285497.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:互联   数据包   大小   网上   UDP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!