PatrickPfP
(usa CentOS)
Enviado em 11/10/2012 - 14:31h
#!/bin/sh
IPTABLES="/usr/sbin/iptables"
echo "1" > /proc/sys/net/ipv4/ip_forward
modprobe ip_tables
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP
$IPTABLES -t nat -A POSTROUTING -o eth1 -j MASQUERADE
#$IPTABLES -t nat -A PREROUTING -s 10.1.1.0/24 -p tcp --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -A FORWARD -i eth1 -j ACCEPT
$IPTABLES -A FORWARD -o eth1 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 22 -j ACCEPT
$IPTABLES -A OUTPUT -p tcp --sport 22 -j ACCEPT
# Manter conexoes jah estabelecidas para nao parar
#$IPTABLES -A INPUT -i eth1 -m state --state ! ESTABILISHED,RELATED -j DROP
#$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
# Liberando Porta 80 (http)
$IPTABLES -A FORWARD -s 10.1.1.0/24 -p tcp --dport 80 -j ACCEPT
# Liberando Porta 443
$IPTABLES -A FORWARD -s 10.1.1.0/24 -p tcp --dport 443 -j ACCEPT
# Liberando porta 53 (DNS)
$IPTABLES -A FORWARD -s 10.1.1.0/24 -p tcp --dport 53 -j ACCEPT
$IPTABLES -A FORWARD -s 10.1.1.0/24 -p udp --dport 53 -j ACCEPT
$IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPTABLES -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPTABLES -t nat -A PREROUTING -s 10.1.1.0/24 -p tcp --dport 80 -j REDIRECT --to-port 3128
Fiz mais umas alterações mas nada ainda.