Conditional Forwarding with ports


#1

Hi,

i’m running a bind server for local dns requests and a samba ad on the same machine as pihole.
A the moment, after every update i have to readd the conditional forwarding in the dnsmasq config for the server.
Can you add parameter for a port in the conditional forwarding option.


#2

In what folder does this dnsmasq configuration file reside?


#3

Sorry my post was uncomplete, but my smartphone had a connection problem.

The dnsmasq option for conditional forwarding can add to the /etc/dnsmasq.conf or in every config file in /etc/dnsmasq.d/ like the 01-pihole.conf
pihole recreate after every update the dnsmasq config with the configuration from the webgui or pihole config.
So it overwrites all dnsmasq files.
the pihole webgui has a option to add conditional forwarding, but only the ability to add a ip, not a additional port. So after every update i had to add the port parameter to the conditional forwarding line in /etc/dnsmasq.d/01-pihole.conf

server=/testme/192.168.0.1
server=/0.168.192.in-addr.arpa/192.168.0.1
to
server=/testme/192.168.0.1#54
server=/0.168.192.in-addr.arpa/192.168.0.1#54


#6

This is not quite the case. Pi-Hole does not overwrite files in /etc/dnsmasq.d other than the file it installs (01-pihole.conf).

Since dnsmasq (as specified in /etc/dnsmasq.conf) uses the entire directory /etc/dnsmasq.d as a source for configuration files, make a new file in this directory with your conditional forwarding configuration.

Note the following section of file /etc/dnsmasq.d/01-pihole.conf

###############################################################################
#      FILE AUTOMATICALLY POPULATED BY PI-HOLE INSTALL/UPDATE PROCEDURE.      #
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
#                                                                             #
#        IF YOU WISH TO CHANGE THE UPSTREAM SERVERS, CHANGE THEM IN:          #
#                      /etc/pihole/setupVars.conf                             #
#                                                                             #
#        ANY OTHER CHANGES SHOULD BE MADE IN A SEPARATE CONFIG FILE           #
#                    WITHIN /etc/dnsmasq.d/yourname.conf                      #
############################################################################