0 Kudos

Allow custom parameters for dnsmasq

Submitted by -
Status: New Idea

As detailed in this post I would propose a way to add custom parameters to the automatically generated dnsmasq configuration.

One use-case is the local DNS resolution of a machine with multiple interfaces with a single address.

A static mapping defined as such:

     static-mapping br0.sagittarius {
         ip-address 10.0.0.166
         mac-address <mac>
     }
     static-mapping eno1.sagittarius {
         ip-address 10.0.0.161
         mac-address <mac>
     }
     static-mapping eno2.sagittarius {
         ip-address 10.0.0.162
         mac-address <mac>
     }

currently requires both:

set service dns forwarding options cname=*.sagittarius.home,sagittarius.home

and:

set service dns forwarding options host-record=sagittarius.home,10.0.0.161
set service dns forwarding options host-record=sagittarius.home,10.0.0.162
set service dns forwarding options host-record=sagittarius.home,10.0.0.166

in order to resolve sagittarius.home in a round-robin manner.

However in the automatically generated dnsmasq.conf this could be amended:

###shared-network home

	#subnet 10.0.0.0/24
		dhcp-range=set:home,10.0.0.20,10.0.0.254,255.255.255.0,86400
		domain=home,10.0.0.0/24,local
		dhcp-option=tag:home,option:domain-name,home
		dhcp-option=tag:home,option:router,10.0.0.1
		dhcp-option=tag:home,option:dns-server,10.0.0.1

		#static reservations for subnet 10.0.0.0/24
		dhcp-host=<mac>,set:home,10.0.0.166	#br0.sagittarius
		host-record=br0.sagittarius.home,10.0.0.166,86400	#br0.sagittarius.home
		dhcp-host=<mac>,set:home,10.0.0.161	#eno1.sagittarius
		host-record=eno1.sagittarius.home,10.0.0.161,86400	#eno1.sagittarius.home
		dhcp-host=<mac>,set:home,10.0.0.162	#eno2.sagittarius
		host-record=eno2.sagittarius.home,10.0.0.162,86400	#eno2.sagittarius.home
	#end of subnet 10.0.0.0/24

###end of shared-network home

as host-record supports multiple name, and simply replacing the above lines with:

		host-record=br0.sagittarius.home,sagittarius.home,10.0.0.166,86400	#br0.sagittarius.home
		host-record=eno1.sagittarius.home,sagittarius.home,10.0.0.161,86400	#eno1.sagittarius.home
		host-record=eno2.sagittarius.home,sagittarius.home,10.0.0.162,86400	#eno2.sagittarius.home

would achieve the same result.

As far as I can understand the current static-mapping-parameters option is skipped for dnsmasq, however adding an option such as the following

set static-mapping eno1.sagittarius static-mapping-parameters host-record-san=sagittarius.home

to be considered in the perl script, could solve this issue.