The Last
(usa Debian)
Enviado em 07/11/2008 - 12:43h
Pessoal peguei este script aqui no site, mas com estas regras o msn nao conecta!!!
Já liberei a porta 1863 e 443 no FORWARD, mesmo assim nao vai!!!
no momento estou usando FORWARD COMO ACCEPT até arrumar isto. Depois tb vou passar o OUTPUT mas isso é pra depois.
o que ta errado neste firewall pessoal?
### Interfaces de rede
INT=eth1
EXT=eth0
echo 1 > /proc/sys/net/ipv4/ip_forward
### Mensagem de inicializaç do Firewall
echo "Ativando Regras do Firewall"
### Exclui todas as regras
iptables -t nat -F
iptables -t mangle -F
iptables -t filter -F
### Exclui cadeias customizadas
iptables -X
### Zera os contadores das cadeias
iptables -t nat -Z
iptables -t mangle -Z
iptables -t filter -Z
### Define a polÃca padrãdo firewall
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
### Regras PREROUTING
#iptables -t nat -A PREROUTING -i $EXT -p tcp --dport 3389 -j DNAT --to 192.168.0.200
#iptables -t nat -A PREROUTING -i $EXT -p tcp --dport 5900 -j DNAT --to 192.168.0.201
iptables -t nat -A PREROUTING -i $INT -p tcp --dport 80 -j REDIRECT --to-port 3128
### Regras INPUT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 0 -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 8 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -s 192.168.0.0/255.255.255.0 -d 192.168.0.1 -p tcp -m tcp --dport 3128 -j ACCEPT
#iptables -A INPUT -p tcp --dport 80 -j ACCEPT
#iptables -A INPUT -p tcp --dport 3128 -j ACCEPT
iptables -A INPUT -s 192.168.0.0/255.255.255.0 -d 192.168.0.1 -p udp -m udp --dport 53 -j ACCEPT
### Regras FORWARD
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i $INT -o $EXT -p icmp -j ACCEPT
iptables -A FORWARD -i $INT -o $EXT -p tcp --dport 25 -j ACCEPT
iptables -A FORWARD -i $INT -o $EXT -p tcp --dport 22 -j ACCEPT
iptables -A FORWARD -i $INT -o $EXT -p tcp --dport 21 -j ACCEPT
iptables -A FORWARD -i $INT -o $EXT -p tcp --dport 110 -j ACCEPT
iptables -A FORWARD -i $INT -o $EXT -p tcp --dport 443 -j ACCEPT
iptables -A FORWARD -i $INT -o $EXT -p tcp --dport 3389 -j ACCEPT
iptables -A FORWARD -i $INT -o $EXT -p tcp --dport 80 -j ACCEPT
iptables -A FORWARD -i $EXT -o $INT -p tcp --dport 3389 -j ACCEPT
iptables -A FORWARD -i $EXT -o $INT -p tcp --dport 5900 -j ACCEPT
iptables -A FORWARD -i $EXT -o $INT -p tcp --dport 1863 -j ACCEPT
iptables -A FORWARD -i $EXT -o $INT -p udp --dport 1863 -j ACCEPT
### Regras OUTPUT
iptables -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
### Regras POSTROUTING
#iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -p tcp --dport 1863 -j MASQUERADE
iptables -t nat -A POSTROUTING -o $EXT -j MASQUERADE