apache 您自己服务器上的动态 DNS
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/533926/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Dynamic DNS on your own server
提问by Thomaschaaf
I have a server in at a hoster (which has a static IP) and want to run a server at home too and don't want to buy the dyndns package from dyndns.com
我在主机上有一台服务器(它有一个静态 IP),我也想在家里运行一个服务器,不想从 dyndns.com 购买 dyndns 包
I would either like to find a program that does this without costing money and using my own server and domain so I can have myclient.domain.com or I would like to write this myself. Would I be able to do that with a custom apache conf?
我要么想找到一个无需花钱并使用我自己的服务器和域就能做到这一点的程序,这样我就可以拥有 myclient.domain.com,或者我想自己编写这个程序。我可以使用自定义 apache conf 来做到这一点吗?
EDIT:
编辑:
I have 1 Server with a static ip and I want to run a server at home (dynamic IP) I want to use the server with the static ip to run as the dyndns managing server
我有 1 个带有静态 ip 的服务器,我想在家中运行一个服务器(动态 IP)我想使用带有静态 ip 的服务器作为 dyndns 管理服务器运行
回答by Paul Tomblin
I use zoneedit.com for my DNS servers, and they have a free dynamic service that works fine for my home box. (On the other hand, my home box changes IP about twice a year, so it's not like I stress it.)
我使用 zoneedit.com 作为我的 DNS 服务器,他们有一个免费的动态服务,适用于我的家庭设备。(另一方面,我的家庭盒子每年大约会更改两次 IP,所以我不会强调这一点。)
On my home box, I have a script that polls a tiny little cgi on my colo box to return what my current IP is (because I can't get it from the router), and if it's changed, it does a "curl" to update my zoneedit settings. When I get home, I'll try to remember to post the script.
在我的家用盒子上,我有一个脚本可以轮询我的 colo 盒子上的一个小 cgi 以返回我当前的 IP 是什么(因为我无法从路由器获取它),如果它被更改,它会“卷曲”更新我的 zoneedit 设置。当我回到家时,我会尽量记住发布脚本。
回答by chaos
Per your revisions: Ah, then you can theoretically do that, yes. (As noted elsewhere, apache.conf is irrelevant.) Your hosted server needs to be the nameserver of record for your dynamic DNS; you should probably use a subdomain. This would be a record in your main domain's zone file of IN NS server.ip.number.here. Then you configure a DNS server on your hosted server for the dynamic namespace; you'll have to get deep into the configuration to set up the records so that they advise client nameservers not to cache them, or to cache them only very briefly. Then you write some sort of systemry where the home machine, when a connection is established, talks to the hosted server and tells it to change the DNS for the dynamic hostname to point to its currently assigned IP.
根据您的修订:啊,那么理论上您可以这样做,是的。(如其他地方所述,apache.conf 无关紧要。)您的托管服务器需要是动态 DNS 的记录名称服务器;您可能应该使用子域。这将是 IN NS server.ip.number.here 的主域区域文件中的记录。然后在托管服务器上为动态命名空间配置 DNS 服务器;您必须深入了解配置以设置记录,以便他们建议客户端名称服务器不要缓存它们,或者只是非常短暂地缓存它们。然后您编写某种系统,其中家用机器在建立连接时与托管服务器通信并告诉它更改动态主机名的 DNS 以指向其当前分配的 IP。
回答by Leonel Martins
Maybe I′m wrong but I think what you want is:
也许我错了,但我认为你想要的是:
- create a dynamic host in a freeDNS service, like dyndns.org (Or you can even manager a entire domain using editdns.com which has dynamic dns also). For example: server-at-home.dyndns.org.
- Create a static IP host for the desired address (ex. www2) pointing to the same IP address of the www server.
- Create a virtual host in the httpd.conf in the static ip server and put a reverseproxy using the dynamic host create on item 1.
- 在免费DNS 服务中创建动态主机,例如 dyndns.org(或者您甚至可以使用具有动态 dns 的 editdns.com 管理整个域)。例如:server-at-home.dyndns.org。
- 为指向 www 服务器的相同 IP 地址的所需地址(例如 www2)创建一个静态 IP 主机。
- 在静态 ip 服务器的 httpd.conf 中创建一个虚拟主机,并在第 1 项上使用动态主机创建放置一个反向代理。
P.S.: You said that the main goal is to void to buyfor this service but i use dyndns.com and i dont pay for it. And i have 4 hosts in my account.
PS:您说主要目标是取消购买此服务的费用,但我使用 dyndns.com 并且我不为此付费。我的帐户中有 4 台主机。
回答by Rob Di Marco
You cannot do it with a custom Apache conf. Apache handles web serving, not DNS.
你不能用自定义的 Apache conf 来做到这一点。Apache 处理 Web 服务,而不是 DNS。
回答by stephendl
I have a server at home with a Static IP address, and I do exactly what you are looking to do with a free dyndns account. I just have to renew it every month or two - they send me an email and I just click the link to let them know I'm still here and alive.
我家里有一台带有静态 IP 地址的服务器,我使用免费的 dyndns 帐户完全满足您的需求。我只需要每两个月更新一次——他们给我发了一封电子邮件,我只需点击链接让他们知道我还活着。
回答by Tim
I am not exactly sure, but it sounds like you want to redirect to your "server" at your house from your webserver at the hosted site?
我不太确定,但听起来您想从托管站点的网络服务器重定向到您家中的“服务器”?
You will need to periodically send some notification to your static IP server to let it know your dynamic ip.
您需要定期向您的静态 IP 服务器发送一些通知,让它知道您的动态 IP。
You can do this is some cron/scheduled job - just create a redirect html page every day and ftp it (automagically) to your static ip host.
你可以通过一些 cron/scheduled 的工作来做——每天只创建一个重定向的 html 页面,然后将它(自动)ftp 到你的静态 ip 主机。
There are probably other ways to do this. But that should work.
可能还有其他方法可以做到这一点。但这应该有效。

