leandrobrunoo
(usa Ubuntu)
Enviado em 21/06/2010 - 09:22h
Gente oque a de errado com essas regras, ou sera que estao certas. ?
#!/bin/bash
# Limpando as regras
iptables -F
iptables -t filter -F
iptables -t nat -F
iptables -t mangle -F
# Compartilha a conexão
modprobe iptable_nat
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
# Porta do ssh
iptables -A INPUT -p tcp --destination-port 22 -j LOG
iptables -A INPUT -p tcp --destination-port 22 -j ACCEPT
# Liberando tráfego do túnel
route add -net 10.1.1.0 netmask 255.255.255.0 gw 10.6.0.1 dev tun0
# Porta do squid tcp udp
iptables -A INPUT -p tcp --destination-port 3128 -j ACCEPT
iptables -A INPUT -p udp --destination-port 3128 -j ACCEPT
# Redireciona todo o trafego para a porta do squid 3128
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 80 -j REDIRECT --to-port 3128
# Geovision
iptables -t nat -A PREROUTING -i ppp0 -p tcp -m tcp --dport 9090 -j DNAT --to-destination 10.0.0.5:9090
iptables -t nat -A PREROUTING -i ppp0 -p tcp -m tcp --dport 9001 -j DNAT --to-destination 10.0.0.5:9001
iptables -t nat -A PREROUTING -i ppp0 -p tcp -m tcp --dport 9002 -j DNAT --to-destination 10.0.0.5:9002
iptables -t nat -A PREROUTING -i ppp0 -p tcp -m tcp --dport 9003 -j DNAT --to-destination 10.0.0.5:9003
# Conectividade Social da Caixa
iptables -t nat -A PREROUTING -p tcp -d 200.201.0.0/16 -j ACCEPT
iptables -A FORWARD -p tcp -d 200.201.0.0/16 -j ACCEPT
# Abre para a rede local
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p tcp --syn -s 10.0.0.0/255.255.255.0 -j ACCEPT
# Fecha o resto
iptables -A INPUT -p tcp --syn -j DROP
# Ativando as regras
iptables -t filter -P FORWARD ACCEPT