removido
(usa Nenhuma)
Enviado em 07/05/2009 - 12:38h
boa tarde galera do VivaoLinux!
to com esse script de firewall.sh aqui na empresa.
o problema é que não consigo executar ele com sh /etc/rc.local.
sou iniciante em linux e tudo que tenho feito é sobre pesquisas.
se alguém puder me ajudar, ficarei grato;
segue abaixo script.
#!/bin/bash
#INSIRA A CLASSE DE REDE ex: 192.168.0.0/24
REDE="192.168.0.0/24"
#INSIRA O IP DO MICRO QUE NAO VAI USAR PROXY
IPLIVRE="192.168.0.101"
#O IP ACIMA EH DO SERVIDOR DE DADOS (AD)
#INSIRA AS INTERFACES DE REDE
ETH_REDE="eth1"
ETH_INTERNET="eth0"
iptables -F
iptables -X
iptables -Z
iptables -t nat -F
iptables -t nat -X
iptables -t nat -Z
modprobe ip_conntrack
modprobe ip_tables
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
modprobe ipt_MASQUERADE
modprobe iptable_filter
modprobe iptable_nat
modprobe iptable_mangle
modprobe ipt_LOG
modprobe ipt_multiport
modprobe ip_queue
modprobe ipt_REDIRECT
modprobe ipt_state
modprobe ipt_ttl
iptables -A INPUT -m state --state INVALID -j DROP
iptables -A INPUT -m state --state RELATED, ESTABLISHED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
#LIBERACAO PARA A REDE INTERNA
iptables -A INPUT -s "$REDE" -i "$ETH_REDE" -j ACCEPT
#iptables -A INPUT -s 200.171.58.201 -p tcp --dport 22 -j ACCEPT
#iptables -A INPUT -s 201.31.136.16 -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -s 0/0 -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -S 0/0 -P udp --dport 53 -j ACCEPT
iptables -A INPUT -s 0/0 -p tcp --dport 53 -j ACCEPT
iptables -P FORWARD DROP
#PACOTES ESTABELECIDOS
iptables -A FORWARD -i "$ETH_INTERNET" -o "$ETH_REDE" -s 0/0 -d "$REDE" -m state --state RELATED,ESTABLISHED -j ACCEPT
#AUTENTICACAO DA TELEFONICA
iptables -A FORWARD -i "$ETH_REDE" -o "$ETH_INTERNET" -s $REDE -d 201.28.214.82/0 -j ACCEPT
#IP LIBERADO
iptables -A FORWARD -i "$ETH_REDE" -o "$ETH_INTERNET" -s "$IPLIVRE" -d 0/0 -j ACCEPT
#LIBERA A SAIDA DA REDE LOCAL PARA A INTERNET
iptables -A FORWARD -i "$ETH_REDE" -o "$ETH_INTERNET" -s $REDE -D 0/0 -j ACCEPT
#ACESSO VIA TERMINAL SERVICE (TS)
#iptables -I FORWARD -d 192.168.0.101 -p tcp --dport 3389 -j ACCEPT
#iptables -I FORWARD -s 192.168.0.101 -j ACCEPT
#iptables -I FORWARD -d 192.168.0.100 -p tcp --dport 3389 -j ACCEPT
#iptables -i FORWARD -s 192.168.0.100 -j ACCEPT
#iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 3392 -j DNAT --to-destination 192.168.0.100:3389
#iptables -t nat -A PREROUTING -s 0/0 -d 20.0.0.1 -p tcp --dport 3391 -j DNAT --to 192.168.0.101
iptables -I INPUT -d 201.27.86.35 -p tcp --dport 3389 -j ACCEPT
iptables -I FORWARD -d 192.168.0.101 -p tcp --dport 3389 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -d 201.27.86.35 -p tcp --dport 3389 -j DNAT --to-destination 192.168.0.101:3389
iptables -I INPUT -d 201.27.86.35 -p udp --dport 3389 -j ACCEPT
iptables -I FORWARD -d 192.168.0.101 -p udp --dport 3389 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -d 201.27.86.35 -p udp --dport 3389 -j DNAT --to-destination 192.168.0.101:3389
#LOG DA REDE
#iptables -I FORWARD -j LOG --log-prefix " ROUTE : "
#NAT REDE INTERNA
iptables -t nat -A POSTROUTING -s "$REDE" -o "$ETH_INTERNET" -j MASQUERADE
iptables -t nat -A POSTROUTING -s "$REDE" -o eth2 -j MASQUERADE
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 31
abaixo o erro:
[root@fw-tim ~]# sh /root/firewall.sh
/root/firewall.sh: line 17: iptables: command not found
/root/firewall.sh: line 18: iptables: command not found
/root/firewall.sh: line 19: iptables: command not found
/root/firewall.sh: line 20: iptables: command not found
/root/firewall.sh: line 21: iptables: command not found
/root/firewall.sh: line 22: iptables: command not found
/root/firewall.sh: line 25: modprobe: command not found
/root/firewall.sh: line 26: modprobe: command not found
/root/firewall.sh: line 27: modprobe: command not found
/root/firewall.sh: line 28: modprobe: command not found
/root/firewall.sh: line 29: modprobe: command not found
/root/firewall.sh: line 30: modprobe: command not found
/root/firewall.sh: line 31: modprobe: command not found
/root/firewall.sh: line 32: modprobe: command not found
/root/firewall.sh: line 33: modprobe: command not found
/root/firewall.sh: line 34: modprobe: command not found
/root/firewall.sh: line 35: modprobe: command not found
/root/firewall.sh: line 36: modprobe: command not found
/root/firewall.sh: line 37: modprobe: command not found
/root/firewall.sh: line 38: modprobe: command not found
/root/firewall.sh: line 40: iptables: command not found
/root/firewall.sh: line 44: iptables: command not found
/root/firewall.sh: line 45: iptables: command not found
/root/firewall.sh: line 46: iptables: command not found
/root/firewall.sh: line 50: iptables: command not found
/root/firewall.sh: line 55: iptables: command not found
/root/firewall.sh: line 56: iptables: command not found
/root/firewall.sh: line 57: iptables: command not found
/root/firewall.sh: line 59: iptables: command not found
/root/firewall.sh: line 62: iptables: command not found
/root/firewall.sh: line 65: iptables: command not found
/root/firewall.sh: line 68: iptables: command not found
/root/firewall.sh: line 73: iptables: command not found
/root/firewall.sh: line 86: iptables: command not found
/root/firewall.sh: line 87: iptables: command not found
/root/firewall.sh: line 88: iptables: command not found
/root/firewall.sh: line 91: iptables: command not found
/root/firewall.sh: line 92: iptables: command not found
/root/firewall.sh: line 93: iptables: command not found
/root/firewall.sh: line 101: iptables: command not found
/root/firewall.sh: line 102: iptables: command not found
/root/firewall.sh: line 103: iptables: command not found