I'm in the process of reworking my pf(4) rules and am tightening up blocking of LAN clients making their own DNS queries directly to Internet DNS servers, instead forcing them to use the resolver on my firewall.
I'm blocking all outgoing traffic from the LAN to port 853 (except from the firewall itself) and to known DNS-over-HTTPS servers on port 443, but instead of blocking outgoing plain-text DNS, I'm trying to redirect it to the resolver on the firewall.
I have these redirect rules:
(
The pf logs do show the redirect rules being triggered, but the DNS queries just time out and tcpdump shows no traffic on lo0.
If I change the redirect destination host from 127.0.0.1 to the IP addresses of the pf_internal member interfaces, as follows, then it works fine.
I've seen numerous examples of pf redirect rules redirecting to 127.0.0.1, so I'm puzzled why it's not working for me.
Anyone have any suggestions?
I'm blocking all outgoing traffic from the LAN to port 853 (except from the firewall itself) and to known DNS-over-HTTPS servers on port 443, but instead of blocking outgoing plain-text DNS, I'm trying to redirect it to the resolver on the firewall.
I have these redirect rules:
Code:
set skip on lo
...
# Don't redirect unencrypted DNS sent directly to local network resolver, but ...
no rdr on pf_internal inet proto { tcp, udp } to pf_internal port 53
no rdr on pf_internal inet6 proto { tcp, udp } to fe80::1 port 53
# ... do redirect queries sent to Internet DNS servers
rdr pass log on pf_internal inet proto { tcp, udp } to any port 53 -> 127.0.0.1
rdr pass log on pf_internal inet6 proto { tcp, udp } to any port 53 -> ::1
pf_internal is an interface group containing the interfaces connected to my internal networks, bridge0 and bridge1.)The pf logs do show the redirect rules being triggered, but the DNS queries just time out and tcpdump shows no traffic on lo0.
If I change the redirect destination host from 127.0.0.1 to the IP addresses of the pf_internal member interfaces, as follows, then it works fine.
Code:
# ... do redirect unencrypted DNS queries sent to Internet DNS servers to local resolver
rdr pass log on bridge0 inet proto { tcp, udp } to any port 53 -> 192.168.0.1
rdr pass log on bridge1 inet proto { tcp, udp } to any port 53 -> 10.0.0.1
rdr pass log on pf_internal inet6 proto { tcp, udp } to any port 53 -> fe80::1
I've seen numerous examples of pf redirect rules redirecting to 127.0.0.1, so I'm puzzled why it's not working for me.
Anyone have any suggestions?