Forwarding DNS request with source IP

Please follow the below template, it will help us to help you!

If you are Experiencing issues with a Pi-hole install that has non-standard elements (e.g you are using nginx instead of lighttpd, or there is some other aspect of your install that is customised) - please use the Community Help category.

Expected Behaviour:

Forwading DNS works perfectly, but behind, I can only see the pihole IP (which is the expected behaviour), but I was wondering if there is a way to forward the IP source of the request

Actual Behaviour:

as expected : behind pihole, all request are seen from pihole, without original source IP.

I was just wondering if there is a way to forward with original IP information ?


For instance, to be able to see IP like in this flow

Yes it's possible. Pi-hole uses dnsmasq internally. You can add a config file like /etc/dnsmasq.d/99-forward-ip.conf and add the line add-subnet=32
This will include the full IPv4 address of the original client in the EDNS(0) data. See

https://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

Please note: you need a upstream dns server (in your case at your router) that can process these data,

Awesome.

I was searching for an option like this on the web interface ..
Ok for adding a conf file. is there any command to sens to reload dnsmak configuration files ?

(systemctl reload or something like this ?)

Many thanks. great and clear answer in no time .. awesome

pihole restartdns

Thanks.

I still can't see original IP.. I'll check this out as , according to dnsmask man, it should work.
Have to check on the upstream DNS configuration files.

What upstream DNS server are you running on your router?

Basically, it's on a proxmox server with my previous adguard home DNS coupled with a pfsense, and I am inserting pihole in between

devices > "new pihole" > adguard > pfsense

how tricky it is isn't it ?

Adguard does no use the information yet according to

1 Like

I should probably insert pihole between adguard and pfsense. (as i saw that adguard is also able to forward subnet

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.