RE: Two NICs, one box...


Subject: RE: Two NICs, one box...
From: Leif Sawyer (lsawyer@gci.com)
Date: Thu Nov 29 2001 - 08:41:57 AKST


Thomas Hogland writes:
>
> Simple enough, right?

Well, it sure sounds simple! Actually, I'm doing this right now
at my house.

I've got a small P-133 acting as a firewall/router with 3 NIC's.
2 3c509's and 1 NE-2000 clone.

The NE2000 is eth0, connected to my internal lan. NAT is enabled
on this interface for all outbound traffic.

The 3c509's are my outside networks.
eth1 is the cable network
eth2 is the DSL network

both have static IP's, however due to issues with the DSL modem, I must
run the DHCPclient in order for the modem to recognize the IP address
that it can allow through. (it's really weird that way)

> Only thing is, if I bring them both online at once,
> I have awful problems with keeping stable
> links up. I figured I'd compile two kernels, one NIC driver
> in each one, then reboot if I needed to change.
> Unfortunately, the 3com is on DSL (with a static IP,
> one subnet mask and gateway) and the Linksys is on cable (DHCP IP,
> different subnet and gateway). So, /etc/network/interfaces can be
> set correctly for one, but then is wrong for the other.

Not sure what you mean by stable networks.

I don't define a default gw in the network config files:
RH'ism, caveat emptor:
/etc/sysconfig/network-scripts/
        ifcfg-eth0
        ifcfg-eth1
        ifcfg-eth2
 
> Anyone have a good idea for how to make this work nicely?
>
> Best I figured is to set up the static IP info, then when I reboot
> to cable I can manually run the DHCP client and it will correct things.
> I figure there *must* be a better way, though. Can't find a good HowTo
> on it on LDP, unfortunately...
>
> Pointers and tips gratefully appreciated :-)

I do have a startup script, called from /etc/rc.d/init.d (in the various
run-levels)
which configures my firewall rules and sets the default gateway.

I use the iproute 2 tools:

ip route add default via $ETH2-DEF-GW dev eth2 src $ETH2-IP-ADDR metric 1
ip route add default via $ETH1-DEF-GW dev eth1 src $ETH1-IP-ADDR

this gets my two default routes, with a preference over the cable networks.

I can also add static routes to specific netblocks via a specific interface
when I need to, but usually don't.

Note that this is very kludgy - and it doesn't work from the outside like it
would seem.
but it seems to work from the inside -- not that i've noticed either network
being down, nor
have i really tested it by doing the 'unplug' test.

You could probably write a script to monitor the load on the various
interfaces,
figure out what network destinations were, add them to the static route
table, and flip the
default gateway to your other interface -- of course, this presumes that you
have a method
of cleaning up old route entries. But this would be one way to achieve a
sort of outbound
load-balancing without using dynamic routing to your providor(s)



This archive was generated by hypermail 2a23 : Thu Nov 29 2001 - 08:42:01 AKST