|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
本帖最后由 jike106397 于 2013-11-28 18:19 编辑
简单做了个DDNS服务器,测试成功!!分享下
以下从自己WIKI上拷的,有问题请指正
1 install CENTOS
2 install BIND , APACHE and PHP
3 the configure file of bind:
- memstatistics-file "/var/named/data/named_mem_stats.txt";
- allow-query { any; };
- recursion yes;
- dnssec-enable yes;
- dnssec-validation yes;
- dnssec-lookaside auto;
- /* Path to ISC DLV key */
- bindkeys-file "/etc/named.iscdlv.key";
- managed-keys-directory "/var/named/dynamic";
- };
- logging {
- channel default_debug {
- file "data/named.run";
- severity dynamic;
- };
- };
- zone "." IN {
- type hint;
- file "named.ca";
- };
- zone "d.dshoub。com."
- {
- type master;
- file "named.d.dshoub。com";
- allow-query { any;};
- allow-update {127.0.0.1; };
- notify yes;
- };
- include "/etc/named.rfc1912.zones";
- include "/etc/named.root.key";
复制代码 4 the script file of php
- <?php
- $dns = $_GET["dns"];
- $domain = "d.dshoub。com";
- $ip = $_SERVER['REMOTE_ADDR'];
- if (strlen($dns) > strlen($domain))
- {
- if ( substr($dns,strlen($dns) - strlen($domain),strlen($domain)) == $domain )
- {
- shell_exec("/usr/bin/nsupdate <<EOF
- server 127.0.0.1
- zone $domain
- update delete $dns A
- update add $dns 300 A $ip
- send
- EOF
- ");
- }
- }
- print $ip;
- print "<br>";
- print("updated $dns" .PHP_EOL);
- ?>
复制代码 5 how to use to update
- HTTP://url/ddns。php?dns=<here is you dns name>
复制代码 6 Script in MikroTik to update dns
- :local url "http://d.dshoub。com/ddns.php\?dns=www。d.dshoub.com"
- /tool fetch url=$url mode=http keep-result=no
- :log info message= [:resolve www。d.dshoub.com server=d.dshoub.com]
复制代码 |
|