mshonorato
(usa Debian)
Enviado em 13/02/2009 - 09:43h
Xiii, na verdade minha porta 80 e 22 não estão liberadas...
Não está funcionando...
vejam:
echo "Ativando as Regras de Firewall..."
echo
echo
IPTABLES="/usr/sbin/iptables"
#----INTERFACE DE REDE----
WAN="eth0"
LAN="eth1"
WIRELESS="wlan0"
REDE="10.1.0.0/24"
#----MAQUINAS-----
FIREWALL="10.1.0.1"
MARCOS="10.1.0.10"
#----MODULOS-----
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_tables
modprobe ipt_MASQUERADE
modprobe ipt_state
modprobe iptable_nat
modprobe ip_nat_ftp
modprobe ipt_LOG
modprobe ipt_REJECT
#----LIMPA TABELA NAT-----
$IPTABLES -t nat -F
$IPTABLES -t nat -X
$IPTABLES -t nat -Z
$IPTABLES -t nat -F POSTROUTING
$IPTABLES -t nat -F PREROUTING
#----LIMPA REGRAS-----
$IPTABLES -F INPUT
$IPTABLES -F OUTPUT
$IPTABLES -F FORWARD
#----SETA POLITICAS-----
$IPTABLES -P INPUT DROP
$IPTABLES -P FORWARD DROP
$IPTABLES -P OUTPUT ACCEPT
#----INPUT-----
$IPTABLES -A INPUT -i lo -j ACCEPT
$IPTABLES -A INPUT -s $REDE -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 22 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 80 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 1863 -j ACCEPT
$IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
#----FORWARD-----
$IPTABLES -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPTABLES -A FORWARD -s $MARCOS -p tcp --dport 80 -j ACCEPT
$IPTABLES -A FORWARD -s $MARCOS -p tcp --dport 22 -j ACCEPT
$IPTABLES -A FORWARD -s $MARCOS -p tcp --dport 1863 -j ACCEPT
#----NAT------
$IPTABLES -t nat -A POSTROUTING -o $WAN -j MASQUERADE
#----ROTEAMENTO----
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "Regras de Firewall Ativadas com Sucesso!!"
# EOF