The community is a place to collaborate, share insights and experiences, and get answers to questions.<\/p>\r\n

Search here or look around to get started.<\/p>", "imageupload.max_uploaded_images_per_upload" : 100, "imageupload.max_uploaded_images_per_user" : 1000, "integratedprofile.connect_mode" : "", "tkb.toc_maximum_heading_level" : "", "tkb.toc_heading_list_style" : "disc", "sharedprofile.show_hovercard_score" : true, "config.search_before_post_scope" : "community", "tkb.toc_heading_indent" : "", "p13n.cta.recommendations_feed_dismissal_timestamp" : -1, "imageupload.max_file_size" : 7200, "layout.show_batch_checkboxes" : false, "integratedprofile.cta_connect_slim_dismissal_timestamp" : -1 }, "isAnonymous" : true, "policies" : { "image-upload.process-and-remove-exif-metadata" : false }, "registered" : false, "emailRef" : "", "id" : -1, "login" : "Anonymous" }, "Server" : { "communityPrefix" : "/tpykb84852", "nodeChangeTimeStamp" : 1732295181917, "tapestryPrefix" : "/t5", "deviceMode" : "DESKTOP", "responsiveDeviceMode" : "DESKTOP", "membershipChangeTimeStamp" : "0", "version" : "24.8", "branch" : "24.8-release", "showTextKeys" : false }, "Config" : { "phase" : "prod", "integratedprofile.cta.reprompt.delay" : 30, "profileplus.tracking" : { "profileplus.tracking.enable" : false, "profileplus.tracking.click.enable" : false, "profileplus.tracking.impression.enable" : false }, "app.revision" : "2410251442-s96644fcabc-b95", "navigation.manager.community.structure.limit" : "1000" }, "Activity" : { "Results" : [ ] }, "NodeContainer" : { "viewHref" : "https://community.fortinet.com/t5/Knowledge-Base/ct-p/knowledgebase", "description" : "The Knowledge Base is a central hub for articles and technical tips on all Fortinet products.", "id" : "knowledgebase", "shortTitle" : "Knowledge Base", "title" : "Knowledge Base", "nodeType" : "category" }, "Page" : { "skins" : [ "fortinet", "theme_hermes", "responsive_peak" ], "authUrls" : { "loginUrl" : "/tpykb84852/auth/saml/doauth/post?referer=https%3A%2F%2Fcommunity.fortinet.com%2Ft5%2FFortiGate%2FTroubleshooting-Tip-IPsec-VPNs-tunnels%2Fta-p%2F195955", "loginUrlNotRegistered" : "/tpykb84852/auth/saml/doauth/post?redirectreason=notregistered&referer=https%3A%2F%2Fcommunity.fortinet.com%2Ft5%2FFortiGate%2FTroubleshooting-Tip-IPsec-VPNs-tunnels%2Fta-p%2F195955", "loginUrlNotRegisteredDestTpl" : "/tpykb84852/auth/saml/doauth/post?redirectreason=notregistered&referer=%7B%7BdestUrl%7D%7D" }, "name" : "TkbArticlePage", "rtl" : false, "object" : { "viewHref" : "/t5/FortiGate/Troubleshooting-Tip-IPsec-VPNs-tunnels/ta-p/195955", "subject" : "Troubleshooting Tip: IPsec VPNs tunnels", "id" : 195955, "page" : "TkbArticlePage", "type" : "Thread" } }, "WebTracking" : { "Activities" : { }, "path" : "Community:Fortinet Community/Category:Knowledge Base/Board:FortiGate/Message:Troubleshooting Tip: IPsec VPNs tunnels" }, "Feedback" : { "targeted" : { } }, "Seo" : { "markerEscaping" : { "pathElement" : { "prefix" : "@", "match" : "^[0-9][0-9]$" }, "enabled" : false } }, "TopLevelNode" : { "viewHref" : "https://community.fortinet.com/", "description" : "

The community is a place to collaborate, share insights and experiences, and get answers to questions.<\/p>", "id" : "tpykb84852", "shortTitle" : "Fortinet Community", "title" : "Fortinet Community", "nodeType" : "Community" }, "Community" : { "viewHref" : "https://community.fortinet.com/", "integratedprofile.lang_code" : "en", "integratedprofile.country_code" : "US", "id" : "tpykb84852", "shortTitle" : "Fortinet Community", "title" : "Fortinet Community" }, "CoreNode" : { "conversationStyle" : "tkb", "viewHref" : "https://community.fortinet.com/t5/FortiGate/tkb-p/TKB20", "settings" : { }, "description" : "FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.", "id" : "TKB20", "shortTitle" : "FortiGate", "title" : "FortiGate", "nodeType" : "Board", "ancestors" : [ { "viewHref" : "https://community.fortinet.com/t5/Knowledge-Base/ct-p/knowledgebase", "description" : "The Knowledge Base is a central hub for articles and technical tips on all Fortinet products.", "id" : "knowledgebase", "shortTitle" : "Knowledge Base", "title" : "Knowledge Base", "nodeType" : "category" }, { "viewHref" : "https://community.fortinet.com/", "description" : "

The community is a place to collaborate, share insights and experiences, and get answers to questions.<\/p>", "id" : "tpykb84852", "shortTitle" : "Fortinet Community", "title" : "Fortinet Community", "nodeType" : "Community" } ] } }; LITHIUM.Components.RENDER_URL = "/t5/util/componentrenderpage/component-id/#{component-id}?render_behavior=raw"; LITHIUM.Components.ORIGINAL_PAGE_NAME = 'tkb/v2_4/ArticlePage'; LITHIUM.Components.ORIGINAL_PAGE_ID = 'TkbArticlePage'; LITHIUM.Components.ORIGINAL_PAGE_CONTEXT = 'PF6NBHziUgWswgoHULIUfb-dGTz2qrOn4NeYd5DdMyfxCgO-kNXlXVCn5fdRtS5shvNpuWt5rW411uHuwPHzw_lxNXdfuebI6HzzgqXfCzPf-dYIh8OSQiaXnsB1b8cxEbIqILC8gTWvF-EnocCfTuxnDN778CZA2s1i9QGkr1piVtShwlu0Xw3vRhiF7uh_AQEBBu-4ayw0i-6o7sQpK4e1oBilRLiWy_vAx47D0IFe5gWsEeKDOUN5MYg2RPVi7qgCzn_ZVNgURi0dI1FkmmPgjcmBoAwhfegalOF94i8dca97rO18WFHgMSk-dVkOVTMif2nKfEoKBD-gsuxagjcotKnoeyyGyNhYIe_71VQ.'; LITHIUM.Css = { "BASE_DEFERRED_IMAGE" : "lia-deferred-image", "BASE_BUTTON" : "lia-button", "BASE_SPOILER_CONTAINER" : "lia-spoiler-container", "BASE_TABS_INACTIVE" : "lia-tabs-inactive", "BASE_TABS_ACTIVE" : "lia-tabs-active", "BASE_AJAX_REMOVE_HIGHLIGHT" : "lia-ajax-remove-highlight", "BASE_FEEDBACK_SCROLL_TO" : "lia-feedback-scroll-to", "BASE_FORM_FIELD_VALIDATING" : "lia-form-field-validating", "BASE_FORM_ERROR_TEXT" : "lia-form-error-text", "BASE_FEEDBACK_INLINE_ALERT" : "lia-panel-feedback-inline-alert", "BASE_BUTTON_OVERLAY" : "lia-button-overlay", "BASE_TABS_STANDARD" : "lia-tabs-standard", "BASE_AJAX_INDETERMINATE_LOADER_BAR" : "lia-ajax-indeterminate-loader-bar", "BASE_AJAX_SUCCESS_HIGHLIGHT" : "lia-ajax-success-highlight", "BASE_CONTENT" : "lia-content", "BASE_JS_HIDDEN" : "lia-js-hidden", "BASE_AJAX_LOADER_CONTENT_OVERLAY" : "lia-ajax-loader-content-overlay", "BASE_FORM_FIELD_SUCCESS" : "lia-form-field-success", "BASE_FORM_WARNING_TEXT" : "lia-form-warning-text", "BASE_FORM_FIELDSET_CONTENT_WRAPPER" : "lia-form-fieldset-content-wrapper", "BASE_AJAX_LOADER_OVERLAY_TYPE" : "lia-ajax-overlay-loader", "BASE_FORM_FIELD_ERROR" : "lia-form-field-error", "BASE_SPOILER_CONTENT" : "lia-spoiler-content", "BASE_FORM_SUBMITTING" : "lia-form-submitting", "BASE_EFFECT_HIGHLIGHT_START" : "lia-effect-highlight-start", "BASE_FORM_FIELD_ERROR_NO_FOCUS" : "lia-form-field-error-no-focus", "BASE_EFFECT_HIGHLIGHT_END" : "lia-effect-highlight-end", "BASE_SPOILER_LINK" : "lia-spoiler-link", "FACEBOOK_LOGOUT" : "lia-component-users-action-logout", "BASE_DISABLED" : "lia-link-disabled", "FACEBOOK_SWITCH_USER" : "lia-component-admin-action-switch-user", "BASE_FORM_FIELD_WARNING" : "lia-form-field-warning", "BASE_AJAX_LOADER_FEEDBACK" : "lia-ajax-loader-feedback", "BASE_AJAX_LOADER_OVERLAY" : "lia-ajax-loader-overlay", "BASE_LAZY_LOAD" : "lia-lazy-load" }; LITHIUM.noConflict = true; LITHIUM.useCheckOnline = false; LITHIUM.RenderedScripts = [ "MessageBodyDisplay.js", "LiModernizr.js", "jquery.tmpl-1.1.1.js", "CustomEvent.js", "Auth.js", "jquery.scrollTo.js", "json2.js", "jquery.ajax-cache-response-1.0.js", "Events.js", "jquery.delayToggle-1.0.js", "EarlyEventCapture.js", "Forms.js", "jquery.css-data-1.0.js", "AjaxFeedback.js", "Text.js", "NoConflict.js", "DataHandler.js", "DropDownMenuVisibilityHandler.js", "jquery.effects.slide.js", "Lithium.js", "ElementQueries.js", "jquery.iframe-shim-1.0.js", "Dialog.js", "jquery.json-2.6.0.js", "Sandbox.js", "jquery.ui.dialog.js", "ForceLithiumJQuery.js", "jquery.ui.draggable.js", "Components.js", "InformationBox.js", "ElementMethods.js", "jquery.appear-1.1.1.js", "jquery.js", "jquery.ui.mouse.js", "jquery.ui.widget.js", "Namespace.js", "Cache.js", "PartialRenderProxy.js", "jquery.function-utils-1.0.js", "jquery.iframe-transport.js", "prism.js", "jquery.ui.resizable.js", "PolyfillsAll.js", "Globals.js", "jquery.ui.core.js", "jquery.effects.core.js", "AjaxSupport.js", "jquery.blockui.js", "jquery.position-toggle-1.0.js", "ActiveCast3.js", "DropDownMenu.js", "Loader.js", "Throttle.js", "jquery.ui.position.js", "jquery.viewport-1.0.js", "ResizeSensor.js", "jquery.clone-position-1.0.js", "Video.js", "jquery.lithium-selector-extensions.js", "SpoilerToggle.js", "jquery.fileupload.js", "DeferredImages.js", "jquery.hoverIntent-r6.js" ];(function(){LITHIUM.AngularSupport=function(){function g(a,c){a=a||{};for(var b in c)"[object object]"===Object.prototype.toString.call(c[b])?a[b]=g(a[b],c[b]):a[b]=c[b];return a}var d,f,b={coreModule:"li.community",coreModuleDeps:[],noConflict:!0,bootstrapElementSelector:".lia-page .min-width .lia-content",bootstrapApp:!0,debugEnabled:!1,useCsp:!0,useNg2:!1},k=function(){var a;return function(b){a||(a=document.createElement("a"));a.href=b;return a.href}}();LITHIUM.Angular={};return{preventGlobals:LITHIUM.Globals.preventGlobals, restoreGlobals:LITHIUM.Globals.restoreGlobals,init:function(){var a=[],c=document.querySelector(b.bootstrapElementSelector);a.push(b.coreModule);b.customerModules&&0

FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
sgiannogloudis
Article Id 195955

Description


This article describes techniques on how to identify, debug and troubleshoot issues with IPsec VPN tunnels.

 

Scope


FortiGate.


Solution

 

  1. Identification.

As the first action, check the reachability of the destination according to the routing table with the following command:

 

get router info routing-table detail <destination-IP>

 

If the destination is reachable by multiple tunnels, isolate the problematic tunnel:

 

Enter the VDOM (if applicable) where the VPN is configured and type the command:

 

get vpn ipsec tunnel summary
'to10.174.0.182' 10.174.0.182:0  selectors(total,up): 1/1  rx(pkt,err): 1921/0  tx(pkt,err): 69/2
'to10.189.0.182' 10.189.0.182:0  selectors(total,up): 1/0  rx(pkt,err): 0/0  tx(pkt,err): 0/0

 

On the particular output, two VPN tunnels, to10.174.0.182 & to10.189.0.182 are visible. The second VPN tunnel on the list has its selectors in a down state so the focus will be on that tunnel.

  1. Phase 1 checks. After the problematic tunnel has been identified, it will be possible to understand the status of Phase 1. To do so, type the  below command:

 

diagnose vpn ike gateway list name to10.189.0.182

vd: root/0
name: to10.189.0.182
version: 1
interface: port9 10
addr: 10.189.0.31:500 -> 10.189.0.182:500
created: 15s ago
IKE SA: created 1/1
IPsec SA: created 0/0

  id/spi: 19576 a83334b3c66f871b/0000000000000000
  direction: responder
  status: connecting, state 3, started 15s ago

 

The important field from this particular command is status. The status field has a discrete output that can be connected or established.

 

  1. Established means Phase 1 is up and running.
  2. Connecting means Phase 1 is down.

 

If Phase 1 is down, additional checks must be performed to identify the reason.

 

  • Ensure bidirectional connectivity between the VPN gateways (typically, this is the IP address on the WAN interface).

Try to traceroute (or ping) towards the VPN peer, in this example, use the commands:

 

execute traceroute-options source 10.189.0.31

execute traceroute 10.189.0.182

 

  • Confirm that IKE traffic for port 500 or 4500 is not blocked somewhere along the path.

To do so, perform a packet sniffer:

 

diag sniffer packet any "host 10.189.0.182 and (port 500 or port 4500)" 4 0 l
interfaces=[any]
filters=[host 10.189.0.182 and (port 500 or port 4500)]

 

Note:

If nattraversal is enabled under phase1 and FortiGate is behind the NAT, sniff traffic with 'udp port 4500'. Otherwise, sniff traffic with the filter 'udp port 500'

 

IKE debugging: If both of the above checks are successful, start debugging the IKE protocol to check for possible configuration mismatches between the peers:

 

diagnose vpn ike log-filter dst-addr4 10.189.0.182 
diagnose debug application ike -1
diagnose debug console timestamp enable

diagnose debug enable

 

Note:

Using both commands will also work as intended, as shown below:

 

ipsec10.JPG

 

Note:

Starting from v7.4.1, the 'diagnose vpn ike log-filter dst-addr4' command has been changed to 'diagnose vpn ike log filter rem-addr4'

 

   diagnose vpn ike log filter rem-addr4 10.189.0.182 
   diagnose debug application ike -1

   diagnose debug console timestamp enable

   diagnose debug enable
     

Phase 2 checks: If the status of Phase 1 is in an established state, then focus on Phase 2. To do so, issue the command:

 

diagnose vpn tunnel list name <phase1-name>

 

diagnose vpn tunnel list name to10.189.0.182
list all ipsec tunnel in vd 0
name=to10.189.0.182 ver=1 serial=2 10.189.0.31:0->10.189.0.182:0
bound_if=10 lgwy=static/1 tun=intf/0 mode=auto/1 encap=none/8 options[0008]=npu
proxyid_num=1 child_num=0 refcnt=10 ilast=25 olast=25 ad=/0
stat: rxp=0 txp=0 rxb=0 txb=0
dpd: mode=on-demand on=0 idle=20000ms retry=3 count=0 seqno=534
natt: mode=none draft=0 interval=0 remote_port=0
proxyid=to10.189.0.182 proto=0 sa=0 ref=1 serial=4
src: 0:172.16.170.0/255.255.255.0:0
dst: 0:192.168.50.0/255.255.255.0:0

 

The important field from the particular output is the ‘sa’. SA can have three values:

  1. sa=0 indicates there is a mismatch between selectors or no traffic is being initiated.
  2. sa=1 indicates IPsec SA is matching and there is traffic between the selectors.
  3. sa=2 is only visible during IPsec SA rekey.

Lastly, there might be cases where the encryption and hashing algorithms in Phase 2 are mismatched as well.

The selectors are shown under the command 'get vpn ipsec tunnel details'.

In order to identify this kind of error, run IKE debugging as it was described above.

Note: If it is necessary to also perform packet captures, it is advised to always run the following command to match debug message time with packet sniffer time and know exactly what is happening and when:

diag debug console time en

 

Note:

Starting from FortiOS v7.4.1, the 'diagnose vpn ike log-filter src-addr4' command has been changed to 'diagnose vpn ike log filter loc-addr4'.

 

IPsec troubleshooting scenario:

A troubleshooting scenario where the following debugs were done but no relevance was seen for the tunnel seen as 'inactive':

 

vpn_inactive_3.png

 

In the GUI, the tunnel interface is 'green'.

 

tunnel_inactive_4.png

 

  • The tunnel is inactive and the sniffer shows the traffic not passing the tunnel:

 

FortiGate-61F # diagnose sniffer packet any 'host 10.1.1.37 and icmp' 4 0 l

interfaces=[any]

filters=[host 10.1.1.37 and icmp]

2024-07-16 10:46:01.327162 internal in 192.168.1.251 -> 10.1.1.37: icmp: echo request

2024-07-16 10:46:02.331446 internal in 192.168.1.251 -> 10.1.1.37: icmp: echo request

2024-07-16 10:46:03.335546 internal in 192.168.1.251 -> 10.1.1.37: icmp: echo request

 
  • Debug flow does not show any drops and ends up in the last line and then repeats:

 

2024-07-16 10:47:54 id=20085 trace_id=4 func=iprope_dnat_check line=5191 msg="in-[internal], out-[]"

2024-07-16 10:47:54 id=20085 trace_id=4 func=iprope_dnat_check line=5204 msg="result: skb_flags-02000000, vid-0, ret-no-match, act-accept, flag-00000000"

2024-07-16 10:47:54 id=20085 trace_id=4 func=vf_ip_route_input_common line=2615 msg="find a route: flag=00000000 gw-10.1.1.37 via root"

2024-07-16 10:47:59 id=20085 trace_id=5 func=print_pkt_detail line=5746 msg="vd-root:0 received a packet(proto=1, 192.168.1.251:1->10.1.1.37:2048) from internal. type

=8, code=0, id=1, seq=288."

 

 

  • The Encryption is negotiated:

 

diagnose vpn tunnel list name Primary Tunnel

 

name=Primary Tunnel ver=1 serial=2 10.101.1.1:0->10.101.1.2:0 tun_id=10.101.1.2 dst_mtu=1500 dpd-link=on remote_location=0.0.0.0 weight=1

bound_if=5 lgwy=static/1 tun=intf/0 mode=auto/1 encap=none/520 options[0208]=npu frag-rfc  run_state=0 accept_traffic=1 overlay_id=0

proxyid_num=1 child_num=0 refcnt=4 ilast=0 olast=0 ad=/0

stat: rxp=11746 txp=32 rxb=1939048 txb=9861

dpd: mode=on-demand on=1 idle=10000ms retry=3 count=0 seqno=0

natt: mode=none draft=0 interval=0 remote_port=0

proxyid=Net-10.1.1.0-24 proto=0 sa=1 ref=2 serial=5

  src: 0:192.168.1.0/255.255.255.0:0

  dst: 0:10.1.1.0/255.255.255.0:0

  SA:  ref=4 options=10226 type=00 soft=0 mtu=1438 expire=42832/0B replaywin=2048

       seqno=1 esn=0 replaywin_lastseq=000001db itn=0 qat=0 hash_search_len=1

  life: type=01 bytes=0/0 timeout=42933/43200

  dec: spi=e6bb099b esp=aes key=16 4c3dd75b85f0be4c2d2b95e5dfe7e99d

       ah=sha1 key=20 f9a5dbc8360e4b58aff64e74fe40137cd89dc98e

  enc: spi=533e1c0c esp=aes key=16 4fddb780c9606c5c235737bd7d05c585

       ah=sha1 key=20 57cc8349171a97eaf230e565bb90853cefaca7ab

  dec:pkts/bytes=476/75272, enc:pkts/bytes=0

 

  • It is also necessary to check the Link monitor settings for a health check:

 

vpn_active_5.png

 

In the above screenshot, the tunnel interface (Primary Tunnel) shows the status dead as the peer is not reachable.

After disabling the settings in the link monitor,  the tunnel interface is active.

 

Note:

Ensure that NPU offloading is disabled during troubleshooting. The npu-offload option is enabled by default. If NPU offloading is active, packets may be switched via the NPU, which could prevent capturing hits for flow filters. Ensure that disabling the npu-offload option would also reset the IPsec tunnel. Verify whether the npu-offload option is enabled/disabled using the following command:

 

config vpn ipsec phase1-interface

edit <name of the tunnel>

show full | grep npu

 

Related articles: