找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 7485|回复: 2

[其它] Centos 做自己的DDNS服务器

[复制链接]
发表于 2013-11-28 18:09:28 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
本帖最后由 jike106397 于 2013-11-28 18:19 编辑

简单做了个DDNS服务器,测试成功!!分享下
以下从自己WIKI上拷的,有问题请指正


1 install CENTOS
2 install BIND , APACHE and PHP
3 the configure file of bind:

  1.       memstatistics-file "/var/named/data/named_mem_stats.txt";
  2.         allow-query     { any; };
  3.         recursion yes;

  4.         dnssec-enable yes;
  5.         dnssec-validation yes;
  6.         dnssec-lookaside auto;

  7.         /* Path to ISC DLV key */
  8.         bindkeys-file "/etc/named.iscdlv.key";

  9.         managed-keys-directory "/var/named/dynamic";
  10. };

  11. logging {
  12.         channel default_debug {
  13.                 file "data/named.run";
  14.                 severity dynamic;
  15.         };
  16. };

  17. zone "." IN {
  18.         type hint;
  19.         file "named.ca";
  20. };

  21. zone "d.dshoub。com."
  22. {
  23.         type master;
  24.         file "named.d.dshoub。com";
  25.         allow-query { any;};
  26.         allow-update {127.0.0.1; };
  27.         notify yes;
  28. };



  29. include "/etc/named.rfc1912.zones";
  30. include "/etc/named.root.key";
复制代码
4 the script file of php


  1. <?php
  2. $dns  = $_GET["dns"];
  3. $domain = "d.dshoub。com";
  4. $ip = $_SERVER['REMOTE_ADDR'];
  5. if (strlen($dns) > strlen($domain))
  6. {
  7.         if ( substr($dns,strlen($dns) - strlen($domain),strlen($domain)) == $domain )
  8.         {
  9.                 shell_exec("/usr/bin/nsupdate  <<EOF
  10.                 server 127.0.0.1
  11.                 zone $domain
  12.                 update delete $dns A
  13.                 update add $dns 300 A $ip
  14.                 send
  15.                 EOF
  16.                 ");
  17.         }               
  18. }
  19. print $ip;
  20. print "<br>";
  21. print("updated $dns" .PHP_EOL);
  22. ?>
复制代码
5  how to use to update

  1. HTTP://url/ddns。php?dns=<here is you dns name>
复制代码
6 Script in MikroTik to update dns

  1. :local url  "http://d.dshoub。com/ddns.php\?dns=www。d.dshoub.com"
  2. /tool fetch url=$url  mode=http keep-result=no
  3. :log info message= [:resolve www。d.dshoub.com server=d.dshoub.com]
复制代码
routeros
发表于 2013-11-28 20:24:35 | 显示全部楼层
首先你要到域名商哪里吧你的DNS解析服务器指向你的服务器,不然这样有用吗?

点评

当然要申请域名服务的!!  发表于 2013-11-28 20:27
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-6-17 13:42 , Processed in 0.063747 second(s), 7 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表