0

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).

Alex
  • 1,768
  • 4
  • 30
  • 51

1 Answers1

0

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.

Oliver
  • 5,883
  • 23
  • 32
  • no way to do it by playing with pref and metric? – Alex Feb 28 '13 at 09: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