Fd NeW
(usa Fedora)
Enviado em 25/11/2011 - 11:19h
Bom dia galera da VOL, venho pedir ajuda a voces pelo problema que tenho enfrentado, criei um spript no "/etc/init.d" nomeado "firewall.sh", neste adicionei as seguintes regras:
############################## Limpar regras ##############################
iptables -F #Limpa todas as regras da tabela filter
iptables -X #Deleta todas as cadeias da tabela filter
iptables -Z #Zera o contador da tabela filter
iptables -t nat -F #Limpa todas as regras da tabela NAT
iptables -t nat -X #Deleta todas as cadeias da tabela NAT
iptables -t nat -Z #Zera os contadores da tabela NAT
iptables -t mangle -F #Limpa todas as regras da tabela mangle
iptables -t mangle -X #Deleta todas as cadeias da tabela mangle
############################## Nomencla as interfaces ##############################
WAN=eth0
LAN=eth1
RINTERNA=192.168.0.0/24
############################## Libera a transmissão de pacotes ##############################
echo "1" > /proc/sys/net/ipv4/ip_forward
############################## Define Entradas ##############################
$iptables -P INPUT DROP
$iptables -P OUTPUT ACCEPT
$iptables -P FORWARD ACCEPT
############################## Libera Terminal Server ##############################
iptables -A FORWARD -p tcp --dport 3389 -j ACCEPT
iptables -t nat -A PREROUTING -d 192.168.1.9 -p tcp -m tcp --dport 3389 -j --DNAT --to 189.72.172.35:3389
############################## Liberar servicos de entrada##############################
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
############################## Liberar ping para internet ##############################
iptables -A INPUT -p icmp --icmp-type 0 -s $RINTERNA -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 8 -s $RINTERNA -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 0 -i $WAN -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 8 -i $WAN -j ACCEPT
############################## Direcionar para o SQUID ##############################
iptables -t nat -A PREROUTING -s 0/0 -p tcp --dport 80 -j REDIRECT --to-port 3128
############################## Masquerade ##############################
iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE
Não sei se estou fazendo algo errado, ou se tem que adicionar algo no inicio do script para que ele rode corretamente, mas quando executo este, ele me reporta o seguinte erro:
root@squid-VirtualBox:/etc/init.d# ./firewall.sh
: Arquivo ou diretório não encontradot/ipv4/ip_forward
iptables: Bad policy name. Run `dmesg' for more information.
iptables: Bad policy name. Run `dmesg' for more information.
iptables: Bad policy name. Run `dmesg' for more information.
'ptables v1.4.10: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.10: unknown option `--to'
Try `iptables -h' or 'iptables --help' for more information.
'ptables v1.4.10: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
'ptables v1.4.10: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
'ptables v1.4.10: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
'ptables v1.4.10: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
'ptables v1.4.10: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
'ptables v1.4.10: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
"ptables v1.4.10: REDIRECT: Bad value for "--to-ports" option: "3128
Try `iptables -h' or 'iptables --help' for more information.
'ptables v1.4.10: Invalid target name `MASQUERADE
Try `iptables -h' or 'iptables --help' for more information.
root@squid-VirtualBox:/etc/init.d#
O que acho estranho, é que que se executo cada regra separadamente, o iptables roda normalmente, liberando meus acessos e tal, alguem poderia me dar uma dica de oque estou fazendo errado?
Des de já, agradeço a atenção!
Bom dia a todos!