1833445 Members
3086 Online
110052 Solutions
New Discussion

default route precedence

 
Jay Cantwell
Regular Advisor

default route precedence

I tried looking through some threads and could not find a cut and dry answer to my question:

How does routing precedence take place, is the default route used first, and then statics?

Or are the static routes looked at first, and if they are not found then the default is used?

thanks...Jay
4 REPLIES 4
Jeff Schussele
Honored Contributor

Re: default route precedence

Hi Jay,

As I understand it, it all depends on how you construct the routes.
IF you set up the static routes as 0 hop & indicate the local I/F as the gateway then any traffic destined to that route will go out the specified I/F. All other traffic will go out to the default gateway.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Jay Cantwell
Regular Advisor

Re: default route precedence

Hi Jeff....

Okay with the 0 hops, unfortunately I have to set up my routes with a hop count of 1. How does this change the use of the route table ?

Jay
C. Beerse_1
Regular Advisor

Re: default route precedence

afaik, the default route is only used where the other (static) routes do not match for the target.

Only where there are more routes to the target (like multiple default routes) then all routes will be used in some order. Some routers count hops, some use metrics, check the manual for your route software for details. As far as I read `man route` on hpux, there is not much to define.
make everything as simple as possible, not simpler (A.Einstein??)
rick jones
Honored Contributor

Re: default route precedence

Closer matches to the destiation IP addresses are used first, so that would be:

1) matching host routes
2) matching (sub)network routes
3) default route

IE the default route is used last. As someone else pointed-out, when there are two otherwise identical routes, the metric will be used to pick. If the metric is the same, then it should assumed to be chance as to which is used first. Never assume that first or last set will be the order when the routes are otherwise identical.

If ip_strong_es_model is set, then source IP address as well as destination IP address is included in the route lookup, and routes with matching source IP's are used first. I do not know however, if a networking route with a matching source IP would "trump" a specific host route without matching source IP. That much has not come-up before :)
there is no rest for the wicked yet the virtuous have no pillows