kinderjoy
(usa Debian)
Enviado em 13/04/2011 - 11:09h
será que é o meu firewall?
2.6.STABLE5
#!/bin/bash
#
echo "1" >/proc/sys/net/ipv4/ip_forward
echo " Ativando Módulos .............................[ OK ]"
#
# Limpando Regras
iptables -F
iptables -X
iptables -Z
iptables -F INPUT
iptables -F OUTPUT
iptables -F FORWARD
iptables -F -t nat
iptables -X -t nat
iptables -F -t mangle
iptables -X -t mangle
echo " Limpando Regras ..................................[OK]
# Definindo Politica Padrão
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
echo " Alterando Politica Padrã........................[ OK ]
#
###################################################
# Tabela FILTER #
###################################################
#
# Aceta tudo que entra e que sai da eth1 para qualquer lugar
iptables -t filter -A INPUT-i eth1 -j ACCEPT
iptables -t filter -A OUTPUT-o eth3 -j ACCEPT
#
# Aceta tudo que entra e que sai da eth3 para qualquer lugar
iptables -t filter -A INPUT-i eth3 -j ACCEPT
iptables -t filter -A OUTPUT-o eth1 -j ACCEPT
#
# Regra de Repasse
iptables -t filter -A FORWARD -s 10.1.1.0/24 -o eth3 -j ACCEPT
iptables -t filter -A FORWARD -i eth1 -o eth3 -j ACCEPT
#
#################################################
# Tbale Nat #
#################################################
#
# Masquerade para a rede interna pela eth3
iptables -t POSTROUTING -o -eth3 -j MASQUERADE
echo " Aplicando Regras ................................[ OK ]
sleep 3;