TimothyYe / godns

A dynamic DNS client tool that supports AliDNS, Cloudflare, Google Domains, DNSPod, HE.net & DuckDNS & DreamHost, etc, written in Go.
https://timothyye.github.io/godns/
Apache License 2.0
1.5k stars 221 forks source link

Set IPv4 AND IPv6 #58

Closed beatbrot closed 2 years ago

beatbrot commented 4 years ago

Hello,

is there a possibility to let GoDNS manage my IPv4 AND my IPv6 DNS records?

Thanks!

TimothyYe commented 4 years ago

hello @beatbrot, could you provide me the details?

beatbrot commented 4 years ago

Well basically I want my server to be reachable from IPv4 and IPv6.

Therefore, I want both the A and the AAAA record to be set to my current IP. Unfortunately, in the godns configuration, it seems like I have to decide whether I want it to set my A or my AAAA record by setting ip_type to either IPv6 or IPv4. Can I somehow let godns set both records for me at once?

TimothyYe commented 4 years ago

@beatbrot, Yes, currently, GoDNS doesn't support this feature to update IPv6 and IPv4 records at the same time. However, I can put this feature in the milestone and implement it in the next iteration.

beatbrot commented 4 years ago

Thank you very much! Apart from that one single issue, GoDNS really is great!

SadPencil commented 4 years ago

Personally, I think this feature is not necessary. A single GoDNS instance proceed with one DDNS provider, one DNS entry for one IP address, with one config file. The need of updating both the IPv4 and IPv6 address can be met by two GoDNS instances with two config file. If this feature got implemented, the code would be less pretty, as one GoDNS instance would do two things, unless GoDNS supports read multiple config files and proceed with them together. @TimothyYe

LiCijun commented 3 years ago

DNSPod 同一个子域名有多个记录的时候,包含MX记录等 ,可能将其他类型的记录更改为A记录或AAAA记录,同时开启IPV4和ipv6的时候 同一条记录一会儿改为A记录一会儿又改为AAAA记录

TimothyYe commented 3 years ago

@LiCijun 你是运行了两个程序,一个配置为IPv4,一个配置为IPv6?

LiCijun commented 3 years ago

@LiCijun 你是运行了两个程序,一个配置为IPv4,一个配置为IPv6?

是的,两个服务,用了不同的配置文件。

TimothyYe commented 3 years ago

同一条记录一会儿改为A记录一会儿又改为AAAA记录

两个服务同时去更新同一个记录,这肯定会有冲突的…… 建议给两个服务配置不同的二级域名,比如:

IPv6的服务,配置更新二级域名为: ipv6.xxx.com 给IPv4的服务,配置更新二级域名为: ipv4.xxx.com

LiCijun commented 3 years ago

同一条记录一会儿改为A记录一会儿又改为AAAA记录

两个服务同时去更新同一个记录,这肯定会有冲突的…… 建议给两个服务配置不同的二级域名,比如:

IPv6的服务,配置更新二级域名为: ipv6.xxx.com 给IPv4的服务,配置更新二级域名为: ipv4.xxx.com 使用不同的域名使用起来不方便,dns里面本身同一个域名就是分为A记录和AAAA记录的,更新域名记录的时候可以判断一下记录类型。目前没有判断类型,还发生过将MX记录更新为A记录或AAAA记录

TimothyYe commented 3 years ago

对于相同名称的域名判断域名类型是IPv4还是IPv6再更新,我看了代码,目前还不支持这个功能,后续估计会改进

LiCijun commented 3 years ago

对于相同名称的域名判断域名类型是IPv4还是IPv6再更新,我看了代码,目前还不支持这个功能,后续估计会改进

这个还是要判断下,因为不判断还会出现将MX记录给更新了的问题,这就造成邮件服务受影响了。目前应该只是简单粗暴的取第一吧。

LiCijun commented 3 years ago

对于相同名称的域名判断域名类型是IPv4还是IPv6再更新,我看了代码,目前还不支持这个功能,后续估计会改进

查询和更新的时候都加为 record_type=A 或 record_type=AAAA 就不会混乱了

TimothyYe commented 3 years ago

好的,今天我改一下,然后会发布一个新版本

TimothyYe commented 3 years ago

https://github.com/TimothyYe/godns/releases/tag/V2.3.1

@LiCijun 可以试试这个新版本,应该解决了你描述的问题

LiCijun commented 3 years ago

还是有bug 日志显示如下 Oct 14 15:23:59 Aihlp godns[2369]: [GoDNS] 2020/10/14 15:23:59 Going to sleep, will start next checking in 30 seconds... Oct 14 15:24:29 Aihlp godns[2369]: [GoDNS] 2020/10/14 15:24:29 Checking IP for domain aihlp.com Oct 14 15:24:29 Aihlp godns[2369]: [GoDNS] 2020/10/14 15:24:29 currentIP is: 240e:fe:3724:fa01:49b6:f811:82fc:fb1 Oct 14 15:24:31 Aihlp godns[2369]: [GoDNS] 2020/10/14 15:24:31 NXDOMAIN Oct 14 15:24:31 Aihlp godns[2369]: [GoDNS] 2020/10/14 15:24:31 Going to sleep, will start next checking in 30 seconds...

远程的dns并没有更新

LiCijun commented 3 years ago

image 可能是因为我这有多条记录就不行

TimothyYe commented 3 years ago

@LiCijun 你提到的这个issue在V2.3.4已经解决了