More than one "Conditional Forwarding" entry in the GUI



Hi all,

while I understand that in most cases one “Conditional Forwarding” rule is sufficient, there are situations where you’d want more than one entry. In the “Upstream DNS Servers” section above you can enter multiple servers, it would be nice to have multiple “Conditional Forwarding” entries as well.



Could you give an example of how or when this would be used and why it would be helpful?


When forwarding to a Ubiquiti USG, then the localdomain forwarding like


is not enough. There are also rules like


necessary to resolve UBNT internal names. Currently I’m doing this with a /etc/dnsmasq.d/05-custom.conf and everything is well, I just thought that adding additional fields to the GUI would be nicer.


Hi sbellon and jfb,

Same problem here. I’d like several “Conditional Forwarding” as I’ve got my local LAN (, my Google WiFi Mesh ( and two VPN Servers ( and which all use my Pi-Hole on Raspi with LAN and WiFi to filter DNS. It is

server=/testwifi/ # Google WiFi
server=/lan/ # Local LAN
server=/openvpn1/ # VPN1
server=/openvpn2/ # VPN2

I’d do it also through the config files if its possible?


Config files works perfectly, as mentioned in my post.

High availability (HA) for Pi-hole (running two Pi-hole's)

-S, --local, --server=[/[]/[domain/]][[#][@|[#]]
Specify IP address of upstream servers directly. Setting this flag does not suppress reading of /etc/resolv.conf, use -R to do that. If one or more optional domains are given, that server is used only for those domains and they are queried only using the specified server. This is intended for private nameservers: if you have a nameserver on your network which deals with names of the form at then giving the flag -S / will send all queries for internal machines to that nameserver, everything else will go to the servers in /etc/resolv.conf. DNSSEC validation is turned off for such private nameservers, UNLESS a --trust-anchor is specified for the domain in question. An empty domain specification, // has the special meaning of “unqualified names only” ie names without any dots in them. A non-standard port may be specified as part of the IP address using a # character. More than one -S flag is allowed, with repeated domain or ipaddr parts as required.

More specific domains take precedence over less specific domains, so: --server=/ --server=/ will send queries for * to, except *, which will go to

The special server address ‘#’ means, “use the standard servers”, so --server=/ --server=/ will send queries for * to, except * which will be forwarded as usual.

So using the # on the same line is wrong.



@msatter and @sbellon thanks a lot, works like a charm :slight_smile:


Do you understand what wrong with your initial setup after reading the DNSmasq manual section?


@msatter thanks again, yes, I messed up my config file with the hash signs as if comments…


@jfb Another real world use case would be for local domains that span multiple subnets. When you configure conditional forwarding, it assumes the reverse lookup subnet based on your configured router IP. In mycase i’m just using “local” but i’m using it on 3 different subnets/vlans.

I’ve had to create a custom file like @msatter but just with additional reverse zones:

 pi@ns01:~ $ cat /etc/dnsmasq.d/02-custom.conf


Adding more and more features that will only be used by a few experts out there seems to be not a good idea. Each new feature can bring new issues along and the more complex the entire system becomes, the more complicated and possibly less straightforward the interface becomes for the arbitrary user.

We deliberately allow experienced users to configure anything they want by placing custom configuration files into /etc/dnsmasq.d/. This allows for a much greater flexibility than could ever be possible with a GUI.

split this topic #14

A post was split to a new topic: Conditional forwarding help


What is the maximum number of entries for conditional forwarders?

I have tried to define more than 20 and it has not worked.
Is there a limit?


I’m not aware of a limit. Please post the exact error message you got and ideally also the lines you added and we can work from there.