Preventing dnsmasq from Creating AAAA Records for Hosts in DHCPv6 Dual-Stack Networks
Dnsmasq is a popular lightweight DNS, DHCP, and TFTP server that is often used in small networks. When using dnsmasq in a dual-stack network (i.e., a network that supports both IPv4 and IPv6), it is possible for dnsmasq to create AAAA records for internal hosts, even if IPv6 communication is not desired. This article will explain how to prevent dnsmasq from creating AAAA records for internal hosts in a dual-stack network.
Understanding DHCPv6 and AAAA Records
DHCPv6 (Dynamic Host Configuration Protocol for IPv6) is a protocol used to dynamically assign IPv6 addresses to hosts on a network. When a host connects to a network, it sends a DHCPv6 request to the DHCPv6 server, which responds with an IPv6 address and other network configuration information. One piece of information that can be included in the DHCPv6 response is a DNS (Domain Name System) server, which is used to translate domain names (such as
In IPv6, the DNS system uses AAAA records (quad-A records) to map domain names to IPv6 addresses. For example, a DNS server might have an AAAA record that maps the domain name
The Problem with dnsmasq Creating AAAA Records
When dnsmasq is used as a DHCPv6 server in a dual-stack network, it will automatically create AAAA records for internal hosts. This can be a problem if IPv6 communication is not desired, as it can result in unnecessary traffic and potential security issues. For example, if an internal host has an AAAA record, it may be possible for external hosts to communicate with it using IPv6, even if the internal network does not support IPv6.
Preventing dnsmasq from Creating AAAA Records
To prevent dnsmasq from creating AAAA records for internal hosts in a dual-stack network, you can use the following steps:
- Edit the dnsmasq configuration file (usually located at
/etc/dnsmasq.conf). - Add the following line to the configuration file:
dhcp-host=00:00:00:00:00:00,set:no-v6This line tells dnsmasq to add the host with the specified MAC address (
00:00:00:00:00:00in this example) to theno-v6tag. Theno-v6tag is used to specify that IPv6 should not be used for this host. - Add the following line to the configuration file:
addn-hosts=/etc/dnsmasq-hostsThis line tells dnsmasq to read additional hostnames and IP addresses from the file
/etc/dnsmasq-hosts. - Create the file
/etc/dnsmasq-hostsand add the following lines:192.168.1.100 hostname1 192.168.1.101 hostname2These lines specify the IPv4 addresses and hostnames for the internal hosts. Note that there are no AAAA records for these hosts.
- Restart the dnsmasq service to apply the changes.
Dnsmasq is a useful tool for providing DNS, DHCP, and DHCPv6 services in small networks. However, when used in a dual-stack network, it can create AAAA records for internal hosts, which can be a problem if IPv6 communication is not desired. By following the steps outlined in this article, you can prevent dnsmasq from creating AAAA records for internal hosts in a dual-stack network.