How to configure Tor on OpenWrt to only handle DNS lookups (and nothing else) via the Tor network, often referred to as a Tor DNS transparent proxy? I found some outdated guides on the internet or these simple guides just doesn't worked for me. I'm using OpenWrt 24.10.0-rc6 on Bananapi BPI-R3.
Sure, this means that your router will route DNS queries through Tor, but other traffic (TCP/UDP web traffic, gaming, etc.) will not be forced through Tor.
Because my ISP use some kind of transparent proxy I couldn't bypass by any of these: DoH, DoT, DNSCrypt, 0DoH. On my phone (same ISP) I can use Orbot + Rethink to redirect all DNS lookups trough tor. Any other ways show me the same IPs on dnsleaktest.com (hosted-by.i3d.net. - all I know this is a service closely connected to Ubisoft).
...But now it's work, thank you for your answer.
..I wrote some content into /etc/tor/custom (but only two lines are enough):
# These lines are not needed
# AutomapHostsOnResolve 1
# AutomapHostsSuffixes .
# VirtualAddrNetworkIPv4 172.16.0.0/12
# VirtualAddrNetworkIPv6 [fc00::]/8
# DNSPort only (no TransPort)
DNSPort 0.0.0.0:9053
DNSPort [::]:9053
# (Optional) Logging:
Log notice file /var/log/tor/notices.log
...added this line to /etc/sysupgrade.conf : /etc/tor
...then, run these commands:
uci del_list tor.conf.tail_include="/etc/tor/custom"
uci add_list tor.conf.tail_include="/etc/tor/custom"
uci commit tor
service tor restart
# Stop dnsmasq while we set options
service dnsmasq stop
# Instruct dnsmasq not to use system resolv.conf
uci set dhcp.@dnsmasq[0].noresolv="1"
# Disabling rebind_protection can help with .onion or unusual hostnames
uci set dhcp.@dnsmasq[0].rebind_protection="0"
# Clear any existing server lines
uci -q delete dhcp.@dnsmasq[0].server
# Add Tor as upstream DNS (port 9053)
uci add_list dhcp.@dnsmasq[0].server="127.0.0.1#9053"
uci add_list dhcp.@dnsmasq[0].server="::1#9053"
uci add_list dhcp.@dnsmasq[0].server="/lan/192.168.1.1"
uci add_list dhcp.@dnsmasq[0].server="/168.192.in-addr.arpa/192.168.1.1"
uci commit dhcp
service dnsmasq start