IPFW FreeBSD Gateway: Redirecting Internal Host DNS Requests to LAN Interface Port 53

Hello everyone,

I'm a FreeBSD beginner and I've been working on setting up a FreeBSD machine as a gateway with Unbound for DNS resolution. My current setup includes:

WAN Interface: em0 with IP address 10.8.8.11
LAN Interface: em1 with IP address 192.168.40.1

I have successfully implemented NAT according to the man pages, but I'm struggling with redirecting internal host DNS requests to port 53 on the FreeBSD gateway's LAN interface (em1). This would allow me to handle DNS queries locally using Unbound.

Could someone please provide guidance on how to configure ipfw rules to achieve this redirection? Any additional tips or best practices for ensuring optimal performance and security would also be greatly appreciated.
 
You can do this only for standard port 53. The request that required encryption will fail (port 853) also the clients which use DNS over HTTPS can easy skip your local DNS redirect. The better option is to use DHCP and set the DNS server on the clients to your host at 192.168.40.1 instead of trying to redirect all requests to your IP.
 
Back
Top