Preference is the value GateD uses to order preference of routes from one protocol or peer over another. Preference can be set in the GateD configuration files in several different configuration statements. Preference can be set based on network interface over another, from one protocol over another, or from one remote gateway over another. Preference may not be used to control the selection of routes within an igp, this is accomplished automatically by the protocol based on metric. Preference may be used to select routes from the same egp learned from different peers or autonomous systems. Each route has only one preference value associated with it, even though preference can be set at many places in the configuration file. Simply, the last or most specific preference value set for a route is the value used. (See Glossary: Preference.) The preference value is an arbitrarily assigned value used to determine the order of routes to the same destination in a single routing database. The active route is chosen by the lowest preference value. Some protocols implement a second preference (preference2), sometimes refered to as a tie-breaker.
A default preference is assigned to each source from which GateD receives routes. Preference values range from 0 to 255 with the lowest number indicating the most preferred route.
The following table summarizes the default preference values for routes learned in various ways. The table lists the statements (some of these are clauses within statements) that set preference, and shows the types of routes to which each statement applies. The default preference for each type of route is listed, and the table notes preference precedence between protocols. The narrower the scope of the statement, the higher precedence its preference value is given, but the smaller the set of routes it affects.
Preference Of Defined by Statement Default direct connnected networks interface 0 OSPF routes ospf 10 IS-IS level 1 routes isis level 1 15 IS-IS level 2 routes isis level 2 18 internally generated default gendefault 20 redirects redirect 30 routes learned via route socket kernel 40 static routes from config static 60 ANS SPF (SLSP) routes slsp 70 HELLO routes hello 90 RIP routes rip 100 point-to-point interface 110 routes to interfaces that are down interfaces 120 aggregate/generate routes aggregate/generate 130 OSPF AS external routes ospf 150 BGP routes bgp 170 EGP egp 200
interfaces { interface 138.66.12.2 preference 10 ; } ; rip yes { preference 90 ; } ; import proto rip gateway 138.66.12.1 preference 75 ;
In these statements the preference applicable to routes learned via RIP from gateway 138.66.12.1 is 75. The last preference applicable to routes learned via RIP from gateway 128.66.12.1 is defined in the accept statement. The preference applicable to other RIP routes is found in the rip statement. The preference set on the interface statement applies only to the route to that interface.