Kingp1n
Very Senior Member
0
I'm testing the swinson script again with Unbound & OPVN.
I have my VPNClient setup with DNS set to Disabled.
My ip rule shows:
	
	
	
		
iptables command shows:
	
	
	
		
All looks good so far. However, when I run the ipleak test, I see my VPN IP but my DNS shows as WAN IP.
Is this how is supposed to work now?
The reason I asked, it's because prior to VPN Director on the new fw, when using unbound with this script, the VPN IP & DNS would be the same (with DNS configuration set to "disabled").
It seems after I updated, it no longer shows both VPN IP & DNS when set to disabled. Unless I have something screwed up with my setup (which may very well be the case) haha
Just trying to confirm.
				
			I appreciate the info.Sure. I renamed the file to unbound_via_wg11.sh and make it executable.
Code:#!/bin/sh Check_wg11_Con() { ping -c1 -w1 -I wg11 1.1.1.1 } Delete_Rules() { ip rule del prio 9905 2>/dev/null iptables-save | grep "unbound_rule" | sed 's/^-A/iptables -t mangle -D/' | while read CMD;do $CMD;done } Add_Rules() { ip rule add from 0/0 fwmark 0xd1/0xd1 lookup 121 prio 9905 iptables -t mangle -A OUTPUT -d "${wan0_dns##*.*.*.* }"/32 -p udp --dport 53 -m comment --comment unbound_rule -j MARK --set-mark 0x8000/0x8000 iptables -t mangle -A OUTPUT -d "${wan0_dns%% *.*.*.*}"/32 -p udp --dport 53 -m comment --comment unbound_rule -j MARK --set-mark 0x8000/0x8000 iptables -t mangle -A OUTPUT -d "${wan0_dns##*.*.*.* }"/32 -p tcp --dport 53 -m comment --comment unbound_rule -j MARK --set-mark 0x8000/0x8000 iptables -t mangle -A OUTPUT -d "${wan0_dns%% *.*.*.*}"/32 -p tcp --dport 53 -m comment --comment unbound_rule -j MARK --set-mark 0x8000/0x8000 iptables -t mangle -A OUTPUT -p udp --dport 53 -m comment --comment unbound_rule -j MARK --set-mark 0xd1/0xd1 iptables -t mangle -A OUTPUT -p tcp --dport 53 -m comment --comment unbound_rule -j MARK --set-mark 0xd1/0xd1 } Poll_wg11() { timer=$1 [ "$timer" = "0" ] && Post_log "Error Timeout" && exit 1 || sleep 2 Check_wg11_Con && Add_Rules || Poll_wg11 "$((timer-1))" } Post_log() { $(logger -st "($(basename "$0"))" $$ "$1") } [ -z "$1" ] && Post_log "Script Arg Missing" && exit 1 || Post_log "Starting Script Execution" wan0_dns="$(nvram get wan0_dns)" Delete_Rules case "$1" in start) Poll_wg11 "120" && Post_log "Bind Unbound to wg11. Ending Script Execution" && exit 0;; stop) Post_log "Bind Unbound to WAN. Ending Script Execution" && exit 0;; *) Post_log "Script Arg Invalid" && exit 1;; esac
Add the start and stop option in wg11-route-up.sh and wg11-route-down.sh
In my case, I put it in /jffs/addons/wireguard/Scripts. You can put it in other directory like /jffs/scripts as well. Just make sure to put the correct path here.
Code:/jffs/addons/wireguard/Scripts/unbound_via_wg11.sh start & logger -t $(basename $0) "unbound bind to wg11"
Code:/jffs/addons/wireguard/Scripts/unbound_via_wg11.sh stop & logger -t $(basename $0) "unbound bind to WAN"
I'm testing the swinson script again with Unbound & OPVN.
I have my VPNClient setup with DNS set to Disabled.
My ip rule shows:
		Code:
	
	admin@GT-AX11000-xxxx:/tmp/home/root# ip rule
0:    from all lookup local
9990:    from all fwmark 0x8000/0x8000 lookup main
9995:    from all fwmark 0x1000/0x1000 lookup ovpnc1
10010:    from 192.168.1.1/27 lookup main
10210:    from 192.168.1.0/24 lookup ovpnc1
32766:    from all lookup main
32767:    from all lookup default
	iptables command shows:
		Code:
	
	admin@GT-AX11000-xxxx:/tmp/home/root# iptables -nvL OUTPUT -t mangle
Chain OUTPUT (policy ACCEPT 26328 packets, 5915K bytes)
pkts bytes target     prot opt in     out     source               destination      
2766  216K MARK       udp  --  *      eth0    0.0.0.0/0            0.0.0.0/0            multiport dports 53,123 MARK xset 0x4009ffff/0xc03fffff
    0     0 MARK       tcp  --  *      eth0    0.0.0.0/0            0.0.0.0/0            multiport dports 53,853 MARK xset 0x4009ffff/0xc03fffff
12407 4900K MARK       udp  --  *      eth0    0.0.0.0/0            0.0.0.0/0            multiport dports  !53,123 MARK xset 0x4003ffff/0xc03fffff
3987  368K MARK       tcp  --  *      eth0    0.0.0.0/0            0.0.0.0/0            multiport dports  !53,853 MARK xset 0x4003ffff/0xc03fffff
    0     0 MARK       udp  --  *      *       0.0.0.0/0            149.112.112.112      udp dpt:53 /* unbound_rule */ MARK or 0x8000
    8   568 MARK       udp  --  *      *       0.0.0.0/0            9.9.9.9              udp dpt:53 /* unbound_rule */ MARK or 0x8000
    0     0 MARK       tcp  --  *      *       0.0.0.0/0            149.112.112.112      tcp dpt:53 /* unbound_rule */ MARK or 0x8000
    0     0 MARK       tcp  --  *      *       0.0.0.0/0            9.9.9.9              tcp dpt:53 /* unbound_rule */ MARK or 0x8000
    0     0 MARK       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:53 /* unbound_rule */ MARK or 0x1000
  278 24825 MARK       udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:53 /* unbound_rule */ MARK or 0x1000
	All looks good so far. However, when I run the ipleak test, I see my VPN IP but my DNS shows as WAN IP.
Is this how is supposed to work now?
The reason I asked, it's because prior to VPN Director on the new fw, when using unbound with this script, the VPN IP & DNS would be the same (with DNS configuration set to "disabled").
It seems after I updated, it no longer shows both VPN IP & DNS when set to disabled. Unless I have something screwed up with my setup (which may very well be the case) haha
Just trying to confirm.
	