Access restriction not working with Wireguard

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
Construct0ver
DD-WRT Novice


Joined: 06 Nov 2020
Posts: 16

PostPosted: Sun Nov 08, 2020 13:18    Post subject: Access restriction not working with Wireguard Reply with quote
I need help getting restrictions working. I have
Netgear R7800 with
Firmware: DD-WRT v3.0-r44719 std (11/04/20)

I have a 7 year old with autism that loves watching youtube. But latly he has been watching stuff that we do not approve of.

I have tried to clean youtube history, pause, delete everything but some how he lands right back on this garbage.

I really dont know much about networking but I need youtube blocked. On access restriction I input mac and ip tic the catch all p2p, selected youtube. But nothing is blocking youtube.

Can anyone help me get blocks working?
Sponsor
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12889
Location: Netherlands

PostPosted: Sun Nov 08, 2020 14:38    Post subject: Reply with quote
What is the relation with WireGuard, does it work without WireGuard?

If the problem is WireGuard how did you setup, did you use the GUI or did you use any scripting?

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087


Last edited by egc on Sun Nov 08, 2020 20:58; edited 1 time in total
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6439
Location: UK, London, just across the river..

PostPosted: Sun Nov 08, 2020 16:06    Post subject: Re: Access restriction not working with Wireguard Reply with quote
Construct0ver wrote:
I need help getting restrictions working. I have
Netgear R7800 with
Firmware: DD-WRT v3.0-r44719 std (11/04/20)

I have a 7 year old with autism that loves watching youtube. But latly he has been watching stuff that we do not approve of.

I have tried to clean youtube history, pause, delete everything but some how he lands right back on this garbage.

I really dont know much about networking but I need youtube blocked. On access restriction I input mac and ip tic the catch all p2p, selected youtube. But nothing is blocking youtube.

Can anyone help me get blocks working?


so, you want to stop access for youtube only for him or total for everyone...in general, Access Restriction do not work as intended or how people believe they should...
there is another way to block youtube...

when you need to block it, save in firewall rules

ipset -N YOUTUBE hash:ip

if you need to unblock it remove it from there

also add this line at advanced DNSmasq rules in GUI to make it work..
ipset=/youtube.com/YOUTUBE

I hope you use DNSmasq for DNS..

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12889
Location: Netherlands

PostPosted: Sun Nov 08, 2020 20:06    Post subject: Reply with quote
If the problem is not WireGuard but in general to block youtube I am thinking along the lines of @Alozoros

This is an excerpt of the IPSET wiki I am working on, but it needs some (read a lot of) work:

Blocking youtube example:

Disable Shortcut Forwarding Engine (SFE)on Setup tab otherwise ESTABLISHED connections will keep on going (or if you script a REJECT rule disable/enable the fast-classifier module: with rmmod/modprobe fast-classifier.ko))

Add the following to Administration/Commands Save Firewall:
Code:
ipset -N YOUTUBE hash:ip
iptables -I FORWARD -m set --match-set YOUTUBE dst -j REJECT

It even works with time :
Code:
iptables -I FORWARD -m set --match-set YOUTUBE dst -m time --timestart 8:00 --timestop 18:00 -j REJECT

and days:
Code:
iptables -I FORWARD -m set --match-set YOUTUBE dst -m time  --timestart 8:00 --timestop 18:00 --weekdays Mon,Wed,Fri,Sat --kerneltz -j REJECT


If you only want a specific client blocked you add (set a static lease for that client e.g. 192.168.1.11):
Code:
iptables -I FORWARD -s 192.168.1.11 -m set --match-set YOUTUBE dst -m time  --timestart 8:00 --timestop 18:00 --weekdays Mon,Wed,Fri,Sat --kerneltz -j REJECT


Add the following to Services/Services Additional Dnsmasq Options:
Code:
ipset=/youtube.com/ytimg.com/ytimg.l.google.com/s.ytimg.com/youtube.l.google.com/googlevideo.com/i.google.com/YOUTUBE

This will hopefully add all the youtube domains

Unfortunately this relies on DNS for populating the IPSET and there are many ways to escape this, a number of browsers are already using their ow DSN (DoH).
So you might want to surf to youtube yourself to populate the IPSET.

It is possible to manually populate the IPSET that will be discussed in the next paragraph

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Construct0ver
DD-WRT Novice


Joined: 06 Nov 2020
Posts: 16

PostPosted: Sun Nov 08, 2020 20:09    Post subject: Re: Access restriction not working with Wireguard Reply with quote
Alozaros wrote:
Construct0ver wrote:
I need help getting restrictions working. I have
Netgear R7800 with
Firmware: DD-WRT v3.0-r44719 std (11/04/20)

I have a 7 year old with autism that loves watching youtube. But latly he has been watching stuff that we do not approve of.

I have tried to clean youtube history, pause, delete everything but some how he lands right back on this garbage.

I really dont know much about networking but I need youtube blocked. On access restriction I input mac and ip tic the catch all p2p, selected youtube. But nothing is blocking youtube.

Can anyone help me get blocks working?


so, you want to stop access for youtube only for him or total for everyone...in general, Access Restriction do not work as intended or how people believe they should...
there is another way to block youtube...

when you need to block it, save in firewall rules

ipset -N YOUTUBE hash:ip

if you need to unblock it remove it from there

also add this line at advanced DNSmasq rules in GUI to make it work..
ipset=/youtube.com/YOUTUBE

I hope you use DNSmasq for DNS..


I need to block 4 devices. Without Wireguard running it works. But it is spotty. Spotty meaning its hit or miss with the devices.
Sometimes all 4 device block youtube other times maybe 1 of the 4. Have no scripts running. Used a guide for torguard WG setup.

So using (ipset -N YOUTUBE hash:ip) would I make 4 seperated lines with code or can I do the ipset -N YOUTUBE hash:ip, ip, ip, ip,
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12889
Location: Netherlands

PostPosted: Sun Nov 08, 2020 20:27    Post subject: Reply with quote
If it is only problematic when using WireGuard add the following rules (if memory serves me right so I could be wrong)
Code:
iptables -D FORWARD -j lan2wan
iptables -I FORWARD -j lan2wan

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Construct0ver
DD-WRT Novice


Joined: 06 Nov 2020
Posts: 16

PostPosted: Sun Nov 08, 2020 21:25    Post subject: Reply with quote
egc wrote:
If it is only problematic when using WireGuard add the following rules (if memory serves me right so I could be wrong)
Code:
iptables -D FORWARD -j lan2wan
iptables -I FORWARD -j lan2wan


Works Beautifully. Going to use the time code for sure.

Much Gratitude!
Construct0ver
DD-WRT Novice


Joined: 06 Nov 2020
Posts: 16

PostPosted: Mon Nov 30, 2020 1:08    Post subject: Reply with quote
egc wrote:
If it is only problematic when using WireGuard add the following rules (if memory serves me right so I could be wrong)
Code:
iptables -D FORWARD -j lan2wan
iptables -I FORWARD -j lan2wan


Would there be anyway possible to block individual youtube user channels? So Youtube works but channels that are unwanted can be blocked out by user channel name?
blkt
DD-WRT Guru


Joined: 20 Jan 2019
Posts: 5700

PostPosted: Mon Nov 30, 2020 15:54    Post subject: Reply with quote
https://duckduckgo.com/?q=youtube+block+channels Rolling Eyes
Construct0ver
DD-WRT Novice


Joined: 06 Nov 2020
Posts: 16

PostPosted: Wed Mar 31, 2021 0:50    Post subject: Re: Access restriction not working with Wireguard Reply with quote
Construct0ver wrote:
Alozaros wrote:
Construct0ver wrote:
I need help getting restrictions working. I have
Netgear R7800 with
Firmware: DD-WRT v3.0-r44719 std (11/04/20)

I have a 7 year old with autism that loves watching youtube. But latly he has been watching stuff that we do not approve of.

I have tried to clean youtube history, pause, delete everything but some how he lands right back on this garbage.

I really dont know much about networking but I need youtube blocked. On access restriction I input mac and ip tic the catch all p2p, selected youtube. But nothing is blocking youtube.

Can anyone help me get blocks working?


so, you want to stop access for youtube only for him or total for everyone...in general, Access Restriction do not work as intended or how people believe they should...
there is another way to block youtube...

when you need to block it, save in firewall rules

ipset -N YOUTUBE hash:ip

if you need to unblock it remove it from there

also add this line at advanced DNSmasq rules in GUI to make it work..
ipset=/youtube.com/YOUTUBE

I hope you use DNSmasq for DNS..


I need to block 4 devices. Without Wireguard running it works. But it is spotty. Spotty meaning its hit or miss with the devices.
Sometimes all 4 device block youtube other times maybe 1 of the 4. Have no scripts running. Used a guide for torguard WG setup.

So using (ipset -N YOUTUBE hash:ip) would I make 4 seperated lines with code or can I do the ipset -N YOUTUBE hash:ip, ip, ip, ip,





I updated to newest build 3/27 and these blocks are no longer working. Did something change in the newer build?


UPDATE:
It is working now. I cleared the firewall rules and input rules again and saved. Started working.
foz111
DD-WRT Guru


Joined: 01 Oct 2017
Posts: 707
Location: Earth

PostPosted: Wed Mar 31, 2021 9:24    Post subject: Reply with quote
Can i ask what these rules do please?


egc wrote:
If it is only problematic when using WireGuard add the following rules (if memory serves me right so I could be wrong)
Code:
iptables -D FORWARD -j lan2wan
iptables -I FORWARD -j lan2wan

_________________
Netgear R7800 PPPoE Main Router
Network IPV4 - Isolated Vlan's with IoT Devices. Unifi AC-Pro x 3 AP's, Router Wi-Fi Disabled. OVPN Server With Paid Commercial Wireguard Client's. Gateway Mode, DNSMasq, Static Leases & DHCP, Pi-Hole DNS & Running Unbound.

No one can build you the bridge on which you, and only you, must cross the river of life!
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12889
Location: Netherlands

PostPosted: Wed Mar 31, 2021 14:37    Post subject: Reply with quote
If extra firewall rules are added on top of the existing rules then it is possible that the lan2wan target is no longer hit and lan2wan holds the access restrictions.

These commands(when executed as last rules) will move the lan2wan target up in the firewall rules so that it is hit (working) again.

Nowadays OpenVPN and WireGuard firewall rules have been restructured and for normal client operation with the firewall enabled there are no extra rules set so nowadays it should not be needed to do this for WireGuard and OpenVPN to get the access restrictions working

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
foz111
DD-WRT Guru


Joined: 01 Oct 2017
Posts: 707
Location: Earth

PostPosted: Wed Mar 31, 2021 15:17    Post subject: Reply with quote
Nice 1 bud
Thanks for that

_________________
Netgear R7800 PPPoE Main Router
Network IPV4 - Isolated Vlan's with IoT Devices. Unifi AC-Pro x 3 AP's, Router Wi-Fi Disabled. OVPN Server With Paid Commercial Wireguard Client's. Gateway Mode, DNSMasq, Static Leases & DHCP, Pi-Hole DNS & Running Unbound.

No one can build you the bridge on which you, and only you, must cross the river of life!
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum