dvieira
(usa CentOS)
Enviado em 28/10/2014 - 10:31h
Muito Obrigado pela ajuda.
Consegui resolver o problema.
Coloquei as regras que me indicou e corrigi o ip route e ip rule e agora esta funcionanado.
Ficou assim:
IP ROUTE - IP RULE
# Configuração Link Internet 1
ip route add xxx.xxx.xxx.xxx/xx dev eth2 src IPxxx.xxx.xxx.xxx table link1
ip route add default via GWxxx.xxx.xxx.xxx table link1
# Configuração Link Internet 2
ip route add xxx.xxx.xxx.xxx/xx eth1 src IPxxx.xxx.xxx.xxx table link2
ip route add default via GWxxx.xxx.xxx.xxx table link2
# GW padrao Link Internet 1
ip rule add from GWxxx.xxx.xxx.xxx table link1
# GW Padrão Link Internet 2
ip rule add from GWxxx.xxx.xxx.xxx table link2
# Marcando os pacotes
ip rule add fwmark 1 prio 3 table link1
ip rule add fwmark 2 prio 2 table link2
# Balanceando os links
ip route add default scope global nexthop via GWxxx.xxx.xxx.xxx dev eth1 weight 2 nexthop via GWxxx.xxx.xxx.xxx dev eth2 weight 1
IPTABLES
# Politicas padrão do Iptables
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
# Iptables tabela Filter
# INPUT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth0 -s $REDE-DMZ -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state INVALID -j DROP
# FORWARD
iptables -A FORWARD -s $REDE-DMZ -i eth0 -j ACCEPT
iptables -A FORWARD -i eth2 -d $IP-DMZ-SERVER -j ACCEPT
iptables -A FORWARD -i eth2 -d $IP-DMZ-SERVER1 -j ACCEPT
iptables -A FORWARD -i eth2 -d $IP-DMZ-SERVER2 -j ACCEPT
iptables -A FORWARD -i eth2 -d $IP-DMZ-SERVER3 -j ACCEPT
iptables -A FORWARD -i eth2 -d $IP-DMZ-SERVER4 -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j ACCEPT
iptables -A FORWARD -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
# Iptables tabela Nat
# PREROUTING
iptables -t nat -A PREROUTING -i eth2 -p tcp --dport 1723 -j DNAT --to-destination $IP-DMZ-SERVER:1723
iptables -t nat -A PREROUTING -i eth2 -p tcp --dport 1701 -j DNAT --to-destination $IP-DMZ-SERVER:1701
iptables -t nat -A PREROUTING -i eth2 -p tcp --dport 21 -j DNAT --to-destination $IP-DMZ-SERVER1:21
iptables -t nat -A PREROUTING -i eth2 -p tcp -m multiport --dports 3130,34567,34599 -j DNAT --to-destination $IP-DMZ-SERVER2
iptables -t nat -A PREROUTING -i eth2 -p tcp --dport 80 -j DNAT --to-destination $IP-DMZ-SERVER3:80
iptables -t nat -A PREROUTING -i eth2 -p tcp --dport 443 -j DNAT --to-destination $IP-DMZ-SERVER4:443
# POSTROUTING
iptables -t nat -A POSTROUTING -s $REDE-DMZ -o eth1 -j MASQUERADE
iptables -t nat -A POSTROUTING -s $REDE-DMZ -o eth2 -j MASQUERADE
# Iptables tables Mangle - Marcação dos pacotes que entram pelo Link Internet 1
# PREROUTING
iptables -t mangle -I PREROUTING -i eth2 -p tcp --dport 21 -j CONNMARK --set-mark 0x2
iptables -t mangle -I PREROUTING 2 -i eth2 -p tcp --dport 80 -j CONNMARK --set-mark 0x2
iptables -t mangle -I PREROUTING 3 -i eth2 -p tcp --dport 3130 -j CONNMARK --set-mark 0x2
iptables -t mangle -I PREROUTING 4 -i eth2 -p tcp --dport 34567 -j CONNMARK --set-mark 0x2
iptables -t mangle -I PREROUTING 5 -i eth2 -p tcp --dport 34599 -j CONNMARK --set-mark 0x2
iptables -t mangle -I PREROUTING 6 -i eth2 -p tcp --dport 1723 -j CONNMARK --set-mark 0x2
iptables -t mangle -I PREROUTING 7 -i eth2 -p tcp --dport 1701 -j CONNMARK --set-mark 0x2
iptables -t mangle -I PREROUTING 8 -i eth2 -p tcp --dport 443 -j CONNMARK --set-mark 0x2
iptables -t mangle -A PREROUTING ! -i eth2 -m connmark --mark 0x2 -j MARK --set-mark 0x2