TCP Segment Size – Can Netcat Force a Higher TCP Segment Size

fragmentationipv4linuxtcp

I'm using netcat to send random data from A to B, both Linux machines on Ethernet networks, with a router in the middle. For pedagogic purposes I'd like to force IP fragmentation on the router (Cisco 1811, base image). I've first lowered the MTU to 500 (instead of the original 1500) on the outbound router interface, but then the router sends and ICMP fragmentation needed message and A lowers TCP segment size accordingly. I've then set a lower MTU directly on B, but then B advertises a lower Maximum Segment Size and A accepts it, leading to no fragmentation.

Can I make A ignore B's MSS in the negociation and use a 1500-tailored segment size anyway? Or do you see another way to force IP fragmentation on the router?

For practical reasons I cannot recompile the kernel or install arbitrary software on the machines, I have to work with what's there (reasonably standard set of networking tools I hope).

Best Answer

I used the following configuration:

  • Standard MTU on A and B;
  • MTU lowered to 500 on the router (B side);
  • /proc/sys/net/ipv4/ip_no_pmtu_disc set to 1 on the sender (A).

And then the sender sticks to 1500 byte segments, and the router fragments.