I'm running Debian. If I use Python's scapy module to formulate a UDP packet, and add a payload bigger than about 1500 bytes, my program crashes, even though the maximum payload of UDP is supposed to be 65,507 bytes.

Is there some Linux setting that prevents me from creating a large UDP packet? Can I adjust the setting?

Edit: I'm creating packets in a loop in Python, and I'm racing against the clock. The program is a traffic generator that is meant to generate traffic at a set limit (ex: 500 packets per second). If it's set for 500 packets per second for example, it only has one second to generate 500 packets, because in the next second, it will have another 500 packets to generate, so it can't fall behind.

Right now, I'm hitting a limit of about 400 packets per second before it can't keep up. There are a few solutions to this in theory:

  1. Use multithreading - something I plan to look into
  2. Create bigger UDP packets, resulting in less overhead
    • What I'm looking into now

Yes, if I make UDP packets with a payload bigger than 1500 bytes, they will be fragmented. From what I understand, the Kernel will handle that. What I'm hoping for is that the kernel, written in C, can fragment a single, large UDP packet into multiple packets and send them out faster than my Python can generate multiple smaller packets. I'm not sure if this is true or not, but it's very easy to test, assuming I can tell the kernel to stop dropping my large UDP packets and actually fragment them and send them out.


1 Answer 1


From https://en.wikipedia.org/wiki/Maximum_transmission_unit#Applicability -- "with Ethernet, the maximum frame size is 1518 bytes, 18 bytes of which are overhead (header and FCS), resulting in an MTU of 1500 bytes."

  • 2
    Well, the MTU is a physical limit. Higher layers migh have some other logical limit. That leads to fragmentation, of course, but that is part of the protocol. In specific, your quote is for IPv4, in IPv6 the limit is 64KiB, and no, IPv6 doen't have fragmentation. Please read:stackoverflow.com/a/38723509/8017719
    – user232326
    Mar 27, 2020 at 4:25
  • @isaac That answers says "does not support fragmentation" -- is that correct? Mar 27, 2020 at 6:42
  • 1
    Well, technically, only source nodes could fragment packets, routers are forbidden to do that. That is the general idea: IPv6 doesn't allow packet fragmentation (for routers). Please read: stackoverflow.com/questions/6254973/…
    – user232326
    Mar 27, 2020 at 6:51
  • I updated my question to provide a bit more detail about what I'm doing. Hopefully that clears things up
    – John
    Mar 27, 2020 at 14:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .