isolate vlans / ports / iptables question

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2
Author Message
fyi2000
DD-WRT Guru


Joined: 04 Apr 2010
Posts: 642

PostPosted: Tue May 03, 2011 18:49    Post subject: Reply with quote
john_es wrote:
My VLAN config:
VLAN0 - no ports
VLAN1 - W
VLAN2 - Port 2
VLAN3 - Port 3
VLAN4 - Port 4
VLAN5 - Port 1

So if I want to separate wireless, all vlans, all ports, I am guessing I want to do something like this:

iptables -I FORWARD -i Y -o X -j DROP

Where X and Y are all possible combinations of:

br0
eth1
vlan0
vlan1
vlan2
vlan3
vlan4
vlan5

Does that sound right?

soulstace wrote:
Yes that's fine. But keep in mind if you block any VLAN access to VLAN1, it will not be able to reach the internet.

It is also possible to completely isolate any port. See http://www.dd-wrt.com/wiki/index.php/Default_Configuration_Overview

To turn DD-WRT into a port-based vlan switch,
Code:
insmod ebtables
insmod ebtable_filter
insmod ebt_ip.o
ebtables -F
ebtables -A FORWARD -i vlan1 -j ACCEPT
ebtables -A FORWARD -i vlan0 -o vlan1 -j ACCEPT
ebtables -A FORWARD -i vlan2 -o vlan1 -j ACCEPT
ebtables -A FORWARD -i vlan3 -o vlan1 -j ACCEPT
ebtables -A FORWARD -i vlan4 -o vlan1 -j ACCEPT
ebtables -A FORWARD -i vlan5 -o vlan1 -j ACCEPT
ebtables -A FORWARD -i eth1 -o vlan1 -j ACCEPT
ebtables -P FORWARD DROP

DD-WRT Forum :: View topic - Help blocking an internal IP range with iptables?
Sponsor
phuzi0n
DD-WRT Guru


Joined: 10 Oct 2006
Posts: 10141

PostPosted: Tue May 03, 2011 19:42    Post subject: Reply with quote
Please don't necro threads. This was from 2 years ago.
_________________
Read the forum announcements thoroughly! Be cautious if you're inexperienced.
Available for paid consulting. (Don't PM about complicated setups otherwise)
Looking for bricks and spare routers to expand my collection. (not interested in G spec models)
Eric G.
DD-WRT Novice


Joined: 19 Sep 2011
Posts: 4

PostPosted: Mon Sep 19, 2011 4:00    Post subject: Reply with quote
None of the firewall commands in this thread worked for me in blocking communication between VLANs. For whatever reason, adding any of my VLANs to br0 completely broke them. The same happened when I tried to create a new bridge. However, thanks to the info found on this thread, as well as on this site, I was able to put together a command that did the trick:
Quote:
iptables -I FORWARD -i vlan+ -o vlan+ -j DROP

This blocks communication between ALL VLANs though, which is a problem if you're using the WAN port. I'm using Client Mode wireless for Internet access instead though, so using this as-is was perfect for me. If you need to be able to communicate with the WAN port, my guess is that adding the following two commands beneath the one above will work, though I haven't tested this:
Quote:
iptables -I FORWARD -i vlan+ -o vlan1 -j ACCEPT
iptables -I FORWARD -i vlan1 -o vlan+ -j ACCEPT


Lastly, I'm also using this command to block the subnet that my normal LAN is located on:
Quote:
iptables -I FORWARD -s 192.168.1.0/255.255.255.0 -j DROP



P.S. phuzi0n, I know you said not to resurrect an old thread, but I feel this information is still applicable today. After all, I found this thread when doing a Google search and it let me to a solution for my almost identical problem. As such, I felt I should share this information here.
Goto page Previous  1, 2 Display posts from previous:    Page 2 of 2
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