dpreviatti
(usa Slackware)
Enviado em 19/08/2008 - 19:27h
sim, consigo pingar o modem...
resolvi parte do problema, coloquei mais uma regra de icmp para ele poder pingar para fora...
mas a navegação continua sem... não consigo navegar...
vou postar aqui meu script de firewall pra vcs verem se falta alguma regra de redirecionamento..
ajuda, por favor!! :D
# Variaveis
LAN="wlan0"
WAN="eth0"
PX="3128" # porta do proxy
IP_LIVRE1="192.168.0.101"
IP_LIVRE2="192.168.0.102"
VNC="192.168.0.2"
# Ativa módulos
# -------------------------------------------------------
modprobe iptable_nat
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
modprobe ipt_LOG
modprobe ipt_REJECT
modprobe ipt_MASQUERADE
# Ativa roteamento no kernel
# -------------------------------------------------------
echo "1" > /proc/sys/net/ipv4/ip_forward
# Proteção contra IP spoofing
# -------------------------------------------------------
echo "1" > /proc/sys/net/ipv4/conf/all/rp_filter
# Zera regras
# -------------------------------------------------------
iptables -F
iptables -X
iptables -F -t nat
iptables -X -t nat
iptables -F -t mangle
iptables -X -t mangle
# Politica DROP
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT # ACEITA TODAS AS SAIDAS
# Dropa pacotes TCP indesejáveis
# -------------------------------------------------------
iptables -A FORWARD -p tcp ! --syn -m state --state NEW -j LOG --log-level 6 --log-prefix "FIREWALL: NEW sem syn: "
iptables -A FORWARD -p tcp ! --syn -m state --state NEW -j DROP
# Dropa pacotes mal formados
# -------------------------------------------------------
iptables -A INPUT -i $WAN -m unclean -j LOG --log-level 6 --log-prefix "FIREWALL: pacote mal formado: "
iptables -A INPUT -i $WAN -m unclean -j DROP
# Proteção contra tronjans
# -------------------------------------------------------
iptables -N TROJAN
iptables -A TROJAN -m limit --limit 15/m -j LOG --log-level 6 --log-prefix "FIREWALL: trojan: "
iptables -A TROJAN -j DROP
iptables -A INPUT -p TCP -i $WAN --dport 666 -j TROJAN
iptables -A INPUT -p TCP -i $WAN --dport 666 -j TROJAN
iptables -A INPUT -p TCP -i $WAN --dport 4000 -j TROJAN
iptables -A INPUT -p TCP -i $WAN --dport 6000 -j TROJAN
iptables -A INPUT -p TCP -i $WAN --dport 6006 -j TROJAN
iptables -A INPUT -p TCP -i $WAN --dport 16660 -j TROJAN
# Proteção contra worms
# -------------------------------------------------------
iptables -A FORWARD -p tcp --dport 135 -i $LAN -j REJECT
# Proteção contra syn-flood
# -------------------------------------------------------
iptables -A FORWARD -p tcp --syn -m limit --limit 2/s -j ACCEPT
# Proteção contra ping da morte
# -------------------------------------------------------
#iptables -A FORWARD -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
iptables -A FORWARD -p icmp -j ACCEPT
# Proteção contra port scanners
# -------------------------------------------------------
iptables -N SCANNER
iptables -A SCANNER -m limit --limit 15/m -j LOG --log-level 6 --log-prefix "FIREWALL: port scanner: "
iptables -A SCANNER -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -i $WAN -j SCANNER
iptables -A INPUT -p tcp --tcp-flags ALL NONE -i $WAN -j SCANNER
iptables -A INPUT -p tcp --tcp-flags ALL ALL -i $WAN -j SCANNER
iptables -A INPUT -p tcp --tcp-flags ALL FIN,SYN -i $WAN -j SCANNER
iptables -A INPUT -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -i $WAN -j SCANNER
iptables -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -i $WAN -j SCANNER
iptables -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -i $WAN -j SCANNER
# Regras para proxy transparente
# --------------------------------------------------------
#iptables -t nat -A PREROUTING -i $LAN -p tcp --dport 80 -j REDIRECT --to-port $PX
#iptables -t nat -A PREROUTING -i $LAN -p udp --dport 80 -j REDIRECT --to-port $PX
# Regra de VNC
# --------------------------------------------------------
iptables -t nat -A PREROUTING -i $WAN -p tcp --dport 5900 -j DNAT --to-destination $VNC
# Regras INPUT
# --------------------------------------------------------
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # mantem conexoes estabelecidas
iptables -A INPUT -i $LAN -p tcp --dport 22 -j ACCEPT #SSH
iptables -A INPUT -p tcp --dport 25 -j ACCEPT #SMTP
iptables -A INPUT -p tcp --dport 53 -j ACCEPT #DNS
iptables -A INPUT -p udp --dport 53 -j ACCEPT #DNS
iptables -A INPUT -p tcp --dport 80 -j ACCEPT #HTTP
iptables -A INPUT -p tcp --dport 110 -j ACCEPT #POP
iptables -A INPUT -p tcp --dport 443 -j ACCEPT #HTTPS
iptables -A INPUT -p tcp --dport 563 -j ACCEPT #NNTP
iptables -A INPUT -i $LAN -p tcp --dport $PX -j ACCEPT # aceita proxy interno
iptables -A INPUT -i $WAN -p tcp --dport $PX -j DROP # rejeita externo
iptables -A INPUT -p tcp --syn -s 192.168.0.0/24 -j ACCEPT # Conexoes internas
iptables -A INPUT -p icmp -s 0/0 -j ACCEPT # Aceitar pings
# Loga de acesso a determinadas portas
# -------------------------------------------------------
iptables -A INPUT -p tcp --dport 21 -i $WAN -j LOG --log-level 6 --log-prefix "FIREWALL: ftp: "
iptables -A INPUT -p tcp --dport 22 -i $WAN -j LOG --log-level 6 --log-prefix "FIREWALL: ssh: "
iptables -A INPUT -p tcp --dport 23 -i $WAN -j LOG --log-level 6 --log-prefix "FIREWALL: telnet: "
iptables -A INPUT -p tcp --dport 25 -i $WAN -j LOG --log-level 6 --log-prefix "FIREWALL: smtp: "
iptables -A INPUT -p tcp --dport 80 -i $WAN -j LOG --log-level 6 --log-prefix "FIREWALL: http: "
iptables -A INPUT -p tcp --dport 110 -i $WAN -j LOG --log-level 6 --log-prefix "FIREWALL: pop3: "
iptables -A INPUT -p tcp --dport 161:162 -i $WAN -j LOG --log-level 6 --log-prefix "FIREWALL: snmp: "
iptables -A INPUT -p tcp --dport 6667:6668 -i $WAN -j LOG --log-level 6 --log-prefix "FIREWALL: irc: "
iptables -A INPUT -p tcp --dport 3128 -i $WAN -j LOG --log-level 6 --log-prefix "FIREWALL: squid: "
# Regras FORWARD
# --------------------------------------------------------
iptables -A FORWARD -i $LAN -p tcp --dport 53 -j ACCEPT
iptables -A FORWARD -i $LAN -p udp --dport 53 -j ACCEPT
iptables -A FORWARD -i $LAN -p tcp --dport $PX -j ACCEPT # direciona as conexoes para o proxy
# Dropar porta 80 para os demais
iptables -A FORWARD -i $LAN -p tcp --dport 80 -j DROP
# Masquerade para o acesso externo
iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE