Navigation

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

    Gateway not coming back online

    Routing and Multi WAN
    4
    5
    1692
    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
      TimBailey last edited by

      Hi all,

      I have the following setup, which all works.

      https://cacoo.com/diagrams/pcvGRJOtuSVhmBbY/view

      I can browse the internet etc no problems.
      My connection is very flaky (soon to add the additional modems) and is often reconnecting.
      Pfsense correctly shows the gatway as offline when the modem looses connection, but when the connection returns, I can browse the internet as before, but the gateway shows as offline.
      I can get it to come back by editing the gateway and pressing save.

      I'm running 2.0-RELEASE (amd64) built on Tue Sep 13 17:05:32 EDT 2011.

      What am I doing wrong?

      cheers
      Tim

      1 Reply Last reply Reply Quote 0
      • T
        techo91 last edited by

        I have the same problem and didn't find a solution yet.  :(

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

          Same issue. The apinger is working incorrectly when one of WANs disconnected. When it is back online, it's still reporting that WAN is offline.
          Temporarily resolved this problem by restarting apinger every 5 minutes by cron.

          1 Reply Last reply Reply Quote 0
          • T
            techo91 last edited by

            Can you give us a clue how to do that, I have the same problem.

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

              I've never been able to provide the necessary information to get this issue fix, but there is some ways to reduce the impact.

              1. If you only have one wan connection
              system -> routing -> edit -> enable Disable Gateway Monitoring

              2. Kill apinger and start apinger
              Install the cron package
              /bin/pkill apinger
              a second later
              /usr/local/sbin/apinger -c /var/etc/apinger.conf

              3.Part of this script can be used to only restart apinger if it's down

              #!/bin/sh
              # ###### Modem & apinger monitor script for pfSense ########
              #							   #
              #  - Restart modem if connection is down		   #
              #  - Restart apinger if modem connection is ok but apinger #
              #     status says it's down				   #
              #  - Kill phone states if frozen			   #
              #  - Kill phone states if they use the wrong connection    #
              # 							   #
              ############################################################
              << Copyright
                      Copyright (C) 2011 Perry Mason crazypark2 (at) yahoo.dk
              
              	All rights reserved.
              
              	Redistribution and use in source and binary forms, with or without
              	modification, are permitted provided that the following conditions are met:
              
              	1\. Redistributions of source code must retain the above copyright notice,
              		this list of conditions and the following disclaimer.
              
              	2\. Redistributions in binary form must reproduce the above copyright
              		notice, this list of conditions and the following disclaimer in the
              		documentation and/or other materials provided with the distribution.
              
              	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
              	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
              	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
              	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
              	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
              	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
              	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
              	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
              	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
              	POSSIBILITY OF SUCH DAMAGE.
              Copyright
              
              monitorip='8.8.4.4'
              wanip='192.168.0.100'
              wan2ip='192.168.101.100'
              wan2gateway='192.168.101.1'
              local_voip_ip='192.168.44.100'
              	provider_voip_ip='87.54.25.133'
              usbswitch='ugen0.2'
              attempt_file=/tmp/atempt.status
              off_switch_file=/tmp/offswitch.status
              
              # Write phone states to file
              /sbin/pfctl -s state | grep $local_voip_ip > /tmp/statetmp.status
              # Make sure apinger is running correctly
              awkrepley2=`awk '/'$monitorip'/ && /down/ {print "down"}' /tmp/apinger.status`
              if [ "${awkrepley2}" = "down" ]; then
              # Determent if connection is down or apinger has exit 
                ping -c2 $monitorip
                if [ $? != 0 ]; then
                  echo "WAN2 Connection Unavailable, $monitorip Doesn't Answer To Ping Request." | logger
                  # Switch off modem in a sanely approach
                  [ ! -f "$attempt_file" ] && attempt=4 || attempt=$(cat "$attempt_file")
                  [ ! -f "$off_switch_file" ] && off_switch=3 || off_switch=$(cat "$off_switch_file") 
                  echo "If this value $attempt is bigger then this value $off_switch switch off modem" | logger
                  attempt2=$(($attempt > $off_switch))
                  if [ $attempt2 = 1 ];then
                    off_switch2=$(($off_switch * 2))
                    echo $off_switch2 > "$off_switch_file"
                    echo "Restarting modem" | logger
                    /usr/sbin/usbconfig -d $usbswitch power_off 
                    sleep 15 
                    /usr/sbin/usbconfig -d $usbswitch power_on
              #sleep 9
              #echo "ssssssssstart" | logger
              #need_pid=$(cat "/var/run/apinger.pid")
              #echo "pid nr $need_pid" | logger
              #truss -p $need_pid -o /tmp/truss\ $need_pid.out & tcpdump -ni vr0 -w /tmp/$need_pid.pcap & sleep 90 
              #/bin/pkill truss
              #/bin/pkill tcpdump
              #echo "eeeeeeeeend" | logger
                  else
                  attempt3=$(($attempt + 1))
                  echo $attempt3 > "$attempt_file"
                  fi
                else
                  echo "Apinger marks WAN2 down but connection is available, so restart apinger" | logger
                  /bin/pkill apinger 
                  sleep 1 
                  /usr/local/sbin/apinger -c /var/etc/apinger.conf
                  [ -f "$attempt_file" ] && rm -f "$attempt_file"
                  [ -f "$off_switch_file" ] && rm -f "$off_switch_file"
                  echo "some files deleted" | logger
                  sleep 30
                  /usr/local/sbin/pfSctl -c 'filter reload'
                  sleep 1
                  /sbin/pfctl -k $local_voip_ip -k $provider_voip_ip
                fi
              else
              # Kill VOIP phone states if in wrong state
              awkrepley3=`awk '/'$wan2ip'/ && /'$provider_voip_ip'/ && /SINGLE/ {print "down"}' /tmp/statetmp.status`
                if [ "${awkrepley3}" = "down" ] ; then
                  /sbin/pfctl -k $local_voip_ip -k $provider_voip_ip
                  echo "states frozen kill them" | logger  
                fi
              # If WAN2 has recoved but VOIP states still uses WAN connection then kill them
               awkrepley4=`awk '/'$wanip'/ && /'$provider_voip_ip'/ {print "down"}' /tmp/statetmp.status`
                if [ "${awkrepley4}" = "down" ] ; then
              # fix to redmine ticket #1508 didn't change so filter reload is still needed
                  /usr/local/sbin/pfSctl -c 'filter reload'
                  sleep 1
                  /sbin/pfctl -k $local_voip_ip -k $provider_voip_ip
                  echo "WAN2 is running again kill voip states" | logger  
                fi
              fi
              
              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              Products

              • Platform Overview
              • TNSR
              • pfSense
              • Appliances

              Services

              • Training
              • Professional Services

              Support

              • Subscription Plans
              • Contact Support
              • Product Lifecycle
              • Documentation

              News

              • Media Coverage
              • Press
              • Events

              Resources

              • Blog
              • FAQ
              • Find a Partner
              • Resource Library
              • Security Information

              Company

              • About Us
              • Careers
              • Partners
              • Contact Us
              • Legal
              Our Mission

              We provide leading-edge network security at a fair price - regardless of organizational size or network sophistication. We believe that an open-source security model offers disruptive pricing along with the agility required to quickly address emerging threats.

              Subscribe to our Newsletter

              Product information, software announcements, and special offers. See our newsletter archive to sign up for future newsletters and to read past announcements.

              © 2021 Rubicon Communications, LLC | Privacy Policy