Post by r***@gmail.comPost by Gordon HsiaoIf in my dnsmasq.conf I used a different port other than 53 for dns,
dnsmasq never assigns DNS server to my dhcp clients, is this a
feature or a bug? for port 53 everything works as expected, of course.
Thanks,
Gordon
Because the DHCP "name-server" attribute (option 6) carries only an IP
address and not a port, this isn't going to work. The DHCP clients
simply aren't written to configure DNS on any port other than 53.
Now, if your intent is for DHCP clients to use a different DNS server on
the same host, one that is listening on port 53, all you need to do is
to add the following line to your configuration (dnsmasq treats 0.0.0.0
as a placeholder for "its own address")
dhcp-option=6,0.0.0.0
Also answering some other responses "why or what is the use case?" A not
unlikely configuration is to have Bind or Unbound as a global and
recursive server, or forwarded DNS over TLS. It would be possible to
treat these as the "upstream" servers and have dnsmasq query them on
127.0.0.1#1053. But that is effectively double buffering (double ram,
handling time), and may be slow for a large number of queries.
Another way is to have Bind or Unbound answer on #53, and then create a
forward or stub (authoritative) zone that queries dnsmasq at
127.0.0.1#1053. Because normally local queries are less volume than
global queries, this may better balance the system. With AXFR in
authoritative mode, dnsmasq isn't generally bothered for each little
thing. To let DHCP clients know there will be an answer on #53
--dhcp-option=[tag],option:dns-server,0.0.0.0
--dhcp-option=[tag],option6:dns-server,[::]
and consider restriction to local admin or link on ip6 with wildcards
--dhcp-option=[tag],option6:dns-server,[fd00::]
--dhcp-option=[tag],option6:dns-server,[fe80::]