www.zeroshell.org Forum Index www.zeroshell.org
Linux Distribution for server and embedded devices
 SearchSearch  RegisterRegister  UsergroupsUsergroups 
 ProfileProfile  Log inLog in  Log in to check your private messagesPrivate Message 


Post new topic   Reply to topic    www.zeroshell.org Forum Index -> ZeroShell
View previous topic :: View next topic  
Author Message

Joined: 23 Oct 2014
Posts: 1

PostPosted: Thu Oct 23, 2014 10:32 pm    Post subject: Dual WAN DynDNS Reply with quote


I was wondering if there's a way to configure two DynDNSs on my zeroshell and make them travel through different WAN interfaces in the load balancer.

The dyndnsclient has the -interface option, so this shouldn't be hard to achieve, however, I cannot find the option in zeroshell. Am I missing something?

By the way, I found this script, but I believe this will only worl with PPPoE or any other way which puts the public IP directly into the interface:


# Bash script: DynDNS-Cron
# Script para resolver dos DynDNS distintos, uno por cada interfaz.
. /etc/kerbynet.conf


while true ; do
    sleep $INTERVAL
    NEW_IP=`ip addr show $INTERFACE 2> /dev/null | grep inet | awk '{ sub(/\//, " ") ;  print $2 }'`
    if [ -n "$NEW_IP" -a "$NEW_IP" != "$LAST_IP" ]; then
        DNS_IP=`host $HOSTNAME 2> /dev/null | cut -d" " -f4`
        if [ "$NEW_IP" != "$DNS_IP" ]; then
                logger -t DDNS "DynDNS change required for internet $INTERFACE ($HOSTNAME)"
                logger -t DDNS "==> new ip: $NEW_IP - old ip: $DNS_IP"
            if wget -q -t 3 -w 20 if wget -t 3 -w 20 -o "$ERROR" -O "$RESULT" "http://${AUTH}@members.dyndns.org/nic/update?hostname=${HOSTNAME}&myip=${NEW_IP}&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"; then
                logger -t DDNS "==> `cat $RESULT`"
                logger -t DDNS "ERROR:"
                grep -v " => " "$ERROR" | logger -t DDNS
            sleep 60

By the way, by executing this command I could get the correct it to place into $LAST_IP:
 curl -s checkip.dyndns.org | cut -d ' ' -f 6 | cut -d '<' -f 1

however, I'm not able to tell curl the interface it will go out by, so the IP will belong to a random interface.

Keep in mind that both dyndns use the same service, so I cannot make a firewall rule to send the traffic to checkip.dyndns.org using one interface because i'm going to need it to go by the other interface later

I gave it some thought and found out that I can get the resolved IP for checkip.dyndns.org using:
 ping -c1 -t1 -W0 checkip.dyndns.org 2>&1 | tr -d '():' | awk '/^PING/{print $3}'

I only have to add a balancing rule that redirects the traffic to that IP, do the check and then disable the rule. Does anyone know how to correctly making such a rule in zeroshell and make it appear in the webgui, just in case some rule is forgot behind.

This would be the description of the rule if is resolved for checkip.dyndns.org:
 MARK all opt -- in * out * -> MARK set 0x65
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> ZeroShell All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group