Welcome!

Welcome to Satlover forums, full of great people, ideas and excitement.

Please register if you would like to take part. link..

Register Now

Alert: Don't Use Hotmail Email Accounts for registration

Collapse

Before Access to all Forums and Trial accounts you must need to activate your account Email address

Ubuntu - Domain on dynamic IP using DIR-300+no-ip+zoneedit (professionals)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • uttnls
    • Nov 2024

    Ubuntu - Domain on dynamic IP using DIR-300+no-ip+zoneedit (professionals)

    So being a pro tutorial we won't go in to details, you have :

    1. Router DIR-300

    2. No-IP account

    3. Zoneedit account

    4. Ubuntu Server with :
    - noip2 installed and configured
    - wget installed

    You know how a domain can be hosted on a dynamic IP (to get an ideea just search the thread for the beginners) but you wan't to have an instant update when your IP changes, but at the same time you don't want to be banned for flooding.

    For that after configuring your zones in zone edit lets say :

    - example.com A 11.11.11.11

    - www CNAME example.no-ip.org

    - stats CNAME www.examle.com

    You use this script to detect on your DIR-300 if the ip had changed, and if it has, only then you request an update to zoneedit and no-ip.

    Please pay attention to passwords,users,domainnames,accounts that have to be changed in order to have the script full functional (marked in red).

    Put this script in /var/ipdynamic

    Code:
    #!/bin/sh
    
    DATA=$(date)
    
    #get the WAN IP from DIR-300 Router
    IP=$(wget "http://[COLOR="red"]your.dir300.local.ip[/COLOR]/st_device.php?LOGIN_USER=[COLOR="Red"]dir300username[/COLOR]&LOGIN_PASSWD=[COLOR="red"]dir300password[/COLOR]&ACTION_POST=LOGIN" -O - -q | grep '<td class="l_tb"><div id="wanipaddr">&nbsp;' | cut -d";" -f 2 | cut -d"<" -f 1)
    
    # check the ip from no-ip.org
    OLDIP=$(dig +short [COLOR="red"]examplecom.no-ip.org[/COLOR]|head -n 1)
    
    # verify if the IP from DIR-300 is diffrent from that updated on no-ip
    if [ "$IP" != "$OLDIP" ]; then
    
        echo "===========================================================================================" >> /var/ipdynamic/logip.txt
    
        echo "<<<<<<<<<<<<<< "$DATA" - New IP : "$IP" >>>>>>>>>>>>>>" >> /var/ipdynamic/logip.txt
    
        noip2 -i $IP >> /var/ipdynamic/logip.txt 2>&1 #Update the new IP to No-IP
    
        echo "===========================================================================================" >> /var/ipdynamic/logip.txt
    
        wget  --no-check-certificate -O - --http-user=[COLOR="red"]zoneedituser[/COLOR] --http-passwd=[COLOR="red"]zoneeditpass[/COLOR] 'https://dynamic.zoneedit.com/auth/dynamic.html?zones=[COLOR="Red"]domain.name[/COLOR]' >>/dev/null 2>&1 #update the new IP to zoneedit
    
    fi
    Then execute this script every minute using crontab

    After that you enter nameservers provided by zoneedit to your registrar

    The main ideea is that using this implementation you'll avoid flooding no-ip and zoneedit while having almost instant updates with your new IP
Working...