andre_ramos
(usa openSUSE)
Enviado em 12/06/2009 - 16:08h
#!/bin/bash
#Para apagar as tabelas: iptables -F
#Para listar as regras: -L
#Habilitar duas interfaces de rede para roteamento
IPTABLES=/usr/sbin/iptables
echo 1 > /proc/sys/net/ipv4/ip_forward
#Politicas de acesso geral
$IPTABLES -A INPUT ACCEPT
$IPTABLES -A OUTPUT ACCEPT
$IPTABLES -A FORWARD ACCEPT
#localhost
$IPTABLES -A INPUT -i lo -j ACCEPT
$IPTABLES -A OUTPUT -o lo -j ACCEPT
modprobe ip_nat_ftp
# INPUT
$IPTABLES -A INPUT -p tcp --dport 20 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 21 -j ACCEPT
# ssh
$IPTABLES -A INPUT -p tcp --dport 22 -j ACCEPT
# smtp
$IPTABLES -A INPUT -p tcp --dport 25 -j ACCEPT
# pop3
$IPTABLES -A INPUT -p tcp --dport 110 -j ACCEPT
# http
$IPTABLES -A INPUT -p tcp --dport 80 -j ACCEPT
# OUTPUT
$IPTABLES -A OUTPUT -p tcp --dport 20 -j ACCEPT
$IPTABLES -A OUTPUT -p tcp --dport 21 -j ACCEPT
# ssh
$IPTABLES -A OUTPUT -p tcp --dport 22 -j ACCEPT
# smtp
$IPTABLES -A OUTPUT -p tcp --dport 25 -j ACCEPT
# pop3
$IPTABLES -A OUTPUT -p tcp --dport 110 -j ACCEPT
# http
$IPTABLES -A OUTPUT -p tcp --dport 80 -j ACCEPT
$IPTABLES -A FORWARD -s 10.1.1.0/8 -p tcp --dport 80 -j ACCEPT
$IPTABLES -A FORWARD -s 10.1.1.0/8 -j ACCEPT
$IPTABLES -A FORWARD -d 10.1.1.0/8 -p tcp --dport 1024:65535 -j ACCEPT
$IPTABLES -A FORWARD -s 10.1.1.0/8 -p tcp --dport 1024:65535 -j ACCEPT
$IPTABLES -A FORWARD -s 10.1.1.0/8 -p tcp --dport 3128 -j ACCEPT