Qual é o gateway default do teu server?

Já fiz este tipo de roteamento.

Utilizei o proprio comando ip.

É simlpes, tu não precisa criar rotas para as duas redes, apenas a rede que
vai sair pelo GW2, pois o servidor estara saindo pelo gw1, então obviamente
uma das redes utilizara a tabela de roteamento padrão do linux e saira pelo
GW1 já a otura rede vai sair pela roda do GW2.

http://linux-ip.net/html/tools-ip-route.html

http://under-linux.org/f96/definindo-dois-gateways-usando-iproute-70735/

Abraços

*--*
Att
Marcos Carraro
marcoscarraro.blogspot.com



2012/8/20 Márcio Erli <[email protected]>

> Não consigo navegar da minha rede 192.160.7.0/24 de forma alguma.
> O que pode estar errado?
>
>
> IF_LAN='eth3'
> IF_LINK1='eth1'
> IF_LINK2='eth2'
>
> GW_LINK1='200.235.xxx.xx'
> GW_LINK2='200.195.xxx.xx'
>
> iptables -t nat -A POSTROUTING -o $IF_LINK1 -j MASQUERADE
>  iptables -t nat -A POSTROUTING -o $IF_LINK2 -j MASQUERADE
>
> iptables -t mangle -A PREROUTING -i $IF_LAN -p tcp --dport 80 -j MARK
> --set-mark 2
> iptables -t mangle -A PREROUTING -i $IF_LAN -p tcp --dport 443 -j MARK
> --set-mark 2
> iptables -t mangle -A PREROUTING -i $IF_LAN -p tcp --dport 25 -j MARK
> --set-mark 3
> iptables -t mangle -A PREROUTING -i $IF_LAN -p tcp --dport 110 -j MARK
> --set-mark 3
>
> iptables -t mangle -A OUTPUT -p tcp --dport 80 -j MARK --set-mark 2
> iptables -t mangle -A OUTPUT -p tcp --dport 443 -j MARK --set-mark 2
> iptables -t mangle -A OUTPUT -p tcp --dport 25 -j MARK --set-mark 3
> iptables -t mangle -A OUTPUT -p tcp --dport 110 -j MARK --set-mark 3
>
> ip rule add fwmark 2 table 20 prio 20
> ip rule add fwmark 3 table 21 prio 20
>
> ip rule add from 192.160.7.0/24 table 20
>
> # ip rule add from 192.170.0.0/24 table 21
>
> ip route add default via $GW_LINK1 dev $IF_LINK1 table 20
> ip route add default via $GW_LINK2 dev $IF_LINK2 table 21
>
> ip route flush cache
>
>

Responder a