My little contribution to pfsense users dyndns update for static ip
-
well here's my little hack to make pfsense update my dyndns account using pfsense dyndns client while using static ip at my wan interface. i think most people would use this cause dual wan configuration needs to use static ips for wans.
this is an ugly hack for now will try to clean it later.make this getip.sh
#!/bin/sh # get ip from using dyndns.org website # by ivanjong # fetch -q -T 15 -o /tmp/tempIP http://checkip.dyndns.org:8245 grep IP /tmp/tempIP | cut -f6 -d " " | cut -f1 -d "<" > /tmp/tempwan oldip=`cat /var/db/wan_ip` length=`wc -m /var/db/wan_ip | cut -f7 -d " "` if [ `grep -c "$oldip" /tmp/tempwan` != 0 ] && [ $(("$length"-`wc -m /tmp/tempwan | cut -f7 -d " "`)) = 0 ] then #echo "same" # not updating else #echo "not same" cp /tmp/tempwan /var/db/wan_ip rm /tmp/tempwan /etc/./rc.newwanip fi
and add a cronjob for this file to run every much as u wan
then find /etc/inc/interface.inc
edit line no. 1474 to
/* static WAN IP address */ if(file_exists("/var/db/wan_ip")){ $curwanip = file_get_contents("/var/db/wan_ip"); }else{ $curwanip = $wancfg['ipaddr']; } return $curwanip; }
wat this does is it fetch http://checkip.dyndns.org:8245 from this website
then format it so it displays the real ip of your wan and the changes in interfaces.inc is to point the wan ip for static ip to real ip of the interface to the real wan ip.note: it's only a hack for now so no waranties that it will work for u. i am only trying to help those using static ip to make full use of their pfsense box. if any prob pls do reply here. any questions do reply here too. hope i did help someone with this.
oh ya i just did this a while ago so i havent much time to time the problem that might arise from this hack. i'm still testing now and will fix if anything if broken later.