This is G o o g l e's cache of http://www.debianclub.com/node/84 as retrieved on 15 Feb 2007 22:28:58 GMT.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
This cached page may reference images which are no longer available. Click here for the cached text only.
To link to or bookmark this page, use the following url: http://www.google.com/search?hl=en&q=cache%3Ahttp%3A%2F%2Fwww.debianclub.com%2Fnode%2F84&btnG=Search


Google is neither affiliated with the authors of this page nor responsible for its content.

User login

Links

debianclub.com
debian.org
ubuntuclub.com
blognone.com

Syndicate

Syndicate content

สร้างสคริปต์ DDNS สำหรับโมเด็ม adsl ให้ everydns

สำหรับ everydns.net
แก้ไขไฟล์ ip-up.local ดังนี้
# vi /etc/ppp/ip-up.local

...
if [ $PPP_IFACE == "ppp0" ]; then
    # REFRESH DNS
    # REFRESH IPTABLES
    # REFRESH SQUID
    # RECONNECT DDNS
    /usr/sbin/d.updateeverydns
fi
...

สร้างสคริปต์อัปเดตชื่อ /usr/sbin/d.updateeverydns ดังนี้
# vi /usr/sbin/d.updatezeverydns

#!/bin/bash
# SCRIPT FOR PPP TO UPDATE DNS RECORD AT everydns.net

# PREREQUIST:
# 0.REGISTER USERNAME & PASSWORD AT www.everydns.net
#   - ADD DYNAMIC DNS example.com
#   - ADD DYNAMIC DNS www.example.com
# 1.DOWNLOAD FILE http://www.everydns.net/eDNS.pl 
#   PUT IN /usr/local/bin
# 2.INSTALL ncftp
#   # aptitude install ncftp
# 3.INSTALL PERL MIME::Base64
#   # perl -MCPAN -e 'install MIME::Base64'

# UPDATE FUNCTION
#usage: updateeverydns $USER $PASSWORD $IP_ADDR $DOMAIN $HOST 
#     : updateeverydns MYUSERNAME MYPASSWORD $PPP_IP example.com www.example.com

updatezone() {
    USER=$1
    PASSWORD=$2
    IP_ADDR=$3
    DOMAIN=$4
    HOST=$5
    eDNS.pl -u $USER -p $PASSWORD -ip $IP_ADDR -d $DOMAIN
    eDNS.pl -u $USER -p $PASSWORD -ip $IP_ADDR -d $HOST
}

# BEGIN MAIN PROGRAM
I_FACE=ppp0
USER="MYUSERNAME"
PASSWD="MYPASSWORD"
DOMAIN1="example.com"
HOST1="www.example.com"

IP_ADDR=`ifconfig $I_FACE | fgrep -i inet | cut -d : -f 2 | cut -d \  -f 1`

# FOR example.com
echo "Updating $DOMAIN1 ..."
updatezone $USER $PASSWD $IP_ADDR $DOMAIN1 $HOST1
echo "Finished."

# chmod 0700 /usr/sbin/d.updateeverydns

ตามคำแนะนำของ everydns คือจะต้องใช้สคริปต์ของเขา ซึ่งสคริปต์นั้นเขียนด้วย perl มีการเรียกใช้ ncftp จึงต้อง...
ดาวน์โหลดสคริปต์มาก่อน และนำไปเก็บไว้ที่ /usr/local/bin
# wget http://www.everydns.net/eDNS.pl
# chmod 755 eDNS.pl
# mv eDNS.pl /usr/local/bin

ในสคริปต์จะต้องเรียกใช้ ncftp จึงต้องติดตั้ง ncftp ก่อน
# aptitude install ncftp

ติดตั้ง perl MIME::base64 ตามคำแนะนำ
# perl -MCPAN -e 'install MIME::Base64'

ครั้งแรกเราเรียกใช้ครั้งเดียว ที่เหลือระบบจะทำอัตโนมัติทุกครั้งที่สายหลุด หรือเปิดเครื่อง
# /usr/sbin/d.updateeverydns

เสร็จแล้วครับ