[Dnsmasq-discuss] Using a variable in the address option in dnsmasq.conf
Petr Menšík
pemensik at redhat.com
Fri Mar 2 12:46:06 GMT 2018
You can use any script to generate those addresses into separate file.
Dnsmasq is very low overhead server without real built-in scripting for
these things. It already contains lua interpreter, but I think such
features should be left to external scripts instead.
You can already use:
conf-dir=/etc/dnsmasq.d
and then generate your file any way you need. For example in bash
echo "# Autogenerated file, do not edit by hand" >
/etc/dnsmasq.d/blocked.conf
for DOMAIN in 2o7.net 2mdm.net
do echo "address=/$DOMAIN/$MYIP" >> /etc/dnsmasq.d/blocked.conf
done
I think this is simple enough for any reasonable use. Why should dnsmasq
have it built-in?
Dne 20.2.2018 v 08:44 M. Buecher napsal(a):
> On 2018-02-19 21:28, Steve Lloyd wrote:
>
>> Is it possilbe to set a variable and then use it as follows? or is
>> there a way to set and use a variable in the conf file for address
>> entries?
>>
>> myip=10.0.1.6
>> address=/2o7.net/$myip <http://2o7.net/$myip>
>> address=/2mdm.net/$myip <http://2mdm.net/$myip>
>>
>> instead of
>> address=/2o7.net/10.0.1.6 <http://2o7.net/10.0.1.6>
>> address=/2mdm.net/10.0.1.6 <http://2mdm.net/10.0.1.6>
>>
>
> +1 for such a feature as this would easy my playground setup a lot, in
> my case:
> dhcp-host=aa:bb:cc:dd:ee:ff,${NETWORK4NET1PREFIX}.27,[${NETWORK6ULA1PREFIX}::1b],my-host
>
>
>
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
--
Petr Menšík
Software Engineer
Red Hat, http://www.redhat.com/
email: pemensik at redhat.com PGP: 65C6C973
More information about the Dnsmasq-discuss
mailing list