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

    Dual WAN Failover doesn't failover back to WAN 1 [Resolved]

    Scheduled Pinned Locked Moved Routing and Multi WAN
    55 Posts 6 Posters 7.4k 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.
    • pfrickrollP
      pfrickroll @serbus
      last edited by

      @serbus
      WAN_DHCP - igb0
      OPT1_DHCP - igb1

      So, here what i see in Shell output, I am kind of lost where do I type Y or press it because I can't interact with shell window but only the command line below it
      pfSense test.PNG

      1 Reply Last reply Reply Quote 0
      • pfrickrollP
        pfrickroll @Raffi_
        last edited by

        @Raffi_ Yes I was about to do that actually, makes sense

        1 Reply Last reply Reply Quote 0
        • S
          serbus
          last edited by

          Hello!

          The shell is the way to go.

          You can also do a :

          pkg install -y /tmp/pfSense-pkg-gatewayhook-0_1.txz
          

          ...from the gui. The "-y" will auto-yes the install...

          John

          Lex parsimoniae

          1 Reply Last reply Reply Quote 0
          • S
            serbus
            last edited by

            And then...

            if [ $gwname == "WAN_DHCP" ] && [ $event == "gateway.up" ]
            then
               # clear the states on this interface
            
               /sbin/pfctl -i igb1 -Fs
            fi
            

            Lex parsimoniae

            pfrickrollP 1 Reply Last reply Reply Quote 0
            • pfrickrollP
              pfrickroll @serbus
              last edited by

              @serbus Looks like it worked but i have to leave now. I have to do more testing tomorrow when I get time and test IP Phone along with it and will report then.

              1 Reply Last reply Reply Quote 1
              • Raffi_R
                Raffi_
                last edited by

                Great, I'm curious to know how your testing went as well. I'll give this a try when I have some time.

                1 Reply Last reply Reply Quote 0
                • Raffi_R
                  Raffi_
                  last edited by

                  @serbus I have a couple of questions on this. Cron is not needed to run this script?
                  Would this be backed up as part of the standard xml backup file or would I have to back this up with the separate Backup package?

                  1 Reply Last reply Reply Quote 0
                  • S
                    serbus
                    last edited by serbus

                    Hello!

                    The config is stored in config.xml

                    The plugin is event triggered. A schedule task is not needed.

                    The only place I have seen the plugin_gateway event generated is in the gateway group handling code. This event does not appear to be called when processing gateways that are not in a group.

                    John

                    Lex parsimoniae

                    pfrickrollP 1 Reply Last reply Reply Quote 1
                    • pfrickrollP
                      pfrickroll @serbus
                      last edited by pfrickroll

                      @serbus I did 4 tests and it doesn't switch back to main WAN. All states are still under OPT1

                      By the way OPT1-igb2 actually but i fixed it in config as well.

                      WAN states.PNG
                      OPT1 states.PNG

                      1 Reply Last reply Reply Quote 0
                      • S
                        serbus
                        last edited by

                        Hello!

                        To make sure the plugin was triggered, check the system.log :

                        clog /var/log/system.log | grep gatewayhook
                        

                        and look for something like this :

                        Sep 30 21:01:43 pfSenseapu4 php-fpm[404]: gatewayhook: /usr/local/etc/rc.d/rc.gateway_alarm_custom script started - WAN_DHCP gateway.down igb0
                        Sep 30 21:01:55 pfSenseapu4 php-fpm[405]: gatewayhook: /usr/local/etc/rc.d/rc.gateway_alarm_custom script started - WAN_DHCP gateway.up igb0
                        

                        These log lines are the gatewayhook responding to a group member cable unplug/plug event.

                        John

                        Lex parsimoniae

                        1 Reply Last reply Reply Quote 0
                        • S
                          serbus
                          last edited by

                          Hello!

                          Also, this plugin script will not force your default gateway back to WAN_DHCP. You need to handle that with policy routing and setting the default gateway to the correct group.

                          John

                          Lex parsimoniae

                          pfrickrollP 1 Reply Last reply Reply Quote 0
                          • pfrickrollP
                            pfrickroll @serbus
                            last edited by

                            @serbus I have set up routing gateways with monitoring IPs and group for failover and made firewall rules in LAN. Is there something else I have to do?

                            1 Reply Last reply Reply Quote 0
                            • S
                              serbus
                              last edited by

                              @pfrickroll said in Dual WAN Failover doesn't failover back to WAN 1:

                              Is there something else I have to do?

                              Hello!

                              Use the FO gwgroup as the default gateway in System -> Routing.

                              Make sure all pertinent firewall rules are using the FO gwgroup as the gateway.

                              Verify in Diagnostics -> Routes that the tier1 gw is the default after it comes back up.

                              Verify that the gatewayhook plugin is being called.

                              Verify that the gatewayhook script is clearing all the states on the tier2 gw.

                              John

                              Lex parsimoniae

                              pfrickrollP 1 Reply Last reply Reply Quote 0
                              • pfrickrollP
                                pfrickroll @serbus
                                last edited by pfrickroll

                                @serbus I wiped everything on the box and started with default configurations without plugins and enabled DNS Resolver with all default configurations. It all works now but I have now new problem, IP Phones.

                                Raffi_R 1 Reply Last reply Reply Quote 0
                                • Raffi_R
                                  Raffi_ @pfrickroll
                                  last edited by

                                  @pfrickroll said in Dual WAN Failover doesn't failover back to WAN 1 [Resolved]:

                                  It all works now but I have now new problem, IP Phones.

                                  I would suggest you start a new thread on this one.

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