我在家用路由器上使用dnsmasq来管理一些仅本地DNS记录,并为个人公共域名创建split-horizon响应。我最近还添加了合成域设置,以使用新的home.arpa DNS区域生成ip-192-168-0-1.net.home.arpa和vm-1.vm.home.arpa样式记录(请参见{ {3}}(如果有兴趣)。
我想尝试使用details来将internal.home.arpa区域委派为现有水平分割公共域区域的别名(这意味着每次查找基本上都是同一记录的CNAME在我的公共域上),但是dnsmasq没有对DNAME记录的明确支持。
我的问题是:如何使用DNAME record创建DNAME记录?我知道记录类型为39,但是我不确定如何生成原始十六进制数据。
答案 0 :(得分:0)
修改找到的python脚本here我能够生成原始的十六进制数据:
#!/usr/bin/env python3
import dns.rdata
import io
import binascii
name = "example.home.arpa"
rclass = dns.rdataclass.IN
rtype = dns.rdatatype.DNAME
rdata = 'example.com.'
rd = dns.rdata.from_text(rclass, rtype, rdata)
f = io.BytesIO()
rd.to_wire(f)
wire_data = f.getvalue()
print("dnsmasq option: --dns-rr=" + name + "," + str(rtype) + "," + binascii.hexlify(wire_data).decode("ascii"))
会导致以下/etc/dnsmasq.d/home.conf设置:
local=/home.arpa/
dns-rr=example.home.arpa,39,076578616d706c6503636f6d00
但是我不能按预期工作。我可以看到DNAME响应,但是dnsmasq不会使用预期的别名记录来对该区域的其他查询进行响应:
$ nslookup -type=any example.home.arpa
Server: 127.0.1.1
Address: 127.0.1.1#53
example.home.arpa dname = example.com.
$ nslookup -type=a www.example.home.arpa
Server: 127.0.1.1
Address: 127.0.1.1#53
** server can't find www.example.home.arpa: NXDOMAIN
$ nslookup -type=a www.example.com
Server: 127.0.1.1
Address: 127.0.1.1#53
Non-authoritative answer:
Name: www.example.com
Address: 93.184.216.34
这使我相信dnsmasq当前不支持使用DNAME的托管区域。也许接下来,我将尝试将这些请求转发到另一个DNS服务器(如coredns),或使用server=/example.home.arpa/192.168.0.53/
进行绑定,看看是否可行。
更新:使用coredns to host the DNAME record,然后使用server =从dnsmasq转发区域似乎可行。但最好的办法是告诉dnsmasq本身不支持DNAME记录。