动态添加子域?

发布于 2024-07-29 19:36:12 字数 201 浏览 4 评论 0 原文

我想知道是否可以动态添加指向动态 IP 地址的子域,以及我将如何做到这一点? 换句话说,“dyndns/no-ip 是如何实现的”:-)? (我没有得到的部分是添加/更改 DNS 条目...我了解客户端如何每隔几分钟发送一个数据包 -___-)。 当然,我可以告诉所有用户只使用 DynDNS/No-IP,但将其与应用程序集成会更酷。

谢谢, 罗伯特

I was wondering if it's possible to dynamically add subdomains that point to dynamic IP addresses, and how I would go about doing that? In other words, "how is dyndns/no-ip implemented" :-)? (The part I don't get is adding/changing the DNS entries... I understand how the client sends a packet every few minutes -___-). I can tell all my users to just use DynDNS/No-IP, of course, but having it integrated with the application would be much cooler.

Thanks,
Robert

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧故 2024-08-05 19:36:12

为了能够直接更新/控制域/子域解析到的位置,您必须拥有自己的名称服务器。 当您在 TLD(例如 .com)下注册域时,该 TLD 就有一个名称服务器。 每当客户端需要查找 something.com 的 IP 时,他们都会询问 .com 名称服务器在哪里可以找到 something 的名称服务器。 该名称服务器又返回有关域或子域的数据。

当您在 GoDaddy网络解决方案,并且您使用他们的在线工具将您的各个子域指向 IP 地址,您正在他们的名称服务器上创建条目。 当客户端请求您的域名时,根域名服务器会告诉他们检查 GoDaddy 的域名服务器。 如果您查看注册商的配置选项,您通常会找到一个地方来指定您自己的名称服务器,而不是输入域 IP。 设置将告诉名称服务器链将子域的解析推迟到该名称服务器。 显然,在这一点上,直接控制名称地址解析机制,您可以做任何您喜欢的事情。

以下是开源名称服务器的列表。 还有很多其他的,从免费的 OSS 到定制的、专有的和非常昂贵的。 从技术上讲,您也可以编写自己的格式,因为 BIND 是一种公共标准格式。

To be able to directly update/control where a domain/subdomain resolves to, you must have your own name server. When you register a domain under a TLD (for example, .com), that TLD has a nameserver. Anytime a client needs to look up the IP to something.com, they ask the .com nameserver where to find the nameserver for something. That nameserver in turn returns data about the domain or subdomain.

When you register a domain at a place like GoDaddy or Network Solutions, and you use their online tools to point your various subdomains to IP addresses, you are creating entries on their nameserver. When a client requests your domain, the root nameserver tells them to check with GoDaddy's nameserver. If you look through the configuration options of your registrar, you'll generally find a place to specify your own nameserver instead of entering domain IPs. Setting that will tell the chain of nameservers to defer resolution of your subdomains to that nameserver. Obviously at that point, having direct control over the mechanism of name-address resolution, you can do whatever you like.

Here's one list of open-source name servers. There are many others, ranging from free OSS to custom, proprietary and very expensive. Technically you could also write your own, as BIND is a public, standard format.

白馒头 2024-08-05 19:36:12

正如您部分所说,DynDNS 和其他动态 IP 服务的工作方式是,它们根据客户端的心跳每隔几分钟更新一次服务器的 DNS 记录。

诀窍在于它们使用极短的 TTL 时间,因此记录的缓存很快就会过期,并且需要重新查询 DynDNS 服务器(这使得动态 IP 更改快速传播)。

如果您想实现这一点,请查找提供 API 的 DNS 主机,或者使用短 TTL 以编程方式更新您自己的服务器上的 DNS。

As you've partially said, the way DynDNS and other dynamic IP services work is that they update their server's DNS records based on a heartbeat from a client every few minutes.

The trick is that they use extremely short TTL times so that caches for the record expire very quickly and need to re-query the DynDNS server (which makes dynamic IP changes propagate quickly).

If you wanted to implement this, either find a DNS host that offers an API, or programatically update the DNS on your own server with a short TTL.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文