Question
IPsec VPN latency issues with (not really) large packages.
Hi folks we' re experiencing a weird IPsec latency issue on a Version: Fortigate-310B v4.0,build0196,100319 (MR1 Patch 4) with policy based vpn, where we' ve run out of ideas how to further diagnose and possibly fix this issue. The problem is that " large" packages aren' t properly sent out the external Fortigate interface into the vpn tunnel. Where " large" seems to start with 484 bytes, and where this behavior is consistently reproducible e.g. with pings. Example: client 95.10.11.12 <-vpn-> 129.20.0.2 firewall <-lan-> 129.24.60.8 ( Note: ip addresses are fake ... ) External IPsec client 95.10.11.12 sends a 418 byte payload ping through the tunnel into our net $ ping -c 1 -s 418 129.24.60.8 and on firewall we' re seeing # diagnose sniffer packet any ' ( host 95.10.11.12 and esp ) or ( host 129.24.60.8 and icmp )' 4 interfaces=[any] filters=[( host 95.10.11.12 and esp ) or ( host 129.24.60.8 and icmp )] 2.304990 port2 in 95.10.11.12 -> 129.20.0.2: ip-proto-50 484 2.304990 VPN_GW_0 in 129.24.90.10 -> 129.24.60.8: icmp: echo request 2.305070 port1 out 129.24.90.10 -> 129.24.60.8: icmp: echo request 2.305393 port1 in 129.24.60.8 -> 129.24.90.10: icmp: echo reply 2.305417 VPN_GW_0 out 129.24.60.8 -> 129.24.90.10: icmp: echo reply 2.305454 port2 out 129.20.0.2 -> 95.10.11.12: ip-proto-50 484 So far so good. But with a larger packet size the ping response gets stuck in the firewall: $ ping -c 1 -s 800 129.24.60.8 21.638467 port2 in 95.10.11.12 -> 129.20.0.2: ip-proto-50 868 21.638467 VPN_GW_0 in 129.24.90.10 -> 129.24.60.8: icmp: echo request 21.638558 port1 out 129.24.90.10 -> 129.24.60.8: icmp: echo request 21.638812 port1 in 129.24.60.8 -> 129.24.90.10: icmp: echo reply 21.638827 VPN_GW_0 out 129.24.60.8 -> 129.24.90.10: icmp: echo reply The final esp response on port2 is missing. Interestingly enough, when sending another smaller ping, the missing packet is pushed out: $ ping -c 1 -s 418 129.24.60.8 54.701092 port2 in 95.10.11.12 -> 129.20.0.2: ip-proto-50 484 54.701092 VPN_GW_0 in 129.24.90.10 -> 129.24.60.8: icmp: echo request 54.701187 port1 out 129.24.90.10 -> 129.24.60.8: icmp: echo request 54.701546 port1 in 129.24.60.8 -> 129.24.90.10: icmp: echo reply 54.701561 VPN_GW_0 out 129.24.60.8 -> 129.24.90.10: icmp: echo reply 54.701606 port2 out 129.20.0.2 -> 95.10.11.12: ip-proto-50 868 54.701609 port2 out 129.20.0.2 -> 95.10.11.12: ip-proto-50 484 as you can see on the second last line. So that 800 byte payload ping response packet was stuck in the firewall about half a minute. We' ve dug a little deeper with " debug flow" , and this is what we found: 2011-02-17 14:49:17 id=36870 trace_id=417 func=resolve_ip_tuple_fast line=3276 msg=" vd-root received a packet(proto=1, 129.24.90.10:45673->129.24.60.8:8) from VPN_GW_0." 2011-02-17 14:49:17 id=36870 trace_id=417 func=resolve_ip_tuple line=3398 msg=" allocate a new session-15b612f5" 2011-02-17 14:49:17 id=36870 trace_id=417 func=vf_ip4_route_input line=1609 msg=" find a route: gw-129.24.60.8 via port1" 2011-02-17 14:49:17 id=36870 trace_id=417 func=fw_forward_handler line=440 msg=" Allowed by Policy-104:" 2011-02-17 14:49:17 id=36870 trace_id=418 func=resolve_ip_tuple_fast line=3276 msg=" vd-root received a packet(proto=1, 129.24.60.8:45673->129.24.90.10:0) from port1." 2011-02-17 14:49:17 id=36870 trace_id=418 func=resolve_ip_tuple_fast line=3312 msg=" Find an existing session, id-15b612f5, reply direction" 2011-02-17 14:49:17 id=36870 trace_id=418 func=vf_ip4_route_input line=1609 msg=" find a route: gw-129.24.90.10 via VPN_GW_0" 2011-02-17 14:49:17 id=36870 trace_id=418 func=ipsecdev_hard_start_xmit line=122 msg=" enter IPsec interface-VPN_GW_0" 2011-02-17 14:49:17 id=36870 trace_id=418 func=esp_output4 line=467 msg=" encrypted, and send to 95.10.11.12 with source 129.20.0.2" # here the delay is happening (in this case 7 seconds) 2011-02-17 14:49:24 id=36870 trace_id=418 func=ipsec_output_finish line=138 msg=" send to 129.20.0.1 via intf-port2" This is from a trace where we had a 7 second delay. And it' s apparently happening right in " ipsec_output_finish" . Now, this can' t be MTU, which is 1500. Also, we' re seeing no " frag needed" response from whichever party. The route 129.20.0.1 is static and properly working for all other traffic. So, maybe somebody has some advice how to further proceed from here? It' d sure be appreciated, because right now we' re at a loss ... Thanks a bunch, G.
