I changed from vpnbypass to vpn-policy-routing.
It doesn’t work at the moment.
By default, there was only the VPN Interface available.
So I defined the supported interfaces manually over LUCI GUI.
tun0 and br-lan.
The package recognized this change and VyprVPN and LAN are now available in routing policies.
For testing purposes I tried to route the domain wieistmeineip.de to the LAN interface.
But it doesn’t work.
With vpnbypass I had to wait about one hour and then my changes took effect.
With vpn-policy-routing it,doesn’t work even after waiting for a couple of hours...
root@OpenWrt:~# iptables-save -c -t mangle
# Generated by iptables-save v1.8.3 on Sat Jan 2 15:22:03 2021
*mangle
:PREROUTING ACCEPT [309143:287931467]
:INPUT ACCEPT [129430:142739570]
:FORWARD ACCEPT [166603:136153409]
:OUTPUT ACCEPT [64378:22533462]
:POSTROUTING ACCEPT [230975:158686175]
:VPR_FORWARD - [0:0]
:VPR_INPUT - [0:0]
:VPR_OUTPUT - [0:0]
:VPR_PREROUTING - [0:0]
[309259:287996485] -A PREROUTING -m mark --mark 0x0/0xff0000 -j VPR_PREROUTING
[129482:142773624] -A INPUT -m mark --mark 0x0/0xff0000 -j VPR_INPUT
[499:32691] -A FORWARD -o tun0 -p tcp -m tcp --tcp-flags SYN,RST SYN -m comment --comment "!fw3: Zone VyprVPN MTU fixing" -j TCPMSS --clamp-mss-to-pmtu
[490:29372] -A FORWARD -i tun0 -p tcp -m tcp --tcp-flags SYN,RST SYN -m comment --comment "!fw3: Zone VyprVPN MTU fixing" -j TCPMSS --clamp-mss-to-pmtu
[166662:136177965] -A FORWARD -m mark --mark 0x0/0xff0000 -j VPR_FORWARD
[64428:22541029] -A OUTPUT -m mark --mark 0x0/0xff0000 -j VPR_OUTPUT
[0:0] -A VPR_FORWARD -m set --match-set VyprVPN dst -j MARK --set-xmark 0x20000/0xff0000
[0:0] -A VPR_FORWARD -m set --match-set lan dst -j MARK --set-xmark 0x10000/0xff0000
[0:0] -A VPR_INPUT -m set --match-set VyprVPN dst -j MARK --set-xmark 0x20000/0xff0000
[0:0] -A VPR_INPUT -m set --match-set lan dst -j MARK --set-xmark 0x10000/0xff0000
[0:0] -A VPR_OUTPUT -m set --match-set VyprVPN dst -j MARK --set-xmark 0x20000/0xff0000
[0:0] -A VPR_OUTPUT -m set --match-set lan dst -j MARK --set-xmark 0x10000/0xff0000
[0:0] -A VPR_PREROUTING -m set --match-set VyprVPN dst -j MARK --set-xmark 0x20000/0xff0000
[0:0] -A VPR_PREROUTING -m set --match-set lan dst -j MARK --set-xmark 0x10000/0xff0000
COMMIT
# Completed on Sat Jan 2 15:22:03 2021
root@OpenWrt:~#
When using the dnsmasq.ipset option, please make sure to flush the DNS cache of the local devices, otherwise domain policies may not work until you do. If you’re not sure how to flush the DNS cache (or if the device/OS doesn’t offer an option to flush its DNS cache), reboot your local devices when starting to use the service and/or when connecting data-capable device to your WiFi.
Because the ipset command only adds a first resolved IP address of the domain on add, if the domain name is encountered as the dest_addr option of the policy (with no other fields set for the policy), it will be attempted to be added as dnsmasq.ipset (if resolver_ipset is set to dnsmasq.ipset), otherwise, the domain name will be resolved when the service starts up and the resolved IP addresses added as either ipset (if enabled) or iptables rules. Resolving a number of domains on start is a time consuming operation, that’s why the use of dnsmasq.ipset value for resolver_ipset options is a preferred scenario.
root@OpenWrt:~# iptables-save -c -t mangle
# Generated by iptables-save v1.8.3 on Sat Jan 2 20:23:58 2021
*mangle
:PREROUTING ACCEPT [64501:44992196]
:INPUT ACCEPT [27482:20638411]
:FORWARD ACCEPT [30558:20044239]
:OUTPUT ACCEPT [21291:6405613]
:POSTROUTING ACCEPT [51823:26448788]
:VPR_FORWARD - [0:0]
:VPR_INPUT - [0:0]
:VPR_OUTPUT - [0:0]
:VPR_PREROUTING - [0:0]
[64504:44992904] -A PREROUTING -m mark --mark 0x0/0xff0000 -j VPR_PREROUTING
[27483:20638463] -A INPUT -m mark --mark 0x0/0xff0000 -j VPR_INPUT
[30558:20044239] -A FORWARD -m mark --mark 0x0/0xff0000 -j VPR_FORWARD
[263:16840] -A FORWARD -o tun0 -p tcp -m tcp --tcp-flags SYN,RST SYN -m comment --comment "!fw3: Zone VyprVPN MTU fixing" -j TCPMSS --clamp-mss-to-pmtu
[267:15984] -A FORWARD -i tun0 -p tcp -m tcp --tcp-flags SYN,RST SYN -m comment --comment "!fw3: Zone VyprVPN MTU fixing" -j TCPMSS --clamp-mss-to-pmtu
[21292:6405665] -A OUTPUT -m mark --mark 0x0/0xff0000 -j VPR_OUTPUT
[0:0] -A VPR_FORWARD -m set --match-set VyprVPN dst -j MARK --set-xmark 0x20000/0xff0000
[0:0] -A VPR_FORWARD -m set --match-set lan dst -j MARK --set-xmark 0x10000/0xff0000
[0:0] -A VPR_INPUT -m set --match-set VyprVPN dst -j MARK --set-xmark 0x20000/0xff0000
[0:0] -A VPR_INPUT -m set --match-set lan dst -j MARK --set-xmark 0x10000/0xff0000
[0:0] -A VPR_OUTPUT -m set --match-set VyprVPN dst -j MARK --set-xmark 0x20000/0xff0000
[0:0] -A VPR_OUTPUT -m set --match-set lan dst -j MARK --set-xmark 0x10000/0xff0000
[0:0] -A VPR_PREROUTING -m set --match-set VyprVPN dst -j MARK --set-xmark 0x20000/0xff0000
[0:0] -A VPR_PREROUTING -m set --match-set lan dst -j MARK --set-xmark 0x10000/0xff0000
COMMIT
# Completed on Sat Jan 2 20:23:58 2021
root@OpenWrt:~#
Creating table 'lan/br-lan/192.168.1.1' [✓]
Creating table 'VyprVPN/tun0/10.2.23.21' [✓]
Routing 'Test' via lan [✓]
vpn-policy-routing 0.2.1-13 started with gateways:
lan/br-lan/192.168.1.1
VyprVPN/tun0/10.2.23.21 [✓]
vpn-policy-routing 0.2.1-13 monitoring interfaces: lan VyprVPN .
I don't know if it matters, but I use stubby with two custom DNS Servers and DNS over TLS with port-forwarding from port 53 to port 5453...
For installation I did this...
uci add_list dhcp.@dnsmasq[-1].server='127.0.0.1#5453'
uci set dhcp.@dnsmasq[-1].noresolv=1
uci commit && reload_config
uci set network.wan.peerdns='0'
uci set network.wan.dns='127.0.0.1'
uci set network.wan6.peerdns='0'
uci set network.wan6.dns='0::1'
uci commit && reload_config
I just gave it a try and it works fine.
A couple of things to point out.
The actual site that shows your IP is www.wieistmeineip.de and has different IP than wieistmeineip.de
It also has IPv6, which by default has priority over IPv4, in case your systems got it.
The only thing that changes if I set noresolv=0 is that these two sections:
using local addresses only for ...
using standard name servers for ...
shows up twice in the sys log
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: started, version 2.80 cachesize 150
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: DNS service limited to local subnets
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC no-ID loop-detect inotify dumpfile
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: DNSSEC validation enabled
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: configured with trust anchor for <root> keytag 20326
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: configured with trust anchor for <root> keytag 19036
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using local addresses only for domain test
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using local addresses only for domain onion
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using local addresses only for domain localhost
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using local addresses only for domain local
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using local addresses only for domain invalid
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using local addresses only for domain bind
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain clients4.google.com
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain clients2.google.com
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain video-stats.l.google.com
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain s.youtube.com
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain s.mzstatic.com
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain itunes.apple.com
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain appleid.apple.com
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain com.apple.systempreferences
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using nameserver 127.0.0.1#5453
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using local addresses only for domain lan
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: reading /tmp/resolv.conf.auto
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using local addresses only for domain test
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using local addresses only for domain onion
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using local addresses only for domain localhost
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using local addresses only for domain local
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using local addresses only for domain invalid
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using local addresses only for domain bind
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain clients4.google.com
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain clients2.google.com
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain video-stats.l.google.com
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain s.youtube.com
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain s.mzstatic.com
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain itunes.apple.com
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain appleid.apple.com
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using standard nameservers for domain com.apple.systempreferences
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using nameserver 127.0.0.1#5453
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: using local addresses only for domain lan
Sat Jan 2 23:41:15 2021 daemon.warn dnsmasq[30929]: ignoring nameserver 192.168.1.2 - local interface
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: read /etc/hosts - 4 addresses
Sat Jan 2 23:41:15 2021 daemon.info dnsmasq[30929]: read /tmp/hosts/odhcpd - 3 addresses
Sat Jan 2 23:41:15 2021 daemon.err dnsmasq[30929]: failed to load names from /tmp/hosts/dhcp.cfg01411c: Permission denied
Sat Jan 2 23:41:22 2021 daemon.err modprobe: xt_set is already loaded
Sat Jan 2 23:41:22 2021 daemon.err modprobe: ip_set is already loaded
Sat Jan 2 23:41:22 2021 daemon.err modprobe: ip_set_hash_ip is already loaded
Sat Jan 2 23:41:23 2021 user.notice vpn-policy-routing [30938]: Creating table 'lan/br-lan/192.168.1.1' [✓]
Sat Jan 2 23:41:23 2021 user.notice vpn-policy-routing [30938]: Creating table 'VyprVPN/tun0/10.2.23.45' [✓]
Sat Jan 2 23:41:23 2021 user.notice vpn-policy-routing [30938]: Routing 'Test' via lan [✓]
Sat Jan 2 23:41:23 2021 user.notice vpn-policy-routing [30938]: service started with gateways: lan/br-lan/192.168.1.1 VyprVPN/tun0/10.2.23.45 [✓]
Sat Jan 2 23:41:23 2021 user.notice vpn-policy-routing [30938]: service monitoring interfaces: lan VyprVPN .
root@OpenWrt:~# ipset list
Name: lan
Type: hash:net
Revision: 6
Header: family inet hashsize 1024 maxelem 65536 comment
Size in memory: 344
References: 4
Number of entries: 0
Members:
Name: VyprVPN
Type: hash:net
Revision: 6
Header: family inet hashsize 1024 maxelem 65536 comment
Size in memory: 344
References: 4
Number of entries: 0
Members:
root@OpenWrt:~#
Hmmm... seems to have no entry at all...
Can that be significant?
Sun Jan 3 00:23:57 2021 daemon.err modprobe: xt_set is already loaded
Sun Jan 3 00:23:57 2021 daemon.err modprobe: ip_set is already loaded
Sun Jan 3 00:23:58 2021 daemon.err modprobe: ip_set_hash_ip is already loaded
It shows up every time I restart the package...
Sun Jan 3 00:29:14 2021 daemon.err modprobe: xt_set is already loaded
Sun Jan 3 00:29:14 2021 daemon.err modprobe: ip_set is already loaded
Sun Jan 3 00:29:14 2021 daemon.err modprobe: ip_set_hash_ip is already loaded
Sun Jan 3 00:29:14 2021 user.notice vpn-policy-routing [8916]: Creating table 'lan/br-lan/192.168.1.1' [✓]
Sun Jan 3 00:29:14 2021 user.notice vpn-policy-routing [8916]: Creating table 'VyprVPN/tun0/10.2.23.46' [✓]
Sun Jan 3 00:29:15 2021 user.notice vpn-policy-routing [8916]: Routing 'meineip2' via lan [✓]
Sun Jan 3 00:29:16 2021 user.notice vpn-policy-routing [8916]: Routing 'meineip' via lan [✓]
You can ignore the modprobe errors. It's not good that there are no entries in the ipset. Did you restart the services of vpn-pbr, dnsmasq, and flushed the dns caches?
I tried to adapt your configuration in my router and it is still working.
[0:0] -A VPR_OUTPUT -d 52.29.79.39/32 -m comment --comment meineip_wieistmeineip_de -j MARK --set-xmark 0x30000/0xff0000
[0:0] -A VPR_OUTPUT -d 52.29.58.77/32 -m comment --comment meineip2_www_wieistmeineip_de -j MARK --set-xmark 0x30000/0xff0000
[59:5538] -A VPR_OUTPUT -d 35.157.134.147/32 -m comment --comment meineip2_www_wieistmeineip_de -j MARK --set-xmark 0x30000/0xff0000
[0:0] -A VPR_OUTPUT -d 52.28.125.65/32 -m comment --comment meineip2_www_wieistmeineip_de -j MARK --set-xmark 0x30000/0xff0000
Okay. See you tomorrow.
It tried it again, copy and paste my working config. Restart vpn-policy-routing and dnsmasq. It works. 2 minutes later it stopped working... Nothing visible in syslog.
Possibly something overrides the ip set.