首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在dnsmasq中设置TXT记录无效

在dnsmasq中设置TXT记录无效
EN

Unix & Linux用户
提问于 2020-09-29 20:49:01
回答 1查看 1.7K关注 0票数 0

我想在本地dnsmasq中配置一些TXT记录,它运行在本地网络中的单板机和服务器DHCP和DNS上。

我使用它使我在家中的服务可以在与因特网相同的FQDN下访问,但在A记录中有本地的IPv4地址。

效果很好。

然而,我正在努力让dnsmasq解决TXT记录。在尝试并无法将所需的记录解析后,我将示例TXT记录从example.conf复制到了dnsmasq.conf中。

代码语言:javascript
复制
#Example zeroconf
txt-record=_http._tcp.example.com,name=value,paper=A4

重新加载dnsmasq,然后尝试

代码语言:javascript
复制
dig _http._tcp.example.com TXT @192.168.2.15

会产生一个空的结果。

然而,dnsmasq.log说:

代码语言:javascript
复制
Sep 29 21:59:07 dnsmasq[725]: query[TXT] _http._tcp.example.com from 192.168.2.111                                               
Sep 29 21:59:07 dnsmasq[725]: forwarded _http._tcp.example.com to 12.23.45.57   

我试图谷歌这个,但我发现所有的链接到example.conf或手册。

我读取了手册页和配置文件,但找不到任何配置开关,这似乎是TXT记录要在本地解析所必需的。有人成功了吗?

谢谢!

EN

回答 1

Unix & Linux用户

发布于 2022-02-19 11:17:47

我宁愿发表评论,但我的声誉不允许我这样做。但是,由于你的问题是Has anybody succeeded?,我想用我自己的经验来回答是可以的。

简单地说,是的,我成功了,正如你所做的那样:

Server侧(Raspbian "buster"):

代码语言:javascript
复制
br@idril:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

br@idril:~$ dnsmasq --version
Dnsmasq version 2.80  Copyright (c) 2000-2018 Simon Kelley
Compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify dumpfile
[...]

br@idril:~$ hostname -I
192.168.0.120

br@idril:~$ hostname -d
lan

br@idril:~$ grep ^txt /etc/dnsmasq.conf
txt-record=lan,"v=spf1 a -all"
txt-record=_http._tcp.lan,name=value,paper=A4

br@idril:~$ sudo systemctl restart dnsmasq.service

Client侧(Ubuntu "impish") :

代码语言:javascript
复制
br@lorien:~$ lsb_release -a
LSB Version:    security-11.1.0ubuntu3-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 21.10
Release:        21.10
Codename:       impish

br@lorien:~$ hostname -d
lan

br@lorien:~$ dig +short TXT _http._tcp.lan @192.168.0.120
"name=value" "paper=A4"

br@lorien:~$ dig +short TXT lan @192.168.0.120
"v=spf1 a -all"
票数 2
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/612075

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档