flavio_gyn
(usa CentOS)
Enviado em 11/11/2014 - 12:18h
Olá
Preciso acessar um TS externo em outra rede, so que quando tento fazer o Iptables esta me direcionando para o meu servidor interno de TS alguem pode me ajudar
segue configurações;
OBS>: E O REDIRECIONAMENTO DO IP 192.168.200.100, QUANDO DE DENTRO DA REDE TENTO ACESSAR OUTRO SERVIDOR FORA SOU REDIRECIONADO PARA O IP 100
#!/bin/bash
REDE_INTERNA="192.168.200.0/24"
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
modprobe iptable_nat
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o ppp+ -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth+ -j MASQUERADE
iptables -N FACEBOOK
iptables -I FORWARD -s $REDE_INTERNA -j FACEBOOK
for face in `cat /root/list.txt`;do
iptables -A FACEBOOK -d $face -j REJECT
#LIBERANDO FACEBOOK PARA ALGUMAS MAQUINAS POR MAC NA REDE
#Jose Carlos
iptables -I FORWARD -m mac --mac-source 00:1a:80:5a:f4:d2 -d $face -j ACCEPT
done
#Liberando MAC para nao passar pelo proxy
#Diogenes
iptables -t nat -I PREROUTING -i eth1 -m mac --mac-source 48:5b:39:b1:63:5c -p tcp --dport 80 -j ACCEPT
#Jose Carlos
iptables -t nat -I PREROUTING -i eth1 -m mac --mac-source 00:1a:80:5a:f4:d2 -p tcp --dport 80 -j ACCEPT
#Redirecionado para o proxy
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
#Terminal Server (Servidor-Vanguarda)
iptables -t nat -A PREROUTING -p tcp --dport 3389 -j DNAT --to 192.168.200.100
iptables -A FORWARD -p tcp --dport 3389 -j ACCEPT
iptables -A FORWARD -p tcp --sport 3389 -j ACCEPT
iptables -A FORWARD -p udp --sport 3389 -j ACCEPT
iptables -A FORWARD -p udp --dport 3389 -j ACCEPT
iptables -A INPUT -p udp --sport 3389 -j ACCEPT
iptables -A INPUT -p udp --dport 3389 -j ACCEPT
iptables -A INPUT -p tcp --sport 3389 -j ACCEPT
iptables -A INPUT -p tcp --dport 3389 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 3389 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 3389 -j ACCEPT
iptables -A OUTPUT -p udp --sport 3389 -j ACCEPT
iptables -A OUTPUT -p udp --dport 3389 -j ACCEPT
#Terminal Server(Seridor Goias)
iptables -t nat -A PREROUTING -p tcp --dport 3388 -j DNAT --to 192.168.200.200
iptables -A FORWARD -p tcp --dport 3388 -j ACCEPT
iptables -A FORWARD -p tcp --sport 3388 -j ACCEPT
iptables -A FORWARD -p udp --sport 3388 -j ACCEPT
iptables -A FORWARD -p udp --dport 3388 -j ACCEPT
iptables -A INPUT -p udp --sport 3388 -j ACCEPT
iptables -A INPUT -p udp --dport 3388 -j ACCEPT
iptables -A INPUT -p tcp --sport 3388 -j ACCEPT
iptables -A INPUT -p tcp --dport 3388 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 3388 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 3388 -j ACCEPT
iptables -A OUTPUT -p udp --sport 3388 -j ACCEPT
iptables -A OUTPUT -p udp --dport 3388 -j ACCEPT
#Terminal Server (Servidor-DOC)
iptables -t nat -A PREROUTING -p tcp --dport 3390 -j DNAT --to 192.168.200.150
iptables -A FORWARD -p tcp --dport 3390 -j ACCEPT
iptables -A FORWARD -p tcp --sport 3390 -j ACCEPT
iptables -A FORWARD -p udp --sport 3390 -j ACCEPT
iptables -A FORWARD -p udp --dport 3390 -j ACCEPT
iptables -A INPUT -p udp --sport 3390 -j ACCEPT
iptables -A INPUT -p udp --dport 3390 -j ACCEPT
iptables -A INPUT -p tcp --sport 3390 -j ACCEPT
iptables -A INPUT -p tcp --dport 3390 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 3390 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 3390 -j ACCEPT
iptables -A OUTPUT -p udp --sport 3390 -j ACCEPT
iptables -A OUTPUT -p udp --dport 3390 -j ACCEPT
#BANCO DE DADOS - VANGUARDA (SQL)
iptables -t nat -A PREROUTING -p tcp --dport 1433 -j DNAT --to 192.168.200.100
iptables -A FORWARD -p tcp --dport 1433 -j ACCEPT
iptables -A FORWARD -p tcp --sport 1433 -j ACCEPT
iptables -A FORWARD -p udp --sport 1433 -j ACCEPT
iptables -A FORWARD -p udp --dport 1433 -j ACCEPT
iptables -A INPUT -p udp --sport 1433 -j ACCEPT
iptables -A INPUT -p udp --dport 1433 -j ACCEPT
iptables -A INPUT -p tcp --sport 1433 -j ACCEPT
iptables -A INPUT -p tcp --dport 1433 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 1433 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 1433 -j ACCEPT
iptables -A OUTPUT -p udp --sport 1433 -j ACCEPT
iptables -A OUTPUT -p udp --dport 1433 -j ACCEPT
#BANCO DE DADOS - GOIAS (SQL)
iptables -t nat -A PREROUTING -p tcp --dport 1434 -j DNAT --to 192.168.200.200
iptables -A FORWARD -p tcp --dport 1434 -j ACCEPT
iptables -A FORWARD -p tcp --sport 1434 -j ACCEPT
iptables -A FORWARD -p udp --sport 1434 -j ACCEPT
iptables -A FORWARD -p udp --dport 1434 -j ACCEPT
iptables -A INPUT -p udp --sport 1434 -j ACCEPT
iptables -A INPUT -p udp --dport 1434 -j ACCEPT
iptables -A INPUT -p tcp --sport 1434 -j ACCEPT
iptables -A INPUT -p tcp --dport 1434 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 1434 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 1434 -j ACCEPT
iptables -A OUTPUT -p udp --sport 1434 -j ACCEPT
iptables -A OUTPUT -p udp --dport 1434 -j ACCEPT