IPSec Speed Issues - Fortigate

Tempor

Ars Tribunus Angusticlavius
7,340
Ok, so, we've had a problem we've been slowly having to deal with more and more. We noticed 3-4 years ago (possibly sooner) that on connection speeds with throughputs over about 40-50 megabits, when pushing data across an ipsec tunnel we see no more than about 30-40 megabits. Our present setup is a hub and spoke model, with the hubs being Fortigate 1500D's presently running 5.4.8 or 5.6.6, and a 'brand new' 1000D running 5.6.6 (This hasn't entered production yet so it makes a good test bed for me) spread around the country. Our spokes are nearly all Fortigate 40C or Fortigate 60D (mostly the latter) though we're now rolling out 60E's. I've got some limited testing from a 100E as a spoke router as well. We've seen this pretty much regardless of latency and nearly regardless of how much higher than our previously mentioned threshhold (IE: whether a circuit is 50M, 500M or 1 gig, we see 30-40 megabits). Iperf has UDP running pretty much full speed, it's only TCP that's impacted. Even when I play with window sizes or thread counts we don't see much better speed (or dramatically worse).

We've got a ticket (again) with Fortigate, and are working with them, but I'm wondering if anyone here has seen this problem and tackled it, or has circuits over these speeds with tunnels running faster.

We've tried with and with NPU or ASIC offloading, we've played with MTU/MSS settings, we've run the gamut from our AES256/SHA256 DHgroup 19 standard all the way down to the dregs of DES with DHgroup 1 with no change. I've even tried playing with NATT. We see this on IKE1 and IKE2. We've tried NPU interconnects as well as standard vdom interlinks between our concentrator vdoms and the tunnel endpoint vdoms n the HUB routers.

As a comparison, a customer replaced one of our FG models with their sonicwall, and tied back to our 1500D they see noticably (though still somewhat hampered speeds, 55 megs on a 75 meg circuit). When we replace these with a velocloud unit, we get full speeds entirely across the network (I realize it's not exactly apples to apples).

I haven't verified it with my own testing, as I'm not in a position to, but another one of our engineers claims he was able to get the FG60D to do about 300+ when directly connected to another 60D and the 60E's were doing 500ish.
 

Tempor

Ars Tribunus Angusticlavius
7,340
No inspection on the traffic, at least for all our testbed cases. No CPU usage to speak of. I'll check on the pmtud pieces, a lot of times we haven't controlled hosts at both ends which has limited things, but I do in our current test case. FTNT said that their packet captures of the tunnel traffic looked fine. Our pcaps from the hosts showed a fair number of TCP dup and retransmits, but only intermittently (Like a flood of them for a couple seconds, then 10-20 seconds of clean pakcets). I'm loathe to include that as those grabs were from boxes using speedtests and not iperf so we can't totally control for the remote end.
 

dodexahedron

Ars Praefectus
3,368
Subscriptor++
Are you doing any inspection on the VPN traffic or has it been excluded from the UTM features?

Also, check for things like fragmentation issues. MSS can help with that but sometimes there are separate settings for how to deal with fragmentation on IPSec tunnels.

Does the CPU usage spike when you have a lot of traffic in the tunnel

This. TCP MSS, if set improperly on the tunnel endpoints, can result in a significantly higher amount of overhead , for TCP connections. Do the math and figure out the best size for your environment or pick simple values that are guaranteed to work regardless of additional packet headers (just understand that'll hurt efficiency).
MSS is often overlooked and can not only help with performance issues, but may be NECESSARY, if an application sets DF on a packet.
 

Frennzy

Ars Legatus Legionis
85,841
MSS is often overlooked and can not only help with performance issues, but may be NECESSARY, if an application sets DF on a packet.

Replying to "IPSec Speed Issues - Fortigate":

(nodding in agreement)

MSS clamping is oft overlooked...and depending on the originating IP stack, can be the fix to very odd behaviors.

For example, in some versions of Solaris, doing a file transfer would lock up and then timeout, at the exact same byte of the file being transfered. Very, very odd. Clamping MSS to around 1460-something on the upstream router would fix it. It wasn't for ALL transfers, just some. The suspicion at the time was somebody doing something odd on the far end, but wouldn't admit it.
 

Tempor

Ars Tribunus Angusticlavius
7,340
Not sure if I didn't mention it above, but we have pretty much gone through TCP-MSS with a fine toothed comb on this setup, as it's plagued us in the past, so is an early part of our troubleshooting for performance/wierdness issues. We even resort to speed/duplex issues since we've seen finickyness out of the 60D at least WAN1 port.

Most of our large bandwidth layer 3 circuits are Comcast, so there has been some concern they are doing some kind of traffic control that ESP doesn't like, but we have an ATT 500 megabit circuit we are going to look at with the UDP "fix". Assuming that behavior is the same as the Comcast circuit, one of three things is true. We cross Comcast's network getting back to us (I haven't checked on this one), ATT and Comcast are both doing the same thing, or the problem isn't with the ISP and is in fact something about FG's hardware/software.
 

PrincePolo

Seniorius Lurkius
1
As an update, I found a note online regarding moving the tunnel over to UDP encapsulation by forcing NAT-T on the tunnel, and at least on my test case, I'm now seeing 100-110 Mbit out of 120. I'm not sure I'm ready to call this a solution, but it's definitely promising.

Did you have to restart the tunnel for this to take effect? I'm having a similar issue with two 100Ds. (One is 1Gbps, the other 200Mbps) Only seeing 5-35Mbps using iperf3