On Tue, Jan 22, 2013 at 10:42 PM, Roberto Scattini <
[email protected]> wrote:
> 1. the second interface, in on same subnet as the first interface....?
> no, they are completely different
>
>
>> 2. the gateway for second interface is different as the first
>> interface....?
>>
> yeah, both are different too
>
> thanks
>
>
> ps: i think we both live in argentina?
>
Sí, soy de Argentina tambien...
Cuando ejecutás "route -n" sólo ves un gateway porque asi es como lo
definiste con la linea "ip route add default via $P2"
0.0.0.0 XX.220.XX.177 0.0.0.0 UG 0 0 0 eth3
Esto es así porque no estas cargando el balanceo con ip route default
scope, como por ejemplo:
:~# ip route add default scope global nexthop via XX.220.XX.177 dev eth3
weight 1 nexthop via YY.20.YY.Y dev eth4 weight 1
:~# ip route add '127.0.0.0/8' dev lo table T1
:~# ip route add '127.0.0.0/8' dev lo table T2
:~# ip route add '192.168.100.0/24' dev eth2 table T1
:~# ip route add '192.168.100.0/24' dev eth2 table T2
Normalmente yo agrego esas lineas en el archivo /etc/rc.local para que se
ejecuten en el inicio, por supuesto tenés que haber agregado a
/etc/iproute/rt_tables los nombres de las tablas que estas usando (T1 & T2)
Yo particularmente prefiero agregar la configuración de cada subred en el
mismo archivo /etc/network/interfaces, en el ejemplo a continuación es como
lo tengo en uno de mis servers)
auto eth3
iface eth3 inet manual
pre-up ip link set eth3 up
post-up ip addr add XX.220.XX.178/30 brd + dev eth3
post-up ip route add XX.220.XX.176 dev eth3 src XX.220.XX.178 table
T1
post-up ip route add default via XX.220.XX.177 table T1
post-up ip rule add from XX.220.XX.178 table T1
auto eth4
iface eth4 inet manual
pre-up ip link set eth4 up
post-up ip addr add YY.20.YY.3/24 brd + dev eth4
post-up ip route add YY.20.YY.0 dev eth4 src YY.20.YY.3 table T2
post-up ip route add default via YY.20.YY.2 table T2
post-up ip rule add from YY.20.YY.3 table T2
Y listo!
Con eso básicamente sale andando y vas a tener balanceo y ambas interfaces
públicas van a escuchar y poder hacer NAT al webserver en tu red privada,
aunque obviamente ya dependes de iptables para eso.
Saludos
--
"La Voluntad es el único motor de nuestros logros"
http://ngen.com.ar/blog