You should note that TrueNAS is not supported by Pi-hole - specifically, the Pi-hole team does not develop nor endorse a TrueNAS Pi-hole app that some users have reported to use.
If that TrueNAS Pi-hole app is just a wrapper around Pi-hole's official Docker image, then it should run, provided the container is configured correctly.
In your case, the container that your Pi-hole is running in is attached exclusively to a 172.16.2.0/2
4 network:
*** [ DIAGNOSING ]: Network interfaces and addresses
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
54: eth0@if55: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether <redacted> brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 172.16.2.2/24 brd 172.16.2.255 scope global eth0
valid_lft forever preferred_lft forever
Consequently, Pi-hole currently ignores DNS requests from your 192.168.4.0/16
network:
*** [ DIAGNOSING ]: Pi-hole diagnosis messages
count last timestamp type message
----- ------------------- ------------ ------------------------------------------------------------
1 2025-01-29 23:01:45 DNSMASQ_WARN ignoring query from non-local network 192.168.4.1 (logged on
ly once)
That message should also have been plainly visible in Pi-hole's web UI under Tools | Pi-hole diagnosis, with a marker drawing your attention to it, hinting at the cause for your issue.
As you've enabled Pi-hole's DHCP server, Pi-hole would process DNS requests of clients that have acquired their DHCP lease through Pi-hole (and thus have a 172.16.2.0/24 address).
To make Pi-hole also process those requests of foreign network origin, you could change Pi-hole's Interface settings to one of the potentially dangerous options.
But I'd recommend to reconsider your choice.
Commonly, you'd use your main network's range with Pi-hole's DHCP server, pointing its gateway to your router's IP.
You've created a separate subnet, using 172.16.2.1
as gateway, which looks like a Docker internal gateway IP. If it would be, that in turn would imply that only other Docker containers may be able to acquire a DHCP lease through Pi-hole.
Why is your Pi-hole's DHCP server offering a separate subnet?
And what's your intention of having Pi-hole run on a subnet different from your existing one?
Also, please share your docker compose or docker run script for starting your Pi-hole Docker container.