Designating Default Gateway for multiple networks/adapters

Hi

I have 4 NIC's connected to my RHEL 5.3 server. Two on one subnet creating bond0, and two on a second subnet which create bond1. Both bonds are set to use DHCP to obtain IP addresses. Here is the config file for ifcfg-bond0:

DHCP_HOSTNAME=rrnltshckvmx001
DEVICE=bond0
BOOTPROTO=dhcp
DHCPCLASS=
ONBOOT=yes
USERCTL=no

Here are the lines added to /etc/modprobe.conf:

alias bond0 bonding
options bond0 mode=active-backup miimon=100 primary=eth0
alias bond1 bonding
options bond1 mode=active-backup miimon=100

This is working wonderfully, other than the default gateway is being configured for bond1, when I need it to be configured for the network connected to bond0 instead. Is there an option I can add to either one of these to denote it as the one that the default gateway should be configured for?

Will DHCP always configure the default route for the last configured adapter? If this is the case, I can just reverse the bond0 and bond1 names as a temporary fix, but I'd still like to know if there is a configuration option or a boot time command I could issue to ensure the proper gateway is configured at each boot.

Generally you can configure default gateway via the /etc/sysconfig/network file but I've never tried to specify a bond instead of an eth. If it works for you let me know.

In /etc/sysconfig/network:

GATEWAY=<ipaddress>
GATEWAYDEV=bond0

Thank you! This solution provided the results I was looking for.