Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TATA_INTIP="192.168.15.2"
- AIRTEL_INTIP="192.168.1.2"
- TATA_LANIP="192.168.20.1"
- AIRTEL_LANIP="192.168.2.1"
- # Interface connected to Internet
- BHARTI="eth0"
- TATA="eth1"
- AIRTEL="eth3"
- # Interface connected to LAN
- BHARTI_LAN="eth4"
- TATA_LAN="eth4:0"
- AIRTEL_LAN="eth4:1"
- # Squid port
- SQUID_PORT="3128"
- SSL_PORT="3129"
- iptables -F
- iptables -X
- iptables -t nat -F
- iptables -t nat -X
- iptables -t mangle -F
- iptables -t mangle -X
- # Load IPTABLES modules for NAT and IP conntrack support
- modprobe ip_conntrack
- modprobe ip_conntrack_ftp
- # For win xp ftp client
- #modprobe ip_nat_ftp
- echo 1 > /proc/sys/net/ipv4/ip_forward
- # Setting default filter policy
- iptables -P INPUT DROP
- iptables -P OUTPUT ACCEPT
- # Unlimited access to loop back
- iptables -A INPUT -i lo -j ACCEPT
- iptables -A OUTPUT -o lo -j ACCEPT
- # Allow UDP, DNS and Passive FTP
- #iptables -A INPUT -i $BHARTI -m state --state ESTABLISHED,RELATED -j ACCEPT
- iptables -A INPUT -i $TATA -m state --state ESTABLISHED,RELATED -j ACCEPT
- iptables -A INPUT -i $AIRTEL -m state --state ESTABLISHED,RELATED -j ACCEPT
- # set this system as a router for Rest of LAN
- iptables -t mangle -A PREROUTING -p tcp 192.168.20.0/24 -j MARK --set-mark 4
- iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 192.168.15.2
- iptables -t nat -A POSTROUTING -o eth3 -j SNAT --to-source 192.168.1.2
- # unlimited access to LAN
- iptables -A INPUT -i $BHARTI_LAN -j ACCEPT
- iptables -A OUTPUT -o $BHARTI -j ACCEPT
- iptables -A INPUT -i $TATA_LAN -j ACCEPT
- iptables -A OUTPUT -o $TATA -j ACCEPT
- iptables -A INPUT -i $AIRTEL_LAN -j ACCEPT
- iptables -A OUTPUT -o $AIRTEL -j ACCEPT
- # DROP everything and Log it
- iptables -A INPUT -j LOG
- iptables -A INPUT -j DROP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement