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

    TinyDNS issue on 1.2.3-RELEASE

    Scheduled Pinned Locked Moved DHCP and DNS
    2 Posts 2 Posters 1.5k 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.
    • I Offline
      infratek
      last edited by

      Hello,

      I posted earlier this year a topic about a TinyDNS status issue : http://forum.pfsense.org/index.php/topic,35998.msg185699.html#msg185699
      It seems this topic was lock and I can't update it anymore.

      I received a reply in private message that I'd like to post here, it could help other people.
      If ever an administrator would like to attach this to the original post, feel free to do it :)

      Here is the reply I received :



      First edit this file:

      /usr/local/www/tinydns_status.php

      Search for this text:


      if(file_exists("/service/tinydns/root/data"))
              $tinydns_data = file_get_contents("/service/tinydns/root/data");
      else


      replace /service/tinydns/root/data with /var/run/service/tinydns/root/data

      it should look like this:

      if(file_exists("/var/run/service/tinydns/root/data"))
              $tinydns_data = file_get_contents("/var/run/service/tinydns/root/data");
      else

      Then, in the same file you should have a line like this:


      if(stristr($tinydns_data, "+{$hostname}:{$row['monitorip']}"))
                              $inservice = "YES";
                      else
                              $inservice = "NO";


      About the lines above I am not sure, since I didn't save what it was before. But, if you search for the word YES you should have 2 blocks. one with the if with if(stristr($tinydns_data, "+{$hostname}:{$ipaddress}"))
      and the other with the if with I think:  if(stristr($tinydns_data, "+{$hostname}:{$row['monitorip']}"))

      Modify it so that you read this:

      if(stristr($tinydns_data, "+{$hostname}:{$row['failoverip']}"))
                              $inservice = "YES";
                      else
                              $inservice = "NO";

      Finally, there is a race condition when failovering the ip. There is one last modif to do in the file /usr/local/bin/ping_hosts.sh

      You have a part that is like this;

      if [ "$SERVICERESTOREDSCRIPT" != "" ]; then
                                      echo "$DSTIP is UP, previous state was DOWN .. Running $SERVICERESTOREDSCRIPT"
                                      echo "$DSTIP is UP, previous state was DOWN .. Running $SERVICERESTOREDSCRIPT" | logger -p daemon.info -i -t PingMonitor
                                      sh -c $SERVICERESTOREDSCRIPT
                              fi

      Modify it so that it looks like this:

      if [ "$SERVICERESTOREDSCRIPT" != "" ]; then
                                      echo "$DSTIP is UP, previous state was DOWN .. Running $SERVICERESTOREDSCRIPT"
                                      echo "$DSTIP is UP, previous state was DOWN .. Running $SERVICERESTOREDSCRIPT" | logger -p daemon.info -i -t PingMonitor
                                      echo "UP" > /var/db/pingstatus/$DSTIP
                                      sh -c $SERVICERESTOREDSCRIPT
                              fi

      You see the 3rd echo? You should also have it 2 or 3 lines below this block. Delete it and put it in the block.

      Now we have to do the same when the service is down.

      if [ "$FAILURESCRIPT" != "" ]; then
                                      echo "$DSTIP is DOWN, previous state was UP ..  Running $FAILURESCRIPT"
                                      echo "$DSTIP is DOWN, previous state was UP ..  Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor
                                      sh -c $FAILURESCRIPT
                                  fi

      Modify it to add the echo "DOWN" in the block and delete it 2 or 3 lines below.

      if [ "$FAILURESCRIPT" != "" ]; then
                                      echo "$DSTIP is DOWN, previous state was UP ..  Running $FAILURESCRIPT"
                                      echo "$DSTIP is DOWN, previous state was UP ..  Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor
                                      echo "DOWN" > /var/db/pingstatus/$DSTIP
                                      sh -c $FAILURESCRIPT

      I know it's not very clear. Let me know if it works better. Maybe you should backup your files before modifying it.



      1 Reply Last reply Reply Quote 0
      • ? This user is from outside of this forum
        Guest
        last edited by

        I sent that to this user.

        Let me know if it's better for you. I did that under pfsense 2.0

        I noticed also many things missing and needed to be improve. I will maybe send them once I worked on them.

        Let us know if it's usefull for other or only me and this user were lucky to make it work.

        J

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