Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the largest UDP packet I can send without fragmenting?

I need to know what the largest UDP packet I can send to another computer is without fragmentation.

This size is commonly known as the MTU (Maximum Transmission Unit). Supposedly, between 2 computers, will be many routers and modems that may have different MTUs.

I read that the TCP implementation in windows automatically finds the maximum MTU in a path.

I was also experimenting, and I found out that the maximum MTU from my computer to a server was 57712 bytes+header. Anything above that was discarded. My computer is on a LAN, isn't the MTU supposed to be around 1500 bytes?

like image 532
Unknown Avatar asked May 23 '09 02:05

Unknown


People also ask

What is the maximum value of size for which the UDP datagram can be sent without IP fragmentation?

Every internet destination must be able to receive a datagram of 576 octets either in one piece or in fragments to be reassembled. [...] Every internet module must be able to forward a datagram of 68 octets without further fragmentation.

What is the max size of a UDP packet?

A UDP datagram is carried in a single IP packet and is hence limited to a maximum payload of 65,507 bytes for IPv4 and 65,527 bytes for IPv6. The transmission of large IP packets usually requires IP fragmentation.

Does UDP have MTU?

UDP is the most common standard for VoIP but is limited in capability. The maximum MTU (Maximum Transmission Unit) size of UDP we can receive un-fragmented is 1460 bytes. Most broadband routers are set to an MTU default of 1454 bytes, so its uncommon you can transmit more than our limits.

How many UDP packets can be sent per second?

To begin, try a value within the range 50,000 to 150,000 packets per second. Select an initial value based on capacity of the receiving CPUs to handle NIC interrupts. To reduce average latency, try raising the value. If the number of packets overwhelms any receiver, try a lower value.


1 Answers

The following doesn't answer your question directly but you might find it interesting; it says that IP packets can be disassembled/reassembled, and therefore bigger than limit on the underling media (e.g. 1500-byte Ethernet): Resolve IP Fragmentation, MTU, MSS, and PMTUD Issues with GRE and IPSEC


More on this topic:

  • Re: UDP fragmentation says you should use ICMP instead of UDP to discover MTU
  • Path MTU Discovery says that a TCP connection might include implicit MTU negotiation via ICMP

I don't know about generating ICMP via an API on Windows: at one time such an API was proposed, and was controversial because people argued that would make it easy to write software that implements denial-of-service functionality by generating a flood of ICMP messages.

No, it looks like it is implemented: see for example Winsock Programmer's FAQ Examples: Ping: Raw Sockets Method.

So, to discover MTU, generate ping packets with the 'do not fragment' flag.

Maybe there's an easier API than this, I don't know; but I hope I've given you to understand the underlying protocol[s].

like image 71
ChrisW Avatar answered Sep 18 '22 02:09

ChrisW