My Solution to multiple dynamic DNS, cable surveillance and public RRD graphs
-
The result (so you can close the topic now if your not interested):
http://pfsense.burken.biz:800/stats.phpWhat i have:
I have 5st DHCP dynamic IP's from my ISP. Every IP gives me 10Mbit upload speed.
I have 6 Gigaethernet ports. "Intel PRO/1000 Dual Port Server Adapter"
5 for WAN.
1 for LAN.
The problem:
How to renew my IPs to DynDNS?
How to get load balancing to my ftp server at: ftp.burken.biz
How to show off for my friends with RRD graphs.
My Solution:
First we fix the DNS problem.
I own burken.biz and i use the free service www.afraid.org for DNS.
first i make:
em1.burken.biz, em2.burken.biz, em3.burken.biz, em4.burken.biz, em5.burken.biz
then:
ftp.burken.biz
and some other privates….Afraid supports "Direct URL" update with "Authentication Token"
So you can update with "http://freedns.afraid.org/dynamic/update.php?blablabla"First i installed wget.
then i made a script:%Here i make my nics: /usr/local/bin/wget -q --append-output=/em-docs/em1.error --bind-address=`ifconfig em1 | grep netmask | awk '{ print $2 }'` --read-timeout=0.0 --waitretry=5 --tries=400 --background "http://freedns.afraid.org/dynamic/update.php?uniqueurl1" --output-document=/usr/local/www/em1.txt /usr/local/bin/wget -q --append-output=/em-docs/em2.error --bind-address=`ifconfig em2 | grep netmask | awk '{ print $2 }'` --read-timeout=0.0 --waitretry=5 --tries=400 --background "http://freedns.afraid.org/dynamic/update.php?uniqueurl2" --output-document=/usr/local/www/em2.txt /usr/local/bin/wget -q --append-output=/em-docs/em3.error --bind-address=`ifconfig em3 | grep netmask | awk '{ print $2 }'` --read-timeout=0.0 --waitretry=5 --tries=400 --background "http://freedns.afraid.org/dynamic/update.php?uniqueurl3" --output-document=/usr/local/www/em3.txt /usr/local/bin/wget -q --append-output=/em-docs/em4.error --bind-address=`ifconfig em4 | grep netmask | awk '{ print $2 }'` --read-timeout=0.0 --waitretry=5 --tries=400 --background "http://freedns.afraid.org/dynamic/update.php?uniqueurl4" --output-document=/usr/local/www/em4.txt /usr/local/bin/wget -q --append-output=/em-docs/em5.error --bind-address=`ifconfig em5 | grep netmask | awk '{ print $2 }'` --read-timeout=0.0 --waitretry=5 --tries=400 --background "http://freedns.afraid.org/dynamic/update.php?uniqueurl5" --output-document=/usr/local/www/em5.txt %ftp.burken.biz i want all the ips go to: /usr/local/bin/wget -q --append-output=/ftp-docs/ftp.error --bind-address=`ifconfig em1 | grep netmask | awk '{ print $2 }'` --read-timeout=0.0 --waitretry=5 --tries=400 --background "http://freedns.afraid.org/dynamic/update.php?ftpurl" --spider /usr/local/bin/wget -q --append-output=/ftp-docs/ftp.error --bind-address=`ifconfig em2 | grep netmask | awk '{ print $2 }'` --read-timeout=0.0 --waitretry=5 --tries=400 --background "http://freedns.afraid.org/dynamic/update.php?ftpurl" --spider /usr/local/bin/wget -q --append-output=/ftp-docs/ftp.error --bind-address=`ifconfig em3 | grep netmask | awk '{ print $2 }'` --read-timeout=0.0 --waitretry=5 --tries=400 --background "http://freedns.afraid.org/dynamic/update.php?ftpurl" --spider /usr/local/bin/wget -q --append-output=/ftp-docs/ftp.error --bind-address=`ifconfig em4 | grep netmask | awk '{ print $2 }'` --read-timeout=0.0 --waitretry=5 --tries=400 --background "http://freedns.afraid.org/dynamic/update.php?ftpurl" --spider /usr/local/bin/wget -q --append-output=/ftp-docs/ftp.error --bind-address=`ifconfig em5 | grep netmask | awk '{ print $2 }'` --read-timeout=0.0 --waitretry=5 --tries=400 --background "http://freedns.afraid.org/dynamic/update.php?ftpurl" --spider %workstation 1 (i know.. not needed can just CNAME bind them..: /usr/local/bin/wget -q --output-file=/dev/null --bind-address=`ifconfig em5 | grep netmask | awk '{ print $2 }'` --read-timeout=0.0 --waitretry=5 --tries=400 --background "http://freedns.afraid.org/dynamic/update.php?uniqueurl5" --spider %workstation 2: /usr/local/bin/wget -q --output-file=/dev/null --bind-address=`ifconfig em4 | grep netmask | awk '{ print $2 }'` --read-timeout=0.0 --waitretry=5 --tries=400 --background "http://freedns.afraid.org/dynamic/update.php?uniqueurl4" --spider %workstation 3: /usr/local/bin/wget -q --output-file=/dev/null --bind-address=`ifconfig em3 | grep netmask | awk '{ print $2 }'` --read-timeout=0.0 --waitretry=5 --tries=400 --background "http://freedns.afraid.org/dynamic/update.php?uniqueurl3" --spider %LAN (yes i could update this realtime at the php but its just not needed: ifconfig em0 | grep netmask | awk '{ print $2 }' > /usr/local/www/em0.txt
I bind the right nicip to every dns with the bind-address command.
Then saves the output to:/usr/local/www/em5.txt for later use.crontab the script in pfsense.. oh.. extract your conf to xml… edit the file and load it.. it worked for me..
Next step
is my stats.php:
http://pfsense.burken.biz:800/stats.phps
I made a phps file only for you guys.
you can see im my phps i take out the ip from the em* files..
and checks when it supdated.and last i use ifconfig em* | grep status
and check if my gf have done something bad when vacuum cleaning ;)Next is RRD..
Go to my php again and you see: http://www.negerboll.com/stats/cpu-stat.php
this is cpu-stat.php:header('Content-type: image/png'); echo @file_get_contents('http://admin:pfsenser0x@pfsense.burken.biz:800/status_rrd_graph_img.php?interval=16h&database=system-processor.rrd&style=inverse'); ?>
i used an external webbserver for this one.. pfsense webbinterface dident like to make the graphs.. i don't know why.
I think that is all.. Im new to freebsd and new to php.. but it works and i will be realy happy if someone takes the time to comment my little work here.
If you have tips and trix plz tell them to!