使用HE.NET的Dynamic DNS

in #cn7 years ago

昨天说了Linksys WRT 1900ACS 端口转发设置

今天来说说使用HE.NET的Dynamic DNS.


Image Source

为什么用HE.NET?

HE.NET是我在2004年前后就接触过的服务商,后来我的服务器都放到Theplanet,然后Theplanet的一批工程师独立创建了Softlayer,再之后Softlayer被IBM收购,再反过来收购Theplanet,我的N台服务器终于都集中到一家了。至始至终,和he.net交流询价过无数次,但是始终没能合作。

2000年前后无聊去做一个DNS工具,其实就是打算在Windows上完全从零开始实现一个带图形界面的DNS查询工具。已发布版本支持了很多常见的DNS记录类型,新版本支持一些DNSSEC(Domain Name System Security Extensions),但是后来忙别的事情,就没去耐心去做去了。做的过程要测试啊,我在DNS服务器里设置好对应的记录,然后再用我实现的工具去查询,藉此判断我的工具实现的是否正常。

虽然我的几台独立服务器都装着DNS服务,但是手动去改配置文件太麻烦,风险也高,万一搞死了就会挨骂。于是我就去找一些DNS服务商测试,找来找去,发现HE.NET对各种记录支持的最全面*。于是它就成了我测试DNS的首选服务商。

Dynamic DNS 服务商好多家,但是既然HE.NET支持,我就不舍近求远啦。

DNS和 Dynamic DNS

要说Dynamic DNS,就不得不提DNS(域名解析服务);要提DNS,就不得不提域名。

简单的讲,互联网的主机靠IP来区分,要访问一台主机上的服务(HTTP、 FTP、EMAIL、DATABASE等)我们首先要知道对方的IP地址。但是互联网的主机千千万,抽象的IP地址根本无法记忆,而域名就是给这个地址起一个好记的名字。所以,我们就可以通过www.baidu.com这样的域名来访问到百度,通过www.taobao.com这样的域名来访问到淘宝。

而从域名到IP的过程,就是域名解析,是由域名解析服务器(Name Server)来完成的

而另外一种场景就是分配给主机的IP不时的变化。
这时如果使用普通的域名解析服务,我们需要不时的修改解析记录,来将域名指向更新后的IP。这时会有一些问题存在,比如变化频繁,修改工作量大;变化时机不定,无法确定何时修改。

Dynamic DNS 很好的解决如上问题,它的基本原理就是,当主机关联的IP变化时,自动更新解析记录

所以,屏蔽掉一些技术细节,通俗的讲:

  • 互联网上的主机靠IP区分和访问。
  • 域名给IP地址起了个好记的名,从域名到IP的过程就是域名解析。
  • Dynamic DNS自动更新解析记录,适合关联到主机的IP不时变化的场景。

(本小节文本来自我以前在其它网站发表的原创文章,如果你找到雷同的,没错,那就是我写的 😀)

HE.NET的Dynamic DNS

关于他们的DNS服务以及Dynamic DNS的使用细节,请参考:https://dns.he.net/

大致步骤

注册之类的非常简单,大家按提示操作即可,这里就不赘述了,只列出一些关键步骤。

  • 将要解析的域名DNS设置为HE.NET的DNS
  • 在HE.NET的DNS面板中添加域名
  • 添加对应的解析记录(比如A记录),并选取“Enable entry for dynamic dns”
  • 生成用于DDNS客户端的密码(Generate the key used for dynamic DNS updates)
  • 在主机上使用DDNS client。(设置定时任务)

操作实例

  1. 将域名DNS设置为HE.NET的DNS

  2. 在HE.NET的DNS面板中添加域名

  3. 添加对应的解析记录

  4. 生成用于DDNS client的密码

  5. 设置DDNS client
    crontab -e
    添加如下代码:
    */5 * * * * curl "https://dyn.dns.he.net/nic/update" -d "hostname=iot0.xxxx.com" -d "password=XXXXXX" -k
    代码部分可以查阅: https://dns.he.net/

好啦,大功告成啊。
想测试是否成功,ping一下域名,看看显示的IP
再用一些查看公网IP的工具,看一下两者是否一致就可以啦。

或者你已经设置好了NAT的端口转发以及开启了对应的HTTP服务之类的,那么直接访问域名就可以看到网站喽。是不是非常简单!

总结

本文简单介绍了域名、DNS、Dynamic DNS的原理。
并以HE.NET的DNS服务为例,为iot0.xxxx.com添加了一个Dynamic DNS的A Record。
限于篇幅,对一些技术细节只做通俗的解释,想了解对应知识的,请参阅相应的技术文档。

Sort:  

for the people the translation in english of the above post is
HE.NET is the service provider I came into contact with before and after 2004, and then my server was put into Theplanet, then a group of engineers of Theplanet independently created Softlayer, and then Softlayer was acquired by IBM, and then the acquisition of Theplanet, I The N server finally came to a group. At the end of the day, and he.net exchange inquiries numerous times, but never failed to cooperate.

2000 before and after boring to do a DNS tool, in fact, is intended to completely from scratch on Windows to achieve a graphical interface with the DNS query tool. The released version supports a number of common DNS record types, the new version supports some DNSSEC (Domain Name System Security Extensions), but later busy other things, did not go to patience to go. Do the process to test ah, I set up a corresponding DNS server in the corresponding records, and then I use the tools to find, to determine whether my tool is normal
Although several of my separate servers are equipped with DNS services, but manually change the configuration file is too much trouble, the risk is high, if killed will be scolded. So I went to find some DNS service providers to test, find it, find HE.NET support for a variety of records the most comprehensive *. So it became the preferred service provider for my test DNS.

Dynamic DNS service providers a lot of home, but since the HE.NET support, I will not far away.

DNS and Dynamic DNS
To say Dynamic DNS, would have to mention DNS (domain name resolution service); to mention DNS, would have to mention domain name.
this is not the full post trnslation only a part

秒翻
translate so fast

😄 你去评价一下质量如何?

完全是copy到google translate然后再copy回来的,一模一样

谢谢帮忙分析

这就难道我了,一般我也是百度+谷歌+有道 综合翻译。
:)

沙发王 绝不是盖的。
之前你推荐说he.net 我上次准备用的,打开一看界面感觉是web1.0的即视感,操作蛮复杂。
最后还是选择了西部数码的服务,都怪英文不好

好像he.net 2004年的时候就长这样,哈哈

负责ui的 开除,跟不上节奏

好用就好 😄

hi....hope you can post it in english.

Which language is this?

Thank you for this explanation and interpretation of some aspects of this area

我一直在用CloudfFlare的,也挺好用的,很强大的。它家的反代理,连我的IP都隐了,配合CDN。

我不会告诉你我因为CloudfFlare丢一份高薪工作的
所以,坚决抵制!

Pls traslation D;

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.029
BTC 63222.17
ETH 3486.30
USDT 1.00
SBD 2.53