Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How to make sure, on the same interface, to properly route traffic to the same subnet, based on availability of a gateway?

e.g.

10.1.1.1/24  interface eth0/1  gateway  10.1.2.1  pref 10 metric 1
10.1.1.1/24  interface eth0/1  gateway  10.1.3.1  pref 20 metric 1

this usually means while accessing, for example, 10.1.1.50 it goes via 10.1.2.1, but the problem is, when 10.1.2.1 is down (cannot ping), it will not automatically goes to the second route (it does if using 2 interfaces and the first interface physically goes down).

share|improve this question

1 Answer 1

This will require some active component.

Typically this is what a routing protocol is for. The gateways use the protocol to announce what networks they will route and your router will put the appropriate routes into its routing table. If one of the gateways disappears, its routes will be removed from your routing table and traffic will flow through the remaining routes.

Of course, if your setup is simple enough, it is also possible to achieve the same thing using a script which pings the gateways and inserts/removes routes depending on the availability of the gateways. What exactly is possible depends on your platform.

share|improve this answer
    
no way to do it by playing with pref and metric? –  Alex Feb 28 '13 at 9:50
    
No, you need to actively check if one of your gateways is no longer available. Pref and metric won't help you there. These are mainly hints that may be used by the routing protocols. –  Oliver Feb 28 '13 at 10:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.