Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    IPSec hundreds of child SAs

    Scheduled Pinned Locked Moved IPsec
    9 Posts 2 Posters 1.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      silviub
      last edited by

      Hello,

      I have an IPSec configuration but I'm facing some issues with it: there are 8 Phase 2 entries and the VPN is working fine, kind of: it seems to fail to renew the P1/P2, so it always opens a new one, without clearing the old one - or so it seems. Why am I saying this: when the tunnel is established the for the first time, I've got 8 child SA entries, all normal. After a while, that starts to grow. Currently, on a single IPSec tunnel I've got 243 "connected" SAs. Obviously, this leads to issues after a while, as the VPN gets disconnected and won't reconnect, until some of the SADs are killed. In the logs, I see a "vici message too large" type of error.

      Anyone got any clue what can I do to fix this?

      P.S. while I've got 5 IPSec tunnels, just this one shows this behaviour.

      Thank you.
      94fb35f7-7f5c-45eb-ae59-d847bd892c8a-image.png
      795b9aa0-ae42-4be5-91ce-b94c24aec6a5-image.png

      M 1 Reply Last reply Reply Quote 0
      • M
        mcury @silviub
        last edited by

        @silviub I usually set one side as Responder Only and Child SA Close Action to Close connection and clear SA.

        The other side, the side that will be making the connections, leave at default and Child SA Close Action to Restart/Reconnect. You can also enable the keep-alive feature in P2,
        So, basically, set one side to connect and keep-alive and the other side to responder only.

        dead on arrival, nowhere to be found.

        S 1 Reply Last reply Reply Quote 0
        • S
          silviub @mcury
          last edited by

          @mcury hello and thanks for replying.

          The P2 keep-alive is enabled now, it was disabled before, no change. Also, on my side, the Child SA Close connection is set to Close connection and clear SA, but it doesn't seem to do anything. It's true that I am not a responder only, I don't know if that makes a difference, but I need to be able to also initiate the connection.

          Any other ideas?

          Thank you.

          M 1 Reply Last reply Reply Quote 0
          • M
            mcury @silviub
            last edited by

            @silviub

            I think these will help you :
            https://docs.netgate.com/pfsense/en/latest/vpn/ipsec/configure-p1.html
            https://docs.netgate.com/pfsense/en/latest/vpn/ipsec/configure-p2.html

            dead on arrival, nowhere to be found.

            S 1 Reply Last reply Reply Quote 1
            • S
              silviub @mcury
              last edited by silviub

              @mcury reading that (again) actually helped. Thank you for this!

              Expiration and Replacement
              
              Take care when crafting these values. Incorrect or sub-optimal values can lead to problems such as tunnels failing to renegotiate in a timely manner or multiple duplicate security associations.
              

              That ringed a bell. I checked again and on one side, P1 had a lifetime of 1440 minutes while the other had a lifetime of 1440 seconds.... Changed that, hopefully this fixes it.

              I'll come back in a few days with another post saying if this was fixed or not, maybe it'll help someone.

              M 1 Reply Last reply Reply Quote 1
              • M
                mcury @silviub
                last edited by

                @silviub said in IPSec hundreds of child SAs:

                That ringed a bell. I checked again and on one side, P1 had a lifetime of 1440 minutes while the other had a lifetime of 1440 seconds.... Changed that, hopefully this fixes it.

                I'll come back in a few days with another post saying if this was fixed or not, maybe it'll help someone.

                Good to hear 👍

                dead on arrival, nowhere to be found.

                S 1 Reply Last reply Reply Quote 0
                • S
                  silviub @mcury
                  last edited by

                  @mcury unfortunately, that didn't fix it. Since yesterday, I have 82 child SAs - it just changed now to 81 but still way too many. Any other ideas?

                  Thank you.

                  M 1 Reply Last reply Reply Quote 0
                  • M
                    mcury @silviub
                    last edited by

                    @silviub said in IPSec hundreds of child SAs:

                    @mcury unfortunately, that didn't fix it. Since yesterday, I have 82 child SAs - it just changed now to 81 but still way too many. Any other ideas?

                    Thank you.

                    According to this doc, "If both peers initiate, reauthenticate, or rekey phase 1 at the same time, it can result in duplicate IKE SAs. If both peers rekey phase 2 at the same time, it can result in duplicate child SAs."

                    Try to change these timers at one side to see how it goes, more info in the link.

                    dead on arrival, nowhere to be found.

                    S 1 Reply Last reply Reply Quote 0
                    • S
                      silviub @mcury
                      last edited by

                      @mcury Thank you, I'll go through that page and see if anything helps.

                      I appreciate it!

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.