multihoming routing question (FC 3)
Danny Yee
danny at anatomy.usyd.edu.au
Thu May 12 06:51:07 UTC 2005
Ooops, I left something important out! In rc.local, after setting
up the tables, I'm also running:
ip route replace default scope global \
nexthop via XXX.YYY.151.254 dev eth0 weight 1 \
nexthop via XXX.YYY.131.254 dev eth1 weight 1
Which does the actual load-balancing over default routes.
Danny.
I wrote:
> I have a Fedora Core 3 machine with two ethernet cards, each connected
> to a network with a router that can be used as a default route.
> Trying to share traffic between the networks, but at the same time
> ensure that requests are responded to on the network they came in on,
> I'm running the following in rc.local
>
> # table 1 has rules for network 1
> ip route add XXX.YYY.151.0 dev eth0 src XXX.YYY.151.5 table 1
> ip route add default via XXX.YYY.151.254 table 1
> ip route add 127.0.0.0/8 dev lo table 1
>
> # table 2 has rules for network 2
> ip route add XXX.YYY.131.0 dev eth0 src XXX.YYY.131.5 table 2
> ip route add default via XXX.YYY.131.254 table 2
> ip route add 127.0.0.0/8 dev lo table 2
>
> # now use these rules
> ip rule add from XXX.YYY.151.5 table 1
> ip rule add from XXX.YYY.131.5 table 2
> I've also changed /etc/sysconfig/network-scripts/ifup,
> replacing
> ip route replace default via ${GATEWAY} ${WINDOW:+window $WINDOW} ${SRC} ${GATEWAYDEV:+dev $GATEWAYDEV}
> with
> ip route append default via ${GATEWAY} ${WINDOW:+window $WINDOW} ${SRC} ${GATEWAYDEV:+dev $GATEWAYDEV}
> -- otherwise bringing the second interface up replaces the first
> default route instead of appending it.
>
> My question is, is this the right way to do this? I suspect the
> routing tables should be set up through /etc/init.d/network and
> /etc/sysconfig/static-routes, but I'm not sure of the format of the
> latter file, or if it will allow me to set up tables and rules.
>
> I'd also like to avoid modifying ifup if that's possible.
More information about the users
mailing list