I am trying to recreate a rule that I have previously used with iptables in Linux. I would like the firewall to take outbound DNS requests and redirect them to the DNS server of my choosing. I am learning pf and cannot recreate this functionality.
I do realize that the alternative way to do this is to just the DNS on host machines to 8.8.8.8, but that is not my goal.
In iptables I had a rule like this:
In pf my attempts were:
#1 the firewall in this example is just a test machine, so this machine itself is making the dns requests. ue0 is the firewall host.
#2 more generic
I ran
Questions
1. Am I simply using an incorrect rule? Does pf have what is equivalent to the PREROUTING when it comes to rules?
2. Is there an equivalent to
I do realize that the alternative way to do this is to just the DNS on host machines to 8.8.8.8, but that is not my goal.
In iptables I had a rule like this:
Code:
iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 8.8.8.8
In pf my attempts were:
#1 the firewall in this example is just a test machine, so this machine itself is making the dns requests. ue0 is the firewall host.
Code:
rdr on ue0 proto udp from ue0 to port 53 -> 8.8.8.8 port 53
Code:
rdr proto udp to port 53 -> 8.8.8.8 53
I ran
tcpdump -i ue0 -n port 53 to monitor DNS traffic as I did queries using host somewebsite.com. Unfortunately DNS request are not being redirected to 8.8.8.8 as they do on my Linux/iptables setup.Questions
1. Am I simply using an incorrect rule? Does pf have what is equivalent to the PREROUTING when it comes to rules?
2. Is there an equivalent to
iptables -nvL for pf that would let me monitor my rules and get a numbered increment when my rule is actually being matched and used?