On Thu, 2006-05-25 at 12:08 +0100, Tom Brown wrote: > On a multihomed box how can i set different gateways for each NIC? > Setting them in the ifcfg-ethx does not seem to make any difference to > the routing? The gateway is not an interface but a host property, but must reside on one of the directly connected IP subnets. You can have multiple default gateways defined on your box (just keep adding them with "route add default") and once a gateway has been chosen for outbound traffic the best suited interface will be picked to get to it. Which is of course the one that's on the same IP subnet as the gateway. This works without further ado if all but one gateways are unreachable (i.e. a fail-over scenario). To take care of return traffic, your outbound connections must be masqueraded with the outbound interface's IP address. If you want to accept traffic initiated from the outside you need to tie your services to the interfaces' IP addresses you want the traffic to come in on. I.e. web server port-forwarded via eth0, mail via eth1, etc. For anything more elaborate you need to use Linux' advanced routing capabilities (Manish posted a link), and maybe even be able to inject routes into the Internet via BGP. Cheers Steffen.
Attachment:
signature.asc
Description: This is a digitally signed message part