WireGuard Kill switch question

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
uvz123a
DD-WRT User


Joined: 01 May 2023
Posts: 51

PostPosted: Sun May 21, 2023 0:10    Post subject: Reply with quote
DD-WRT v3.0-r52369 std (c) 2023 NewMedia-NET GmbH
Release: 04/20/23
Board: Linksys WRT3200ACM

I have two VPN subnets configured as server:
* first with internet access (Kill Switch=Disabled, Allow Clients WAN Access=Enabled)
* the second without internet (Kill Switch=Enabled, Allow Clients WAN Access=Disabled)

I have noticed that on oet2 with Kill Switch=Enabled also blocks WAN traffic on oet1 with Kill Switch=Disabled. If I want the internet access on oet1, than Kill Switch in oet2 must be Disabled.

Is this normal behavior?
I have read the manual but I couldn't figure out the difference between Kill Switch and Allow Clients WAN Access. Could somebody explain this to me?
Thanks.
Sponsor
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12915
Location: Netherlands

PostPosted: Sun May 21, 2023 7:47    Post subject: Reply with quote
Quote:
Kill Switch: Enabled (checked)
A kill switch is used if you want to block traffic going out of the WAN interface.
The Kill switch is intelligent, meaning that when PBR is used, only the IP addresses in the PBR field are
blocked from accessing the WAN, if you do not use PBR all traffic coming from all LAN clients is
blocked from going out of the WAN.


Basically that says it all: all traffic from all LAN clients is blocked going out of the WAN (if PBR is *not* used)

Quote:
Allow Clients WAN Access
This is mainly used when you use WG as a server or setting up for a site-to-site setup, see the Server Setup guide. So disable (untick) for normal client use.


So not relevant for a normal Client setup.

From the Server setup guide:
Quote:
14. Allow Clients WAN Access: Enable, if you want to have your connecting WireGuard clients to have internet access via the server (NAT out via the servers WAN).


I hope that clears it up.

P.S. Instead of reviving an old thread it is better to start your own thread.
See the forum guidelines with helpful pointers about how to research your router, where and what firmware to download, where and how to post and many other helpful tips:
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087

_________________
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
Alozaros
DD-WRT Guru


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

PostPosted: Sun May 21, 2023 9:17    Post subject: Reply with quote
lol this thread feels like dejavoo, as i read it couple of hours ago...and rubbed my eye's and read it again and again it was different...anyway just to ask if the Wireguard and OpenVPN kill switches are made by the same guy... Laughing Laughing Razz

if im not wrong eibgrad made one for the VPN back in the days...and i was just using a single line for quite long time instead (egc way) assumed br0 is your default bridge..

iptables -I FORWARD -i br0 -o $(get_wanface) -m state --state NEW -j REJECT --reject-with icmp-host-prohibited

could be tailored like that to be less specific..but..not ideal

iptables -I FORWARD -o $(get_wanface) -m state --state NEW -j REJECT --reject-with icmp-host-prohibited

and there ware lot of other examples..but when it went to PBR, than GUI killswitch was introduced..

but the old way was like that

WAN_IF="$(ip route | awk '/^default/{print $NF}')"
for i in br0 ath1.1 br1; do
iptables -I FORWARD -i $i -o $WAN_IF -j REJECT --reject-with icmp-host-prohibited
iptables -I FORWARD -i $i -p tcp -o $WAN_IF -j REJECT --reject-with tcp-reset
iptables -I FORWARD -i $i -p udp -o $WAN_IF -j REJECT
done

and you can adjust it towards your needs...

_________________
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
uvz123a
DD-WRT User


Joined: 01 May 2023
Posts: 51

PostPosted: Mon May 22, 2023 9:09    Post subject: Reply with quote
Thanks for reply.

I want to isolate VPN subnet form the rest of the network. Only VPN clients of that subnet can communicate to each other.

I have managed to write those commands:
iptables -I FORWARD -i oet2 -j DROP
iptables -I FORWARD -o oet2 -j DROP
iptables -I FORWARD -s $(nvram get oet2_ipaddrmask) -d $(nvram get oet2_ipaddrmask) -j ACCEPT

But I am not completely satisfied... gateways of other subnets are still reachable (eg. DDWRT GUI on 192.168.1.1).

How would you write the iptables commands for this problem?
What is the best practice to achieve that?
uvz123a
DD-WRT User


Joined: 01 May 2023
Posts: 51

PostPosted: Wed May 24, 2023 19:02    Post subject: Reply with quote
Anybody?
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12915
Location: Netherlands

PostPosted: Thu May 25, 2023 16:05    Post subject: Reply with quote
Not sure what you want, you mention two VPN subnets, do you have two WireGuard tunnels or do you have two subnets on your routers which you want to route?
_________________
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
uvz123a
DD-WRT User


Joined: 01 May 2023
Posts: 51

PostPosted: Thu May 25, 2023 21:04    Post subject: Reply with quote
Thanks for reply that I wasn't clear enough. I will try to explain a bit more.

I have two Wireguard tunnels (of course on different subnets) and they are configured independently. First tunnel is not subject of this topic.

I am just asking for the second tunnel, how to achieve total isolation from the rest of the network. Like it is the switch (without WAN connection) in the locked room with some computers. Computers can communicate to each other, but can not communicate outside tunnel. Also other devices outside this tunnel/subnet can not reach devices/computers in that tunnel.
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12915
Location: Netherlands

PostPosted: Fri May 26, 2023 6:24    Post subject: Reply with quote
The WireGuard tunnels indeed have different subnets otherwise it could not work.
I assume you have PBR running on both tunnels to differentiate which clients uses which tunnel.

It looks like you want to separate LAN clients from each other for this you have to research how to setup a Guest/IoT network on your router.
Lots of threads/wiki's available.

_________________
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
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