This is a way to force the VPN to use dnsmasq and prevent DNS leaks. It should actually be faster than using 'Exclusive' mode since you now have dnsmasq caching available. But now, your WAN clients are also using your VPN DNS servers, and this may make it appear as if your WAN clients are slower. In most cases, your ISP servers will give the best overall performance.
I am close to releasing my Selective Routing script to the community and came across this issue again in my testing. Glad that it hit the forums again so I am not the only one making noise.
If routing ALL TRAFFIC thru the VPN client AND Accept DNS Configuration is set to Exclusive, dnsmasq is not bypassed and AB-Solution works.
For VPN Policy Rule users who use AB-Solution, dnsmasq is bypassed when using Policy Rules and Accept DNS Configuration = Exclusive. My x3mtek work around method is to set Accept DNS Configuration = Strict and in the Custom Config section, add "dhcp-option DNS some.dns.ip.address e.g.
dhcp-option DNS 9.9.9.9. However, DNS will now leak.
Please tell me more about your method to force VPN to use dnsmasq and prevent DNS leaks. I am looking into unbound as a solution. I use unbound to send all DNS queries for WAN and VPN clients on pfSense but have not been successful in duplicating on Asuswrt-Merlin. More testing is needed.
In my scripts, I am routing individual LAN clients to a tunnel using the ip rule command:
Code:
ip rule add from "$IP" table 112 prior $count
AB-Solution works fine if using my work around method. But DNS leaks. The DNS leak does not appear to cause any issues with using geo restricted sites.
In my testing yesterday, I realize I need to detect if someone has Accept DNS Configuration to Exclusive. If so, I need to duplicate what Asuswrt-Merlin is doing for DNS by issuing the command:
iptables -t nat -A DNSVPN1 -s "$IP" -j DNAT --to-destination 10.9.0.1 (where DNSVPN1 is changed to the appropriate VPN tunnel depending on the tunnel assigned to the lan client). But this will result in dnsmasq being bypassed and ABS not working.
Code:
old_IFS="$IFS"
IFS=" "
while IFS=" " read -r iface ip description
do
case "$iface" in
1) iptables -t nat -A DNSVPN1 -s "$ip" -j DNAT --to-destination 10.9.0.1 ;;
2) iptables -t nat -A DNSVPN2 -s "$ip" -j DNAT --to-destination 10.9.0.1 ;;
3) iptables -t nat -A DNSVPN3 -s "$ip" -j DNAT --to-destination 10.9.0.1 ;;
4) iptables -t nat -A DNSVPN4 -s "$ip" -j DNAT --to-destination 10.9.0.1 ;;
5) iptables -t nat -A DNSVPN5 -s "$ip" -j DNAT --to-destination 10.9.0.1 ;;
esac
done < /jffs/configs/x3mRouting_rules
IFS=$old_IFS