On 3/3/11 2:35 PM, "Michael MacIsaac" <[email protected]> wrote:

>I'm asking this question on the behalf of a customer:
>I have this set up fine as far as VM is concerned, and have eth0 and eth1
>defined on Linux (RHEL 5.5).
>My problem is that the networks defined by eth0 and eth1 have different
>gateway addresses, but when both interfaces are brought up, the default
>gateway becomes the gateway of the last interface started. This renders
>the previous interfaces unusable.
>How do I configure a different gateway for each interface successfully?
>Thanks for any help or ideas you might give me,

You can't. A machine can have only one default route. You must explicitly
route address prefixes (or get this info from a dynamic routing protocol
like RIPv2 or OSPF) to a destination handled by a host on a specific
subnet, and have the kernel choose which interface handles it.

Why? Remember what a default route is: the route of last resort when there
are no other possible choices, ie what do I do with this packet if there
is no other more specific route?

To simulate what you want, you'd have to add network routes for the hosts
reachable via each interface, and specify the "current default" route for
the segment as the next-hop destination for that network range.

Example: 

Host 1 has two interfaces, eth0 and eth1. eth0 is 1.2.3.4. eth1 is
5.6.7.8. 

Networks 192.168.1.x and 192.168.2.x are reachable via 1.2.3.1.
Networks 172.22.20.x and 172.155.20.x are reachable via 5.6.7.254
If we don't know any better, we send packets to 1.2.3.1 (the default
route). 

Your routing statements would look like this:

route add default gw 1.2.3.1 metric 0
route add 192.168.1.0 255.255.255.0 gw 1.2.3.1 metric 1
route add 192.168.2.0 255.255.255.0 gw 1.2.3.1 metric 1
route add 172.22.20.0 255.255.255.0 gw 5.6.7.254 metric 1
route add 172.155.20.0 255.255.255.0 gw 5.6.7.254 metric 1

For any real network, enable quagga and get this stuff via dynamic routing
updates. Much easier, and your network people will like you much better.

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/

Reply via email to