DNS Filtering for specific user

i've been build server for DNS Filtering and i want to forward my openwrt to my DNS server
i'm using the iptables for forwarding the port of DNS

iptables -t nat -A PREROUTING -p udp -s --dport 53 -j DNAT --to-destination xxx.xxx.xx.xx:xxx


Why are you using the firewall to assign a DNS server?

Just assign the server via DHCP, or on the client statically.

config host
	option ip ''
	option mac 'xx:xx:xx:xx:xx:xx'
	option name 'pc_dns_filtered'
	option dns '1'
	option tag 'filtered_dns'

config tag 'filtered_dns'
	list dhcp_option '6,,'

Also have a look at this: https://openwrt.org/docs/guide-user/firewall/fw3_configurations/forced_dns_redirection

1 Like

can i definied port on list dhcp_option?

Not there, but you can define in dnsmasq.

1 Like

i already trying this but still not working

when i define in dnsmasq, can i define for spesific user?

Yes, @lleachii explained it here.

with a spesific port of DNS Server?

As far as I know you cannot push the port of the NS via DHCP.

1 Like

My two cents: why don't you keep the OpenWrt router as a DNS, and configure the filtering DNS as an upstream DNS? Seems far easier than this.

1 Like