1. Perl
2. Bind8/Bind9 (要有nsupdate 指令)
3. Sendmail/Exim/qmail/Postfix (的 sendmail 指令)
4. MySQL/PostgreSQL (用作儲存帳號,本筆記不用,改用file system)
# cd /usr/local/gnudip/etc/
# rm -rf Kgnudip-key* (刪除預設的dns keys)
# dnssec-keygen -a hmac-md5 -b 128 -n HOST gnudip-key (制作dns keys)
Kgnudip-key.+157+xxxxx
# ls
Kgnudip-key.+157+xxxxx.key Kgnudip-key.+157+xxxxx.private
# cat Kgnudip-key.+157+xxxxx.private
Private-key-format: v1.2
Algorithm: 157 (HMAC)
Key: [hash key]
# cat Kgnudip-key.+157+xxxxx.key
gnudip-key. IN KEY 513 3 157 [hash key]
(xxxxx是隨機的,總之能產生dns key就好了)
# BIND nsupdate command
nsupdate = /usr/bin/nsupdate -v
nsupdate = -k /usr/local/gnudip/etc/Kgnudip-key.+157+xxxxx.private (就是剛才產生的key file)
key gnudip-key {
algorithm hmac-md5;
secret "[hash key]"; (剛才產生的key,抄過來就可以)
};
// 加載Bind的dns key
include "/etc/gnudip.key";
zone "ddns.local" {
type master;
// 有關ddns.local的dns設定
file "/var/named/ddns.local.hosts";
allow-transfer {
192.168.1.0/24;
};
// 給所有人query
allow-query {
any;
};
also-notify {
192.168.1.200;
192.168.1.201;
};
// 設定更新政策
update-policy { grant gnudip-key subdomain ddns.local; };
};
$ORIGIN .
$TTL 86400 ; 1 day
ddns.local IN SOA ddns.local. ddns.local. (
22 ; serial
300 ; refresh (5 minutes)
150 ; retry (2 minutes 30 seconds)
604800 ; expire (1 week)
0 ; minimum (0 seconds)
)
NS ddns.local.
A 192.168.1.1
# /etc/init.d/named reload (更新設定)
# /usr/bin/nsupdate -v -k /usr/local/gnudip/etc/Kgnudip-key.+157+xxxxx.private (用dns key執行nsupdate)
> update add test.ddns.local. 0 A 127.0.0.1 (加入 test.ddns.local. ,IP=127.0.0.1)
> send (傳送更新)
> (Ctrl-D 退出)
# ping test.ddns.local (如果回傳 127.0.0.1,就成功啦 ^_^)
service gnudip
{
flags = REUSE
socket_type = stream
protocol = tcp
wait = no
user = nobody
server = /usr/local/gnudip/sbin/gdipinet.pl
bind = 0.0.0.0
}
# cd /usr/local/gnudip/lib
# unlink dbusers.pm
# unlink gdipfrun.pm
# ln -s dbusers_flat.pm dbusers.pm
# ln -s gdipfrun_replacethread.pm gdipfrun.pm
# export PATH=$PATH:/usr/local/gnudip/sbin
# gdipuseradd.pl -p THIS_IS_PASSWORD helloword ddns.local (建立帳號)
# chown -R nobody:nobody /usr/local/gnudip/run/database/users (把建立的帳號user, group變為nobody)
把解壓了的 gdipc 放到 C:\,再執行以下指令︰
C:\> cd \gdipc
C:\gdipc>config.bat
Using Update Configuration Mode
Configuration file name: C:/gdipc/gdipc.conf.txt
Username: helloworld
Domain: ddns.local
Connect by direct TCP (d) or web server (w) [d]:
GnuDIP Server - host[:port]: ddns.local
Password: THIS_IS_PASSWORD
Cache File [C:/gdipc/gdipc.cache.helloworld.ddns.local.txt]:
Minimum Seconds Between Updates [0]:
Maximum Seconds Between Updates [2073600]:
C:\gdipc>gdipc.bat
==== gdipc.bat running: Mon Feb 19 16:45:04 2007 ====
Configuration file name: C:/gdipc/gdipc.conf.txt
Cache file name: C:/gdipc/gdipc.cache.helloworld.ddns.local.txt
Attempting update at ddns.local...
Update to address 192.168.1.2 from x.x.x.x successful for helloworld.ddns.local.
C:\gdipc>gdipc.bat -g [sendport]:[recvport]
[sendport], [recvport]都是UDP ports,用作回傳Gateway IP使用。
c:\> ping helloworld.ddns.local
回傳自己IP (192.168.1.2) 的話就成功了
联系客服