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

    WG 0.1.5 / pfS+ 21.05.1 - 2 WAN→1 WAN failover, not "failing back"

    Scheduled Pinned Locked Moved WireGuard
    16 Posts 3 Posters 3.1k 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.
    • T
      trumee @luckman212
      last edited by

      @luckman212 I am still on pfsense 2.6.0. Thanks for reminding me about wgfix. I did a cold boot and issued /root/wgfix.sh WAN3_PPPOE 0 and WG used the WAN i wanted.

      Here is a what the log shows,

      #cat /var/log/system.log | grep wgfix
      Jul  2 02:00:55 pfSense wgfix[4608]: /root/wgfix.sh called, args: WAN3_PPPOE 0
      Jul  2 02:00:55 pfSense wgfix[4994]: acquiring lockfile
      Jul  2 02:00:55 pfSense wgfix[5279]: WAN UP: WAN3_PPPOE
      Jul  2 02:00:55 pfSense wgfix[5819]: WG endpoint could not be determined
      Jul  2 02:00:55 pfSense wgfix[6140]: done, removing lockfile
      Jul  2 02:22:20 pfSense wgfix[44381]: /root/wgfix.sh called, args: WAN3_PPPOE 0
      Jul  2 02:22:20 pfSense wgfix[44775]: acquiring lockfile
      Jul  2 02:22:20 pfSense wgfix[44813]: WAN UP: WAN3_PPPOE
      Jul  2 02:22:20 pfSense wgfix[44974]: WG endpoint: redacted:51823
      Jul  2 02:22:20 pfSense wgfix[44980]: pausing 20s to allow gateway change to occur
      Jul  2 02:22:40 pfSense wgfix[47710]: Default gateway iface: pppoe2
      Jul  2 02:22:40 pfSense wgfix[48920]: found        1 bad states; bouncing wg service
      Jul  2 02:22:47 pfSense wgfix[75223]: killing state 615abf6200000002/801cbc2f
      Jul  2 02:22:57 pfSense wgfix[69630]: done, removing lockfile
      

      Notice after a cold reboot the message is WG endpoint could not be determined, however once i issue the command manually the WAN is changed to WAN3_PPPOE.

      luckman212L 1 Reply Last reply Reply Quote 0
      • luckman212L
        luckman212 LAYER 8 @trumee
        last edited by

        @trumee Ok, I don't have any PPPoE systems to test with, so I'm guessing this is related to that.

        Immediately after a fresh boot, what is the output of wg showconf tun_wg0 (or whatever your wg tunnel interface is from the WG_IFNAME= line in the script)

        T 1 Reply Last reply Reply Quote 0
        • T
          trumee @luckman212
          last edited by

          @luckman212 said in WG 0.1.5 / pfS+ 21.05.1 - 2 WAN→1 WAN failover, not "failing back":

          wg showconf tun_wg0

          It is as follows,

          #root: wg showconf tun_wg0
          [Interface]
          ListenPort = 51820
          PrivateKey = mykeyredacted
          
          [Peer]
          PublicKey = mykeyredacted
          AllowedIPs = 0.0.0.0/0
          Endpoint = remotepublicip:51823
          PersistentKeepalive = 25
          
          luckman212L 1 Reply Last reply Reply Quote 0
          • luckman212L
            luckman212 LAYER 8 @trumee
            last edited by

            @trumee That looks fine. I read some of the older comments and I saw that you had to use devd to trigger on the WANUP event for PPPoE. Is that custom config still in effect?

            T 1 Reply Last reply Reply Quote 0
            • T
              trumee @luckman212
              last edited by

              @luckman212 Yes, the devd trigger is still in place. I am on pfsense+ (22.05) now.

              luckman212L 1 Reply Last reply Reply Quote 0
              • luckman212L
                luckman212 LAYER 8 @trumee
                last edited by

                @trumee I'm guessing that this is a timing issue; maybe the PPPoE connection comes up too quickly and the lockfile from the previous run is still in place, etc. Can you try this modified version (removes the mutex check) and see if it behaves differently?

                gist: wgfix.sh (no locks)

                T 1 Reply Last reply Reply Quote 0
                • T
                  trumee @luckman212
                  last edited by

                  @luckman212 Unfortunately, i am seeing a bigger issue right now for this WAN. I will back to this once that is resolved.

                  luckman212L 1 Reply Last reply Reply Quote 0
                  • T trumee referenced this topic on
                  • luckman212L
                    luckman212 LAYER 8 @trumee
                    last edited by

                    2.0: https://github.com/luckman212/wgfix

                    1 Reply Last reply Reply Quote 0
                    • D
                      ddbnj @luckman212
                      last edited by

                      @luckman212

                      Wireguard aside, does failback work for just the WANs at Site A? Once I failover to my LTE, and WAN comes back up, my states on the LTE interface remain.

                      luckman212L 1 Reply Last reply Reply Quote 0
                      • luckman212L
                        luckman212 LAYER 8 @ddbnj
                        last edited by

                        @ddbnj I created this to operate specifically on WireGuard states. If you need generic "fallback" state killing, you can try enabling the Reset all states if WAN IP Address changes option at the bottom of System → Advanced → Networking.

                        D 1 Reply Last reply Reply Quote 1
                        • D
                          ddbnj @luckman212
                          last edited by ddbnj

                          @luckman212

                          Thanks.

                          Evidently resetting all states works sporadically at best.

                          There is a long history of pfsense users asking for failback on interfaces. Scripts were written but no longer seem to be working.

                          https://forum.netgate.com/topic/135614/failback-from-primary-wan-after-failover-to-secondary-wan/19

                          I was hoping to repurpose your script.

                          luckman212L 1 Reply Last reply Reply Quote 0
                          • luckman212L
                            luckman212 LAYER 8 @ddbnj
                            last edited by

                            @ddbnj Feel free to fork and modify it- I had a "StateKiller" package that I was working on to do more complex rule-based state killing / failback but I sadly never finished it. Not sure how much interest there is for that now that they added some more general purpose state killing options in the recent builds.

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