iptables/ebtables for AP Isolation

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Author Message
puterboy2
DD-WRT User


Joined: 24 Feb 2019
Posts: 139

PostPosted: Tue Nov 28, 2023 17:25    Post subject: iptables/ebtables for AP Isolation Reply with quote
I want to automate turning on/off "AP Isolation" from a bash script.
Can you tell me what iptables/ebtables commands are executed to turn-on/turn-off "AP Isolation"?
Are there any other changes made beyond iptables/ebtables?

I have a Netgear r6700v3 router.
Sponsor
Wildlion
DD-WRT Guru


Joined: 24 May 2016
Posts: 1418

PostPosted: Tue Nov 28, 2023 23:56    Post subject: Reply with quote
You could view the iptables with AP isolation off and then again when it is on and notice the differences.
Alozaros
DD-WRT Guru


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

PostPosted: Wed Nov 29, 2023 7:59    Post subject: Reply with quote
Wildlion wrote:
You could view the iptables with AP isolation off and then again when it is on and notice the differences.


cat /tmp/.ipt file

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


Joined: 26 Mar 2013
Posts: 1858
Location: Hung Hom, Hong Kong

PostPosted: Wed Nov 29, 2023 13:21    Post subject: Re: iptables/ebtables for AP Isolation Reply with quote
puterboy2 wrote:
I want to automate turning on/off "AP Isolation" from a bash script.
Can you tell me what iptables/ebtables commands are executed to turn-on/turn-off "AP Isolation"?
Are there any other changes made beyond iptables/ebtables?

Following command should list all NVRAM values related to AP and Net Isolation for various network interfaces:
Code:
# nvram show | grep isolat
vlan1_isolation=0
wl0_ap_isolate=1
eth1_isolation=0
wl0.1_ap_isolate=1
wl0.1_isolation=1
wl_ap_isolate=1

You should just flip the value between 1 and 0 then restart some processes which I dunno, instead of directly manipulating the firewall. Unless you use your own custom iptables and/or ebtables rules to enforfce isolation, which makes Wildlion's suggestion a starting point. Smile

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3006
Location: Germany

PostPosted: Wed Nov 29, 2023 14:03    Post subject: Reply with quote
This does not work via iptabels.

Just as you cannot isolate LAN clients in the same subnet from each other via iptables.
They communicate directly with each other via layer2 and iptables is layer3

For WLAN this is done using low level stuff in the driver/hostap.

I'm not familiar with the Broadcom NAS stuff, but on the other routers that use hotsapd "ap_isolate=1" is written to hostap.conf.

_________________
Quickstart guides:
use Pi-Hole as simple DNS-Server with DD-WRT
VLAN configuration via GUI - 1 CPU port
VLAN configuration via GUI - 2 CPU ports (R7800, EA8500 etc)

Routers
Marvell OCTEON TX2 - QHora-322 - OpenWrt 23.05.3 - Gateway
Qualcomm IPQ8065 - R7800 - DD-WRT - WAP
puterboy2
DD-WRT User


Joined: 24 Feb 2019
Posts: 139

PostPosted: Thu Nov 30, 2023 4:42    Post subject: Re: iptables/ebtables for AP Isolation Reply with quote
mwchang wrote:

Following command should list all NVRAM values related to AP and Net Isolation for various network interfaces:
Code:
# nvram show | grep isolat
vlan1_isolation=0
wl0_ap_isolate=1
eth1_isolation=0
wl0.1_ap_isolate=1
wl0.1_isolation=1
wl_ap_isolate=1

You should just flip the value between 1 and 0 then restart some processes which I dunno, instead of directly manipulating the firewall. Unless you use your own custom iptables and/or ebtables rules to enforfce isolation, which makes Wildlion's suggestion a starting point. Smile


Of course the million dollar question is to know what "processes" to run or restart Smile
puterboy2
DD-WRT User


Joined: 24 Feb 2019
Posts: 139

PostPosted: Thu Nov 30, 2023 4:47    Post subject: Reply with quote
ho1Aetoo wrote:
This does not work via iptabels.

Just as you cannot isolate LAN clients in the same subnet from each other via iptables.
They communicate directly with each other via layer2 and iptables is layer3

For WLAN this is done using low level stuff in the driver/hostap.

I'm not familiar with the Broadcom NAS stuff, but on the other routers that use hotsapd "ap_isolate=1" is written to hostap.conf.


Ahhh that makes sense.
I recall that at least with Kong's version, if I wanted full isolation between clients, in addition to enbabling "AP Isolation", I needed to add a line to ebtables to prevent communication between clients on wl0.1 and wl1.1
Not sure if that is still necessary...

Indeed, the Wiki page for ebtables says:
Quote:

While iptables operates at the Network Layer (Layer 3), ebtables operates at the Data Link Layer (Layer 2), enabling a more granular level of traffic control


Is it possible that ebtables is used also for AP Isolation?

If not, does anyone know what code is executed to turn on/off AP Isolation?
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3006
Location: Germany

PostPosted: Thu Nov 30, 2023 9:36    Post subject: Reply with quote
Yes, probably if you have bridged the two VAPs and they are in the same subnet then you can control what data is exchanged between the two network interfaces via ebtables.

but you can't control what happens within the interface itself - I don't know how.

_________________
Quickstart guides:
use Pi-Hole as simple DNS-Server with DD-WRT
VLAN configuration via GUI - 1 CPU port
VLAN configuration via GUI - 2 CPU ports (R7800, EA8500 etc)

Routers
Marvell OCTEON TX2 - QHora-322 - OpenWrt 23.05.3 - Gateway
Qualcomm IPQ8065 - R7800 - DD-WRT - WAP
puterboy2
DD-WRT User


Joined: 24 Feb 2019
Posts: 139

PostPosted: Thu Dec 07, 2023 2:59    Post subject: Reply with quote
So what code is actually triggered by toggling "AP Isolation"?
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3006
Location: Germany

PostPosted: Thu Dec 07, 2023 8:40    Post subject: Reply with quote
I have already written to you that this is implemented in the driver and is not realized via any iptable/ebtable rules
_________________
Quickstart guides:
use Pi-Hole as simple DNS-Server with DD-WRT
VLAN configuration via GUI - 1 CPU port
VLAN configuration via GUI - 2 CPU ports (R7800, EA8500 etc)

Routers
Marvell OCTEON TX2 - QHora-322 - OpenWrt 23.05.3 - Gateway
Qualcomm IPQ8065 - R7800 - DD-WRT - WAP
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware 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 can attach files in this forum
You can download files in this forum