1. Store
  2. Apps
  3. Hardware
  4. Support
  5. Solutions

ClearFoundation

Forums
Welcome, Guest
Multiple Lan and iptables question
(1 viewing) 1 Guest
Go to bottomPage: 1
TOPIC: Multiple Lan and iptables question
#43020
Multiple Lan and iptables question 11 Months, 3 Weeks ago  
I currently have 3 Lans


eth1 (192.168.0.0/24)
eth2 (192.168.1.0/24)
eth3 (192.168.2.0/24)

eth1 can access eth2 and eth3
eth2 can only access eth3
eth3 can only access the net

Is this possible using iptables?
I am having trouble getting it working.


I tried the following last:

iptables -I FORWARD -i eth1 -o eth2 -j ALLOW
iptables -I FORWARD -i eth1 -o eth3 -j ALLOW
iptables -I FORWARD -i eth2 -o eth1 -j DROP
iptables -I FORWARD -i eth3 -o eth2 -j DROP
iptables -I FORWARD -i eth3 -o eth1 -j DROP

I did a packet sniff with wireshark and it shows the packets make it from eth1 --> eth2 or eth3 but when it goes back the other way it is dropped at the firewall.
What am I missing?

Thanks
Kyle Kitzul
Fresh Boarder
Posts: 3
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#43022
Re: Multiple Lan and iptables question 11 Months, 3 Weeks ago  
You need to allow related and established packets back. There is a generic rule there already but your DROP rules are being inserted before it so the packets get dropped. You cant really use the default rules either as these allow traffic between all the LAN's. You also need to think of the order the rules are being applied. As you have used -I on its own for each rule they are added one by one to the top of your rules so the drop rules end up above the allow rules. Try something like:
Code:

iptables -I FORWARD -i eth2 -o eth1 -j DROP
iptables -I FORWARD -i eth3 -o eth2 -j DROP
iptables -I FORWARD -i eth3 -o eth1 -j DROP
iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -I FORWARD -i eth1 -o eth2 -j ALLOW
iptables -I FORWARD -i eth1 -o eth3 -j ALLOW

Nick Howitt
Platinum Boarder
Posts: 4232
graphgraph
User Online Now Click here to see the profile of this user
The administrator has disabled public write access.
 
#43131
Re: Multiple Lan and iptables question 11 Months, 3 Weeks ago  
Thank you, I will give that a try this weekend and see if I can get it working.
Kyle Kitzul
Fresh Boarder
Posts: 3
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1
  get the latest posts directly to your desktop