Home Page › Forums › Network Management › Networking › Multiple DynDns
This topic contains 6 replies, has 0 voices, and was last updated by tialohitc 9 years ago.
-
AuthorPosts
-
September 14, 2009 at 11:14 am #41919
Hi everyone,
I want to use my first zeroshell box (Alix 2D13) with three DSL-Connections (all on ETH1). Each one has a dynamic IP that changes at irregular times.
How can I best set up THREE INDEPENDENT DYNDNS ACCOUNT UPDATES?
Thank you in advance for any ideas and hints!
Thomas
September 14, 2009 at 2:13 pm #48751I had the same problem with 2 dynamic adsl connections. Although I would very much like to see in future releases the ability to have multiple dynamic dns clients, I have temporarily tried the following workaround. There are 2 always-on servers which have a dyndns client running. These 2 servers are forwarded to a different gateway with a netbalancer rule. As a result one dyndns client updates the first account and the other client the second account.
September 14, 2009 at 2:31 pm #48752Hi ppalias,
Yes, that would work. But unfortunately not with my setup…
Could it be achieved with a script, cronjob, etc? Doesn’t have to be a gui-solution…
January 24, 2010 at 12:07 am #48753Hi,
This page contains a set of scripts that do the job. I used these scripts for years on the Linksys NSLU2 NAS.
They are well written and, despite written for running on the NSLU2, they are not platform dependent. I have successfully used them on a regular linux box.
Hope it helps as a kickstart for you to write one for the purpose you described (managing multiple dyndns domais). Good luck!
http://www.nslu2-linux.org/wiki/HowTo/DynDNSupdate
Regards,
February 9, 2010 at 1:44 am #48754I currently have two dynamic IP connections, one ADSL and one 3G.
Ivan Baldo, fine programmer and friend extraordinaire, made a script so ZeroShell updates both dynamic IPs.
He called it ddns2.nuestro (we are Spanish speakers) and placed it in the /Database directory.
Then he added the following command to the ZeroShell preboot script:cp -v /Database/ddns2.nuestro /root/kerbynet.cgi/scripts/ddns2
so ddns2.nuestro is what ZeroShell wil run when updating dynamic IPs.
It has worked without a glitch for more than 3 months now, and I think it is very easy to modify for more than 2 dyndns accounts, or for another DDNS service.
Here it goes:#!/bin/sh
# Script made by Ivan Baldo to permit multiple dyndns IP updating in ZeroShell
Usuario=”your_dyndns_user_name”
Contrasena=”your_dyndns_password”
Host_PPP0=”http_address_of_dyndns_account_1″
Host_PPP1=”http_address_of_dyndns_account_2″actualiza ()
{
Interfaz=”$1″
Host=”$2″
IP=$(ifconfig $Interfaz 2>/dev/null | awk ‘NR==2 {print $2}’ | grep ‘.*..*..*..*’ | cut -d: -f2)
touch /tmp/dyndns.ipviej.$Interfaz
IPViej=”$(cat /tmp/dyndns.ipviej.$Interfaz)”
Actualizar=”no”
if [ “$IP” != “” ]; then
if [ “$IP” != “$IPViej” ]; then
Actualizar=”si”
fi
fi
if [ “$Actualizar” = “no” ]; then
return
fi
if [ -e /tmp/dyndns.deshabilitado.$Interfaz ]; then
return
fi
logger -t DDNS “Actualizando $Host a $IP de interfaz $Interfaz.”
if wget “–bind-address=$IP” -t 3 -w 20 -o /tmp/dyndns.error.$Interfaz -O /tmp/dyndns.resultado.$Interfaz
“http://$Usuario:$Contrasena@members.dyndns.org/nic/update?system=dyndns&hostname=$Host&mx=$Host&myip=$IP”
then
logger -t DDNS “==> $(cat /tmp/dyndns.resultado.$Interfaz)”
if grep -q “!yours|notfqdn|abuse|nohost|badagent|badauth|badsys|dnserr|numhost|911|!donator”
/tmp/dyndns.resultado.$Interfaz
then
logger -t DDNS “==> Hubo un error reportado por DynDNS, luego de solucionar el problema borre el archivo /tmp/dyndns.deshabilitado.$Interfaz!”
touch /tmp/dyndns.deshabilitado.$Interfaz
else
echo “$IP” >/tmp/dyndns.ipviej.$Interfaz
fi
else
logger -t DDNS “==> Error al conectarse con DynDNS:”
grep -v ” => ” /tmp/dyndns.error.$Interfaz | logger -t DDNS
fi
}while true; do
actualiza ppp0 $Host_PPP0
actualiza ppp1 $Host_PPP1
sleep 60
doneUnfortunately, the forum editor does not allow script formatting. I hope it is readable all the same.
I believe also it’s easy to translate the Spanish parts if need be, but in any case I will be following this thread so feel free to ask for translation.I hope I didn’t break any forum rule copying the script here, but I feel it really can be of help to someone, and I do not have any place to hang it for downloading 🙁 .
ZeroShell rules! 😀February 9, 2010 at 7:33 am #48755Hi Lightyear!
This is a very useful script indeed! You can use the[ code ] [ / code ]
tags to make it appear more clearly.
My question is if Ivan could alter the script so that it would accept 2 or more totally different accounts, which means that the http_address_1 has username_1 and password_1 and http_address_2 has username_2 and password_2February 9, 2010 at 4:20 pm #48756No need to bother Ivan; here follows the modified script 8)
#!/bin/sh
# Script made by Ivan Baldo to permit multiple dyndns accounts in ZeroShell
Host_PPP0="http_address_of_dyndns_account_1"
Host_PPP1="http_address_of_dyndns_account_2"
actualiza ()
{
Interfaz="$1"
Host="$2"
Usuario="$3"
Contrasena="$4"
IP=$(ifconfig $Interfaz 2>/dev/null | awk 'NR==2 {print $2}' | grep '.*..*..*..*' | cut -d: -f2)
touch /tmp/dyndns.ipviej.$Interfaz
IPViej="$(cat /tmp/dyndns.ipviej.$Interfaz)"
Actualizar="no"
if [ "$IP" != "" ]; then
if [ "$IP" != "$IPViej" ]; then
Actualizar="si"
fi
fi
if [ "$Actualizar" = "no" ]; then
return
fi
if [ -e /tmp/dyndns.deshabilitado.$Interfaz ]; then
return
fi
logger -t DDNS "Actualizando $Host a $IP de interfaz $Interfaz."
if wget "--bind-address=$IP" -t 3 -w 20 -o /tmp/dyndns.error.$Interfaz -O /tmp/dyndns.resultado.$Interfaz
"http://$Usuario:$Contrasena@members.dyndns.org/nic/update?system=dyndns&hostname=$Host&mx=$Host&myip=$IP"
then
logger -t DDNS "==> $(cat /tmp/dyndns.resultado.$Interfaz)"
if grep -q "!yours|notfqdn|abuse|nohost|badagent|badauth|badsys|dnserr|numhost|911|!donator"
/tmp/dyndns.resultado.$Interfaz
then
logger -t DDNS "==> Hubo un error reportado por DynDNS, luego de solucionar el problema borre el archivo /tmp/dyndns.deshabilitado.$Interfaz!"
touch /tmp/dyndns.deshabilitado.$Interfaz
else
echo "$IP" >/tmp/dyndns.ipviej.$Interfaz
fi
else
logger -t DDNS "==> Error al conectarse con DynDNS:"
grep -v " => " /tmp/dyndns.error.$Interfaz | logger -t DDNS
fi
}
while true; do
actualiza ppp0 $Host_PPP0 username_1 password_1
actualiza ppp1 $Host_PPP1 username_2 password_2
sleep 60
doneOf course, to provide for another DDNS service, it would be neccesary to know these other service quirks and tricks.
And thank you for the tip, ppalias! I do hope you have had a very good 2010 beginning.February 10, 2010 at 9:26 am #48757Thanks Lightyear! I’ll try it at home later on and let you know. It looks ok however on a first glance.
-
AuthorPosts
You must be logged in to reply to this topic.