Discussion:
[Dnsmasq-discuss] How to conditionally forward a query based on the source IP?
Wojtek Swiatek
2016-06-12 14:45:17 UTC
Permalink
Hello

I am trying to find a way to forward a DNS request to a specifc DNS server,
based on the IP address of the requesting host.

In other words I would like dnsmasq to forward (as an example) queries from
the host 10.10.10.1's to DNS server 8.8.8.8 and when the query comes from
any another host - to 8.8.4.4.

Is this something achievable with dnsmasq? (I found a way to do it based on
the target domain, but this is not what I am looking for).

Thank you for any help!
/dev/rob0
2016-06-17 12:55:35 UTC
Permalink
Post by Wojtek Swiatek
I am trying to find a way to forward a DNS request to a specifc DNS
server, based on the IP address of the requesting host.
In other words I would like dnsmasq to forward (as an example)
queries from the host 10.10.10.1's to DNS server 8.8.8.8 and when
the query comes from any another host - to 8.8.4.4.
Is this something achievable with dnsmasq? (I found a way to do it
based on the target domain, but this is not what I am looking for).
This would be trivial to do in BIND, using view and acl features.[1]

However, even there, it sounds quite strange. Why do you need this?
If you're using dnsmasq in front of a BIND named with views, just go
straight to the named.

[1]
acl eight { 10.10.10.1; };
acl four { any; };

view eight {
match-clients { eight; };
forwarders { 8.8.8.8; };
};
view four {
match-clients { four; };
forwarders { 8.8.4.4; };
};
--
http://rob0.nodns4.us/
Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:
Loading...