Enable / Disable WAN Access Using List Of MAC Addresses

Post new topic   Reply to topic    DD-WRT Forum Index -> Ralink SoC based Hardware
Author Message
brainflurry
DD-WRT Novice


Joined: 19 Aug 2018
Posts: 1

PostPosted: Sun Aug 19, 2018 1:22    Post subject: Enable / Disable WAN Access Using List Of MAC Addresses Reply with quote
I would like to disable WAN access for specified devices using shell or GUI commands on my Buffalo WHR-300HP2 router running DD-WRT v3.0-r30354 std (08/22/16). I found the code below provided by user eibgrad on a post for Atheros equipment. I have three questions:

1. Are the commands the different at all for Atheros and Ralink routers?

2. The code below disables WAN access. Do I simply replace "REJECT" in the code with "ALLOW" to re-enable WAN ACCESS?

3. Will disabling access using the code below drop existing WAN connections? If not, how could I accomplish this desired behavior?

I am aware of Access Restrictions in the GUI and I use them to an extent but they're limited to ten profiles and I have many varying combinations of devices I'd like the ability to manage access for. Furthermore, I'm hoping to automate some scenarios via shell access from a Windows computer.

eibgrad wrote:
Code:
#!/bin/sh

insmod xt_mac
insmod ipt_mac

WAN_IF="$(ip route | grep -Em1 '^default' | awk '{print $NF}')"
MAC_LIST="
00:11:22:33:44:55
00:11:22:33:44:66
00:11:22:33:44:77
"

for mac in $MAC_LIST; do
    iptables -I FORWARD -m mac --mac-source $mac -o $WAN_IF -m state --state NEW \
        -j REJECT --reject-with icmp-host-prohibited
    iptables -I FORWARD -p tcp -m mac --mac-source $mac -o $WAN_IF -m state --state NEW \
        -j REJECT --reject-with tcp-reset
done
[/quote]
Sponsor
Per Yngve Berg
DD-WRT Guru


Joined: 13 Aug 2013
Posts: 6856
Location: Romerike, Norway

PostPosted: Sun Aug 19, 2018 20:12    Post subject: Reply with quote
Existing connections are not altered when you use "-m state --state NEW"
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Ralink 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 cannot attach files in this forum
You cannot download files in this forum