My mistake - DNS is behaving as expected for both IPv4 and IPv6.Soo, if I'm reading this right clients seems to use dns properly but only for ipv4 data. Ipv6 data still goes out wan?
If that is correct, check rules in wgm:
and the resulting routing rules:Code:E: Option ==> peer wg11
And wg11 policy route table:Code:ip -6 rule
Code:ip -6 route show table 121
ip6tables -t nat -A WGDNS1 -s <LanIP6> -j DNAT --to-destination <RouterIp6>
E:Option ==> peer wg11
Client Auto IP Endpoint DNS MTU Public Private
Annotate
wg11 P 10.0.11.124/19, 2a0e:1c80:4:2000::b7d/64 nl1.wg.azirevpn.net:51820 10.50.60.1,fe80::aa5e:45ff:feae:50aa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyI= # N/A
Selective Routing RPDB rules
ID Peer Interface Source Destination Description
4 wg11 VPN fd36:7ef1:2add:aa88:100::1 Any Unbound6VPN
3 wg11 VPN 192.168.3.1 Any Unbound4VPN
2 wg11 VPN 10.50.60.150 Any Local PC
# ip -6 rule
0: from all lookup local
9911: from fd36:7ef1:2add:aa88:100::1 lookup 121
32766: from all lookup main
#ip -6 route show table 121
default dev wg11 metric 1024 pref medium
peer wg11 rule add vpn 2a02:c7f:xxxx:yyyy:6e12:d4fa:7179:cd62
peer wg11 rule add vpn src=2a02:c7f:xxxx:yyyy:6e12:d4fa:7179:cd62
Selective Routing RPDB rules
ID Peer Interface Source Destination Description
4 wg11 VPN fd36:7ef1:2add:aa88:100::1 Any Unbound6VPN
7 wg11 VPN Any 2a02:c7f:xxxx:yyyy:6e12:d4fa:7179:cd62
3 wg11 VPN 192.168.3.1 Any Unbound4VPN
2 wg11 VPN 10.50.60.150 Any Local PC
ip6tables -t mangle -I PREROUTING -m mac --mac-source <devicemac> -j MARK --set-mark 0x1000/0x1000
iptables -t mangle -I PREROUTING -m mac --mac-source <devicemac> -j MARK --set-mark 0x1000/0x1000
ip rule add from all fwmark 0x1000 table 121 prio 9900
ip -6 rule add from all fwmark 0x1000 table 121 prio 9900
echo 2 > /proc/sys/net/ipv4/conf/wg11/rp_filter
me to, but here I am.....dread they day I need to deal with IPv6…
You are doing it right, but wgm forces the change to destination for some reason. I tried it:Two questions
1. How do I add a device's IPv6 to the vpn as source?
E:Option ==> peer wg12 rule add vpn src=2a02:c7f:xxxx:yyyy:6e12:d4fa:7179:cd6
2
[✔] Updated RPDB Selective Routing rule for wg12 ***Source 2a02:c7f:x
xxx:yyyy:6e12:d4fa:7179:cd62 switched to destination!
ip -6 rule add from 2a02:c7f:xxxx:yyyy:6e12:d4fa:7179:cd62 table 121 prio 9911
Solved using your recommendation in #3 above - see edits to #22 using the MAC address to circumvent the problemYou are doing it right, but wgm forces the change to destination for some reason. I tried it:
Code:E:Option ==> peer wg12 rule add vpn src=2a02:c7f:xxxx:yyyy:6e12:d4fa:7179:cd6 2 [✔] Updated RPDB Selective Routing rule for wg12 ***Source 2a02:c7f:x xxx:yyyy:6e12:d4fa:7179:cd62 switched to destination!
This is something @Martineau will look at, or explain.
Meanwhile you could add it yourself:
Code:ip -6 rule add from 2a02:c7f:xxxx:yyyy:6e12:d4fa:7179:cd62 table 121 prio 9911
there are no defined ways to handle when an ipv6 changes as the router is not in control over that. But we should be able to manage prefix changes...
When specifying the Selective Routing Rule, if there is any ambiguity (routable IP address vs. private IP address) then you must explicitly specify both theYou are doing it right, but wgm forces the change to destination for some reason. I tried it:
Code:E:Option ==> peer wg12 rule add vpn src=2a02:c7f:xxxx:yyyy:6e12:d4fa:7179:cd62 [✔] Updated RPDB Selective Routing rule for wg12 ***Source 2a02:c7f:xxxx:yyyy:6e12:d4fa:7179:cd62 switched to destination!
This is something @Martineau will look at, or explain.
src=
and dst=
parameterse = Exit Script [?]
E:Option ==> peer wg12 rule add vpn src=2a02:c7f:xxxx:yyyy:6e12:d4fa:7179:cd62 dst=any
[✔] Updated RPDB Selective Routing rule for wg12
Client Auto IP Endpoint DNS MTU Public Private Annotate
wg12 N 10.168.128.1/32,fd00:bbbb:bbbb:bb01::9:1e00/128 193.220.213.51:51820 193.138.218.74 j//ylCahjy/LiynsaPKYkOwBmE5F0M6lQMZfgicJpm8= UO1tzRPU/EZeeKWSd3aR17lqWi6tD1snPXkXyqBLf0Q= # Mullvad France, Paris
Selective Routing RPDB rules
ID Peer Interface Source Destination Description
1 wg12 VPN 2a02:c7f:xxxx:yyyy:6e12:d4fa:7179:cd62 Any
Really doesn't matter since the interface is brought down so these files are removed.is echo 2 > /proc/sys/net/ipv4/conf/wg11/rp_filter taken down on stop wg11, or do i need to do anything is the wg11-down.script?
Does this work for wireless clients as well? Mac address is a low-level part of the protocol and removed in the higher level.Following your advice in #3 I have added
I don't know, I've never tried this, youre the first-runner. You tell me. Reliability? Efficiency? But in principle, yes, but make sure to test so it covers all cases (like tcp, udp)I assume I can remove the IPv4 vpn to 10.50.60.150 rule as it is now superfluous?
While I haven't tried this, it seems possible to create Mac address ipsets:Solved using your recommendation in #3 above - see edits to #22 using the MAC address to circumvent the problem
AND this setup also sends all DNS enquires (IPv4 and IPv6) for all LAN devices (except I assume anything using DoH) through the WireGuard VPN, something that was not achievable on OpenVPN, as the router client does not support IPv6.
I may test using the revised instructions for adding the IPv6 to wg11 over the weekend and this may be a better/alternative solution where someone is using DHCP6 so the addresses are fixed. For SLAAC, where they are not I think using the MAC addresses (provided they are not also dynamic) is a more robust solution.
Next tests - passthrough.
ipset create wg11-mac hash:mac
ipset add wg11-mac XX:XX:XX:XX:XX:XX
iptables -t mangle -I PREROUTING -m set --match-set wg11-mac src -j MARK --set-mark 0x1000/0x1000
ip6tables -t mangle -I PREROUTING -m set --match-set wg11-mac src -j MARK --set-mark 0x1000/0x1000
1. Okay1. Really doesn't matter since the interface is brought down so these files are removed.
2. Does this work for wireless clients as well? Mac address is a low-level part of the protocol and removed in the higher level.
3. I don't know, I've never tried this, youre the first-runner. You tell me. Reliability? Efficiency? But in principle, yes, but make sure to test so it covers all cases (like tcp, udp)
tcpdump -vv -i $(nvram get wan0_ifname) udp port 53 or tcp port 53 or tcp port 853
Sounds good - not used ipsets before - do they survive reboots and where would I find them?While I haven't tried this, it seems possible to create Mac address ipsets:
Code:ipset create wg11-mac hash:mac ipset add wg11-mac XX:XX:XX:XX:XX:XX
here you could add as many Mac addresses to the set as you wish.
I expect it is not possible to add this ipset in wgm, but the firewall rule would be something like:
Code:iptables -t mangle -I PREROUTING -m set --match-set wg11-mac src -j MARK --set-mark 0x1000/0x1000 ip6tables -t mangle -I PREROUTING -m set --match-set wg11-mac src -j MARK --set-mark 0x1000/0x1000
After this you could manage the Mac addresses in the ipsets instead of changing and adding more firewall rules. .
Play around with tcpdump I guess to watch all traffic from your redirected ip on your WAN interface and see so it remains empty after some various internet usage.Can you suggest any other tests I can run?
they do not survive reboots on their own, you typically save them, either manually after each change, or set up a cron job to periodically save them, i.e:Sounds good - not used ipsets before - do they survive reboots and where would I find them?
ipset save wg11-mac > /opt/tmp/wg11-mac
IPSET_NAME=wg11-mac
if [ "$(ipset list -n "$IPSET_NAME" 2>/dev/null)" != "$IPSET_NAME" ]; then #if ipset does not already exist
if [ -s "/opt/tmp/$IPSET_NAME" ]; then #if a backup file exists
ipset restore -! <"/opt/tmp/$IPSET_NAME" #restore ipset
fi
fi
hash:mac
ipset capabilities to wgm (ipv4+ipv6 firewall mark rule), so it takes care of the firewall rules and routing for you, but you will still need to create and restore the ipset yourself.You could simply add or delete mac addresses in the set and thus change the routing for these ip's...
if it is indeed working good, perhaps we could make a polite request to @Martineau to include thehash:mac
ipset capabilities to wgm (ipv4+ipv6 firewall mark rule), so it takes care of the firewall rules and routing for you, but you will still need to create and restore the ipset yourself.
wireguard_manager
simply tags the named IPSET so any type of IPSET should already be supported.e = Exit Script [?]
E:Option ==> peer wg12
Client Auto IP Endpoint DNS MTU Annotate
wg12 N 10.68.28.1/32,fc00:bbbb:bbbb:bb01::5:1c00/128 194.110.113.51:51820 193.138.218.74 # Mullvad France, Paris
Selective Routing RPDB rules
ID Peer Interface Source Destination Description
1 wg12 VPN 2a02:c7f:xxxx:yyyy:6e12:d4fa:7179:cd62 Any
IPSet Enable Peer FWMark DST/SRC
Netflix Y wg12 0x2000 dst
MACs Y wg12 0x2000 src
I remember something about wgm scanning the set forHowever, the contents of the IPSET are deemed by default to contain destination elements such as Netflix/Hulu target IPs.
INET
or INET6
to determine if the rules should be in iptables or ip6tables. this would go in both, hence my comment that wgm might need to recognize the hash:mac type of set and put in firewall rules for both (or as appropriate depending on router setup). or maybee it already does?I don't know what parental control does, possibly flushes some firewall chains?Does anybody use wireguard with parental control? After starting WG everythink works perfect until I block some devices by parental control on my asuswrt. After that I need to restart WG.
I think it mess with firewallI don't know what parental control does, possibly flushes some firewall chains?
Server. ipv4. Policy default. Can connect but no internet. It looks like block some devices on parental control change firewall and everything stops working.Are you referring to wg server or wg client or both? Ipv4, ipv6 or both? Policy/default mode?
What happens when it don't work? Loosing connection completally or something else?
Ok... most probably it would filter content in the FORWARD chain. Check and compare before and afterI think it mess with firewall
Server. ipv4. Policy default. Can connect but no internet. It looks like block some devices on parental control change firewall and everything stops working.
I was thinking what for is that:
[✔] firewall-start is monitoring WireGuard Firewall rules
iptables -nvL FORWARD
That would explain why you loose contact.iptables -nvL FORWARD
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- br0 wg21 0.0.0.0/0 0.0.0.0/0 /* LAN to WireGuard 'server clients' */
0 0 ACCEPT all -- wg21 * 0.0.0.0/0 0.0.0.0/0 /* WireGuard 'server' */
Looks like this two entry are deleted after changing parental control
I have being trying to use ipsets and while the routing rulesPlay around with tcpdump I guess to watch all traffic from your redirected ip on your WAN interface and see so it remains empty after some various internet usage.
they do not survive reboots on their own, you typically save them, either manually after each change, or set up a cron job to periodically save them, i.e:
Code:ipset save wg11-mac > /opt/tmp/wg11-mac
and to restore on boot (like in nat-start):
Code:IPSET_NAME=wg11-mac if [ "$(ipset list -n "$IPSET_NAME" 2>/dev/null)" != "$IPSET_NAME" ]; then #if ipset does not already exist if [ -s "/opt/tmp/$IPSET_NAME" ]; then #if a backup file exists ipset restore -! <"/opt/tmp/$IPSET_NAME" #restore ipset fi fi
not sure if it is easier but once this is setup (and especially if you use a cron job to periodically save them) you could simply add or delete mac addresses in the set and thus change the routing for these ip's...
if it is indeed working good, perhaps we could make a polite request to @Martineau to include thehash:mac
ipset capabilities to wgm (ipv4+ipv6 firewall mark rule), so it takes care of the firewall rules and routing for you, but you will still need to create and restore the ipset yourself.
iptables -t mangle -I PREROUTING -m set --match-set wg11-mac src -j MARK --set-mark 0x1000/0x1000
ip6tables -t mangle -I PREROUTING -m set --match-set wg11-mac src -j MARK --set-mark 0x1000/0x1000
ipset list -n wg11-mac
ipset v7.6: The set with the given name does not exist
ipset list -n wg11-mac
wg11-mac
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!