routeros dns_从RouterOS在FreeDNS上进行动态DNS更新

巫马炫明
2023-12-01

routeros dns

免费DNS (FreeDNS)

FreeDNS (https://freedns.afraid.org/) offers free DNS hosting for up to 5 subdomains. You can set up a domain like example.mooo.com and point it to any IP you want.

FreeDNS( https://freedns.afraid.org/ )提供最多5个子域的免费DNS托管。 您可以设置一个域名,例如example.mooo.com,并将其指向您想要的任何IP。

I wanted to set up Dynamic DNS updates, so that a certain subdomain would always point to my (potentially changing) home IP. The setup on FreeDNS is quite simple:

我想设置动态DNS更新,以便某个子域将始终指向我的(可能更改的)家庭IP。 FreeDNS上的设置非常简单:

  1. Add a new subdomain (Type A) on https://freedns.afraid.org/subdomain/
  2. Go to https://freedns.afraid.org/dynamic/v2/
  3. Select your subdomain and enable Dynamic DNS
  1. https://freedns.afraid.org/subdomain/上添加新的子域(类型A)
  2. 转到https://freedns.afraid.org/dynamic/v2/
  3. 选择您的子域并启用动态DNS

Next to your subdomain, a sync URL is automatically generated. It looks like this: http://sync.afraid.org/u/<random-token>/. If you request that URL with an HTTP client, the IP will automatically be updated:

在您的子域旁边,会自动生成一个同步URL。 看起来像这样: http : //sync.afraid.org/u/<random-token>/ 。 如果您通过HTTP客户端请求该URL,则IP将自动更新:


$ curl https://sync.afraid.org/u/<random-token>/
Updated asdfasdfdsdasasdf.chickenkiller.com from 46.38.XX.XX to 213.144.XX.XX

Note that the URL displayed in the FreeDNS web interface is using the insecure http:// protocol by default, you should change that to https:// instead.

请注意,默认情况下,FreeDNS Web界面中显示的URL使用的是不安全的http://协议,您应该将其更改为https://

在Mikrotik RouterOS上进行设置 (Setup on Mikrotik RouterOS)

Configuring your Mikrotik router to periodically update the IP is also very simple using the following one-line script:

使用以下单行脚本将Mikrotik路由器配置为定期更新IP也非常简单:


/system script
    add comment="Update DynamicDNS on freedns.afraid.org" name=dyndns-afraid 
    source="/tool fetch url="https://sync.afraid.org/u/<random-token>/""

Finally, schedule this script to be executed every 5 minutes:

最后,安排此脚本每5分钟执行一次:


/system scheduler
    add disabled=no start-time=startup interval=5m name=dyndns-afraid 
    on-event="/system script run dyndns-afraid"

(Small sidenote: The RouterOS “fetch” command does not verify the validity of the HTTPS certificate by default. You should probably add the root certificate used by the host to your certificate store and add the check-certificate=yes option to the fetch command.)

(小边注:默认情况下,RouterOS“ fetch”命令不会验证HTTPS证书的有效性。您可能应该将主机使用的根证书添加到证书存储中,并在fetch命令中添加check-certificate = yes选项。 )

翻译自: https://www.pybloggers.com/2016/07/dynamic-dns-updates-on-freedns-from-routeros/

routeros dns

 类似资料: