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

    2.0RC1 Multi-Wan: No default gateway/route change after link failure.

    Scheduled Pinned Locked Moved 2.0-RC Snapshot Feedback and Problems - RETIRED
    39 Posts 13 Posters 22.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
      sergu61
      last edited by

      After May, 18th again the same problem! :(

      It was necessary to be rolled away on the Snapshot "pfSense-Full-Update-2.0-RC1-i386-20110517-2328.tgz" - on it the route by default switches automatically:
      –--------
      May 20 2:36:45 PM pfsense php:: Default gateway down setting 2_GW as default!
      May 20 2:36:45 PM pfsense php:: MONITOR: 1_GW is down, removing from routing group

      On new (after May, 18th) Snapshots the first line in system.log missed!

      Sergu61

      1 Reply Last reply Reply Quote 0
      • E
        eri--
        last edited by

        The change has been backed out since it caused issues and i have plans to put a knob under system->advanced to allow enabling it.

        Give me time to come to it.

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

          @ermal:

          The change has been backed out since it caused issues and i have plans to put a knob under system->advanced to allow enabling it.

          Give me time to come to it.

          Please include a "timed refresh" to this feature. In my case I think it would solve all my problems, something like:

          Recheck default gateway route every ___ minutes. (and it would call the auto-change function or write the default gateway route if all gateways are down).

          1 Reply Last reply Reply Quote 0
          • L
            lhodgkins
            last edited by

            Hi Guys,
                Just curious what the status of this issue is…  Has the fix been incorporated into the latest snapshot yet??

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

              In the file system_advanced_misc.php
              in line:
              …..
              />
              …..

              need to change:
              lb_use_sticky    ->      gw_switch_default.

              After that, everything starts to work!

              1 Reply Last reply Reply Quote 0
              • E
                eri--
                last edited by

                I just fixed this.

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

                  Thank you!
                  Now the system has become even more comfortable!

                  1 Reply Last reply Reply Quote 0
                  • P
                    phospher
                    last edited by

                    Awesome. I've been waiting for this fix as well.  How long does it usually take for the snapshot to get built?

                    1 Reply Last reply Reply Quote 0
                    • M
                      Michael Sh.
                      last edited by

                      I'm a little corrected. For me it works better.
                      1. Restores the configured default gateway, if gateway is up.
                      2. Bypasses until IPv6 gateways.
                      3. Will don't touch routing without the need for.

                      
                              if (isset($config['system']['gw_switch_default'])) {
                              /*
                               * NOTE: The code below is meant to replace the default gateway when it goes down.
                               *      This facilitates services running on pfSense itself and are not handled by a PBR to continue working.
                               */
                              $upgw = "";
                              $dfltgwfound = false;
                              foreach ($gateways_arr as $gwname => $gwsttng) {
                                  if (is_ipaddrv4($gateways_arr[$gwname]['gateway'])) {
                                      if (isset($gwsttng['defaultgw'])) {
                                              $dfltgwfound = true;
                                              if (!stristr($gateways_status[$gwname]['status'], "down"))
                                                      $upgw = $gwname;
                                      }
                                      /* Keep a record of the last up gateway */
                                      if (empty($upgw) && !stristr($gateways_status[$gwname]['status'], "down"))
                                              $upgw = $gwname;
                                  }
                              }
                              if ($dfltgwfound == false) {
                                      $gwname = convert_friendly_interface_to_friendly_descr("wan");
                                      if (!stristr($gateways_status[$gwname]['status'], "down"))
                                              $upgw = $gwname;
                              }
                              if (!empty($upgw)) {
                                      if ($gateways_arr[$upgw]['gateway'] == "dynamic")
                                              $gateways_arr[$upgw]['gateway'] = get_interface_gateway($gateways_arr[$upgw]['friendlyiface']);
                                      if (is_ipaddr($gateways_arr[$upgw]['gateway'])) {
                                              exec("/usr/bin/netstat -rnf inet | /usr/bin/awk '/default/ {print $2}'", $currgwip);
                                              if (!stristr($gateways_arr[$upgw]['gateway'], $currgwip[0])) {
                                                  log_error("Setting default gateway '{$upgw}' will replace (IP={$currgwip[0]})!");
                                                  mwexec("/sbin/route delete -inet default; /sbin/route add -inet default {$gateways_arr[$upgw]['gateway']}");
                                              }
                                      }
                              }
                              unset($upgw, $dfltgwfound, $currgwip, $gwname, $gwsttng);
                              }
                      
                      

                      Test is not easy, unfortunately. Frequent kernel panic when the twitching interfaces.

                      1 Reply Last reply Reply Quote 0
                      • G
                        gdavid
                        last edited by

                        Hi guys. I'm having the same troubles dealing with failover gateway. I followed your discussion and now I can reach the correct behavior of switching to the secondary gateway if the default fails.
                        As you wrote, I had to declare a default gateway; if I do NOT flag "Default Gateway" on any gateway, no gateway switch is done at all.
                        So, if I flag "Default Gateway" on one of the gw, the switching is done correctly and the default route is changed. But here arises an issue: when the offline gateways returns online, the routing doesn't come back to this (default) gateway. Never more. Even after minutes and minutes.
                        As consequence, if the secondary gateway goes down (also after many days), my network is definetly offline from internet access.

                        It seems that pfSense can't switch away from an offline gateway if it is not the default gateway.
                        Am I missing something? I really didn't understand if I can patch some php code or this issue is still open …

                        Many thanks !!!!

                        Note1: My WANs NICs always stay up
                        Note2: My "Allow default gateway switching" is flagged on Advanced -> Miscellaneous settings
                        Running 2.0-RC2 (amd64), built on Tue Jun 7 15:17:21 EDT 2011

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