Skip to content

When "clear DF" stops working: GRE and IPsec tunnel MTU, the DF bit and MSS clamping explained

On 24 Nov 2026 Cloudflare's managed clear-DF setting for Magic Transit was not taking effect, so large DF packets could be dropped. How tunnel MTU and DF work, and how to set an MSS clamp on Linux and RouterOS.

By Nishant Gauraw, NG-NeXTPublished Updated 8 min read

On 24 November 2026 at 11:29 UTC, Cloudflare opened an incident titled Magic Transit Degraded Performance. A subset of Magic Transit customers have a Cloudflare-managed setting that clears the Don't Fragment (DF) flag on their traffic. For those customers, the setting was not taking effect. In Cloudflare's words: "packets with the DF flag set and larger than the tunnel MTU may be dropped." The advice was one line: "set an MSS clamp on their egress traffic in order to ensure ingress traffic is correctly sized." The issue was marked identified at 12:58 UTC and resolved at 08:16 UTC on 25 November.

That one line of advice hides most of what goes wrong with tunnels. This post explains it, using Cloudflare's own MTU and MSS reference, and shows how to set the clamp on Linux and MikroTik RouterOS. The same mechanics apply, with details that vary by protocol and mode, to the GRE and IPsec tunnels you run between your own sites. Unless a figure is explicitly labelled IPv6, the numbers below are IPv4. IPv6 headers are larger, and IPv6 routers never fragment in transit.

Three numbers: MTU, MSS and tunnel overhead#

  • MTU is the largest IP packet a link accepts, headers included. 1,500 bytes is the usual Ethernet and internet value, and it is the number Cloudflare's reference works from; some paths are smaller.
  • MSS is the largest TCP payload in one segment. For IPv4 it is MTU minus 20 bytes of IP header and 20 bytes of TCP header: 1,460 on a 1,500-byte link.
  • Tunnel overhead. GRE over IPv4 adds 24 bytes (a 20-byte outer IP header and a 4-byte GRE header), so a GRE tunnel over a 1,500-byte path carries at most 1,476-byte inner packets. RouterOS shows the same number: with mtu=auto, a GRE interface on a 1,500-byte link reports an actual-mtu of 1,476 (RouterOS GRE reference). IPsec adds more and the exact amount depends on the cipher and mode.

A 1,500-byte packet cannot fit in a 1,476-byte tunnel. Something has to give: fragment it, drop it, or make sure it is never that big.

What does the DF bit decide?#

If DF is set, a router must drop an oversized packet rather than fragment it, and is expected to send back an ICMP "fragmentation needed" message so the sender can lower its packet size (path MTU discovery). Most TCP stacks set DF. When those ICMP messages are filtered somewhere on the path, classic path MTU discovery cannot learn the smaller size, and large packets disappear while small ones work (some TCP stacks can eventually recover with black-hole detection or packetization-layer probing, slowly). That is the classic symptom: the TCP handshake and small requests succeed, then the connection hangs on the first full-size packet.

Cloudflare's reference describes the options for Magic Transit:

  • By default (without clear-DF), the reference says Cloudflare fragments packets larger than 1,476 bytes to fit the tunnel MTU before sending them to the customer, and never forwards incomplete packets. Read together with the incident notice, DF-set packets are the exception: those are the ones that were at risk of being dropped when clear-DF was not applied.
  • Clear DF is the optional setting at the centre of this incident. With it on, Cloudflare clears the DF bit and fragments packets larger than 1,500 bytes; the customer's equipment reassembles them after decapsulation. Cloudflare calls this a "last resort option" for customers who cannot set an MSS clamp.

While the clear-DF setting was not applied, DF-set packets larger than the tunnel MTU could be dropped. Customers who already had a correctly sized MSS clamp should have been largely shielded for TCP in the direction toward the endpoint whose advertised MSS was reduced, because those connections never send segments that large. That is an inference from how MSS works, not something the incident notice states, and it does nothing for UDP, or for the opposite direction if that advertisement was never clamped.

Why does the MSS clamp go on egress?#

This is the part people get backwards. MSS is announced in the TCP SYN and SYN-ACK packets, and each side uses the other side's announced MSS to size what it sends. So a clamp changes the size of packets flowing in the opposite direction to the one where you apply it. Cloudflare's reference says it in one line: "MSS clamping affects TCP packet payload sizes flowing in the opposite direction versus where the clamp is applied."

With Magic Transit, traffic from the internet often enters through the GRE or IPsec tunnel, while return traffic leaves directly to the internet (direct server return). To make inbound packets fit the tunnel, you clamp the MSS on the SYN-ACKs your servers send out on the egress path.

Cloudflare's recommended maximums (MSS clamping recommendations):

SetupWhereClamp to
GRE, ingress only (DSR)Edge router transit ports1,436 bytes max
GRE, ingress and egressMagic Transit GRE tunnel internal interface1,436 bytes max
IPsec, ingress only (DSR)Edge router transit ports1,436 bytes max
IPsec, ingress and egressMagic Transit IPsec tunnel internal interface1,360 bytes max

For your own third-party GRE or IPsec tunnels that run inside a Magic Transit prefix, Cloudflare says to lower the clamp on that inner tunnel interface by a further 24 bytes when the Magic Transit tunnel is GRE, or 140 bytes when it is IPsec.

1,436 is simply 1,476 minus 40 bytes of IPv4 and TCP headers.

Two traps#

"Clamp to PMTU" can give the wrong answer on asymmetric paths. Linux's --clamp-mss-to-pmtu and nftables' rt mtu derive the MSS from the router's own route MTUs; per the iptables-extensions manual, the kernel uses "the path MTU which it would use to send packets from itself to the source and destination IP addresses," and it warns this "may not function as desired where asymmetric routes with differing path MTU exist." In a direct-server-return design, the router typically reaches both the server and the internet over ordinary 1,500-byte links, because the tunnel is on Cloudflare's side of the inbound path. In that case a PMTU-based clamp produces 1,460 and does nothing useful. Use a fixed value.

MSS clamping only affects TCP. UDP, including QUIC, is untouched. QUIC forbids IP fragmentation of its datagrams and says the DF bit "MUST be set if possible" on IPv4 (RFC 9000, section 14); QUIC endpoints handle path MTU themselves. Cloudflare's reference also notes that for a tunnel inside a tunnel, the outer packets are IP, not TCP, so the clamp must go on the inner tunnel interface and that tunnel's MTU must be lowered.

Setting the clamp on Linux#

With nftables, the nftables wiki shows a fixed-value clamp. Restrict it to IPv4, to the egress interface and to SYNs that announce more than you want, so a smaller MSS is never raised:

nft add rule ip filter forward oifname "eth0" tcp flags syn tcp option maxseg size 1437-65535 tcp option maxseg size set 1436

If IPv6 also crosses the tunnel, add a separate rule in an ip6 table with 1,416 (1,476 minus 60 bytes of IPv6 and TCP headers) and a match of 1417-65535. Do not apply the IPv4 value to IPv6 traffic, for example by putting it unguarded in an inet table, which matches both families.

The wiki notes that MSS is announced separately in each direction, so a clamp only rewrites the advertisements the rule actually sees; tcp flags syn matches both SYN and SYN-ACK. On a router where your servers answer inbound connections, the SYN-ACKs are what leave on the egress interface. Replace ip filter forward and eth0 with your own table, chain and egress interface, and check rule order: nft add rule appends, so an earlier accept in the same chain would skip it. A forward chain covers routed traffic only, not connections the Linux host itself terminates.

With iptables, the equivalent uses --set-mss, which per the man page will not raise an MSS that is already lower:

iptables -t mangle -A FORWARD -o eth0 -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1436

Setting the clamp on MikroTik RouterOS#

RouterOS's mangle documentation shows the pattern. Adapted to 1,436 on an egress interface:

/ip firewall mangle add chain=forward out-interface=ether1 protocol=tcp tcp-flags=syn action=change-mss new-mss=1436 tcp-mss=1437-65535 passthrough=yes

The tcp-mss=1437-65535 match leaves SYNs that already announce a smaller MSS alone.

RouterOS GRE interfaces also have a clamp-tcp-mss property. Per the GRE reference, when enabled the router lowers the MSS of TCP SYN packets received through the tunnel if it exceeds what the tunnel MTU allows after TCP/IP overhead, and it does so after decapsulation. That only rewrites SYNs arriving through the tunnel, which limits the segments sent back; it does not rewrite SYNs or SYN-ACKs sent into the tunnel. For a direct-server-return egress path that does not use the tunnel, you still need an egress clamp such as the mangle rule above (or hosts configured with a lower MSS).

How do you test the clamp?#

Check the path with DF set. On Linux, a 1,476-byte IPv4 packet is a 1,448-byte ICMP payload plus 28 bytes of headers:

ping -4 -M do -s 1448 <host behind the tunnel>
ping -4 -M do -s 1472 <host behind the tunnel>

If the path's IPv4 MTU is 1,476 bytes (a 1,476-byte tunnel and no smaller hop), nothing clears DF on the way, and ICMP is allowed back, the first should pass and the second should fail. Use ping -4 or an IPv4 literal so the 28-byte header arithmetic holds. This tests the path MTU, not the clamp. On RouterOS, /ping takes size as the whole IP packet and has a do-not-fragment switch (ping reference):

/ping <host> size=1476 do-not-fragment

Then confirm the clamp itself by capturing SYN and SYN-ACK packets on the egress interface and reading the mss value in the TCP options:

tcpdump -ni eth0 'tcp[tcpflags] & tcp-syn != 0'

The broader lesson#

A provider-managed setting that papers over an MTU problem is a dependency. The incident window ran from 11:29 UTC on 24 November to 08:16 UTC on 25 November, a little under 21 hours. A clamp on your own router does not depend on anyone else's setting. Whether you run Magic Transit, site-to-site GRE between your own racks, or IPsec to a branch office, set the clamp where you control it, test with DF set, and write the numbers down.

The know-how stays free. If you are designing tunnels, BGP edges or a move off public cloud and want it planned or built, NG-NeXT does consulting and turnkey builds. Reach us through the contact page.

— Nishant Gauraw, Founder and CEO, NG-NeXT Tech

Talk to us directly.

We reply within one business day. The site assistant answers at any hour.