i have dnsmasq setup in my server. For some security reasons, i am not allowed to modify the /etc/hosts file or create any additional hosts file to store the hostname and the ip addresses.
so in dnsmasq.conf file i have added the hostname and ip address ,
address=/node01.black.system/10.248.11.21
and when i type
nslookup node01.black.system
i get the resulting ip address. But it doesn't vice cersa. If i do
nslookup 10.248.11.21
i am getting server can't find...:NXDOMAIN
however , when i add a ptr record in the dnsmasq.conf file
ptr-record=21.11.248.10.in-addr.arpa., node01.black.system
and then if i type
nslookup 10.248.11.21
i am getting the resultant hostname. Is there a way for this to work both ways, without adding the ptr-record?
because there are like 100 nodes, which will need resolution either way in the server
Thank you
Perhaps you are looking for the --host-record directive which creates both an A and PTR record.
--host-record=<name>[,<name>....],[<IPv4-address>],[<IPv6-address>][,<TTL>]
Add A, AAAA and PTR records to the DNS...
e.g.
host-record=node01.black.system,10.248.11.21
Whereas according the the dnsmasq man page the address option is to define an IP returned for any address in a domain. It does not mention creating a PTR record.
-A, --address=/<domain>/[domain/]<ipaddr>
Specify an IP address to return for any host in the given domains.
Queries in the domains are never forwarded and always replied to with
the specified IP address which may be IPv4 or IPv6.
Since you are prevented from modifying the /etc/hosts file or creating any additional hosts, the following may not apply to your situation; but I consider them useful and related. These two options allow defining hosts outside of the normal /etc/hosts and the dnsmasq config.
-H, --addn-hosts=<file>
Additional hosts file. Read the specified file as well as /etc/hosts.
If -h is given, read only the specified file. This option may be repeated for
more than one additional hosts file. If a directory is given, then
read all the files contained in that directory.
--hostsdir=<path>
Read all the hosts files contained in the directory. New or changed files are
read automatically. See --dhcp-hostsdir for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With