[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

iptables problem with two diffrent subnet



hi all, with iptables I've create
this script(see below or here http://pastebin.com/m416d8f6d)
for this specific situation:
http://img33.picoodle.com/img/img33/3/1/1/f_lanm_1233f0a.jpg

In the eth2 lan work as I wish because pc can access to internet only with proxy at port 8080; the problem also in the eth1 and here I want to access directly using Nat and grant some services to specific ports (21,22,110,etc..)

thanks in advance

.... iptables script ....
#!/bin/bash

# delete all existing rules.
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X

# DEFAULT policies
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP

# Always accept loopback traffic
iptables -A INPUT -i lo -j ACCEPT

# Allow established connections, and those not coming from the outside
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT # alternativa iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT

# eth1 open ports
iptables -A INPUT -i eth1 -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp --dport 8080 -j ACCEPT

iptables -A INPUT -i eth1 -p tcp --dport 25 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp --dport 110 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp --dport 115 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp --dport 995 -j ACCEPT

# eth2 open ports
iptables -A INPUT -i eth2 -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -i eth2 -p tcp --dport 8080 -j ACCEPT

# enable ping
iptables -A INPUT -p icmp -m icmp --icmp-type echo-reply -j ACCEPT
iptables -A INPUT -p icmp -m icmp --icmp-type 8 -m limit --limit 1/sec -j ACCEPT

# Masquerade.
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# to allow ip forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward


Reply to: