0

I have an OpenWRT router with automatic dhcp domains enabled. This way, for host example-host, I automatically get an A record for example-host.lan to 192.168.1.2.

I am trying to setup a wildcard cname for *.example-host.lan. For this, dnsmasq appears to require to be the authoritative dns server for the domain.

The configuration prior to my attempts is below. With it, when pinging example-host.lan it resolves as expected to 192.168.1.2.

dhcp-authoritative
domain-needed
localise-queries
read-ethers
enable-ubus
expand-hosts
bind-dynamic
local-service
domain=lan
server=/lan/
dhcp-leasefile=/tmp/dhcp.leases
resolv-file=/tmp/resolv.conf.auto
dhcp-broadcast=tag:needs-broadcast
addn-hosts=/tmp/hosts
conf-dir=/tmp/dnsmasq.d
user=dnsmasq
group=dnsmasq

dhcp-host=<mac address>,192.168.1.2,example-host,12h


dhcp-ignore-names=tag:dhcp_bogus_hostname
conf-file=/usr/share/dnsmasq/dhcpbogushostname.conf


bogus-priv
conf-file=/usr/share/dnsmasq/rfc6761.conf
dhcp-range=set:lan,192.168.1.100,192.168.1.249,255.255.255.0,12h
no-dhcp-interface=eth1.2
dhcp-range=set:guest,192.168.2.100,192.168.2.249,255.255.255.0,12h

After installing dnsmasq-full (as the default package isn't compiled with the required features), I have tried adding these lines to the beginning, with varying combinations of ip ranges, eth0 or eth1, etc. No matter what I have tried, when these lines are added, the cname is not generated, and the A record also disappears.

cname=*.example-host.lan,example-host.lan
auth-server=example-host.lan,eth1
interface-name=example-host.lan,eth1
auth-zone=example-host.lan,192.168.0.0/16,eth1

I believe this issue arises from just my lack of understanding of Dnsmasq, and it is an enormous program with a manpage that looks like it was written in an alien language to me... Do you have any idea what I might be doing wrong here? Better yet, is there a simple to understand explanation of all of this?

kittydoor
  • 1
  • 1
  • 1

1 Answers1

-1

I believe the use of cname requires the simple name be defined in /etc/hosts.

--cname=<cname>,[<cname>,]<target>[,<TTL>]
       Return  a  CNAME  record  which indicates that <cname> is really <target>. There are significant limitations on the target; it must be a DNS name which is known to dnsmasq from /etc/hosts (or
       additional hosts files), from DHCP, from --interface-name or from another --cname.  If the target does not satisfy this criteria, the whole cname is ignored. The cname must be unique, but  it
       is permissible to have more than one cname pointing to the same target. Indeed it's possible to declare multiple cnames to a target in a single line, like so: --cname=cname1,cname2,target
Tanner
  • 141
  • 1
  • 7