[Dnsmasq-discuss] Source IP address of forwarded DNS queries

Chris Novakovic chris at chrisn.me.uk
Tue Sep 5 18:03:46 BST 2017


On 05/09/2017 10:00, Steffen Heil (Mailinglisten) wrote:
> We are using dnsmasq as a dns proxy. We serve some local entries but most entries are forwarded to another dns server.
> Is there a way to specify the ip address the outgoing (forwarded) dns requests are send with?

The --server option makes this possible. From the dnsmasq man page:

> -S, --local, --server=[/[<domain>]/[domain/]][<ipaddr>[#<port>][@<source-ip>|<interface>[#<port>]]
> 
> The optional string after the @ character tells dnsmasq how to set the source of the queries to this nameserver. It can either be an ip-address, an interface name or both. The ip-address should belong to the machine on which dnsmasq is running, otherwise this server line will be logged and then ignored. If an interface name is given, then queries to the server will be forced via that interface; if an ip-address is given then the source address of the queries will be set to that address; and if both are given then a combination of ip-address and interface name will be used to steer requests to the server.

You'll have to reorganise your dnsmasq configuration so that all queries
are sent to an upstream server defined with --server rather than relying
on servers that dnsmasq finds in resolv.conf (or equivalent), though.



More information about the Dnsmasq-discuss mailing list