[Contents] [Prev] [Next] [Index] [Report an Error]


Control Route Preference

When the JUNOS software determines a route's preference to become the active route, it selects the route with the lowest preference as the active route and installs this route into the forwarding table. By default, the routing software assigns a preference of 170 to routes that originated from BGP. Of all the routing protocols, BGP has the highest default preference value, which means that routes learned by BGP are the least likely to become the active route. (For more information about preferences, see Route Preferences.)

To modify the default BGP preference value, include the preference statement, specifying a value from 0 through 4,294,967,295 (232 - 1):

preference preference; 

You can configure the preference value for all BGP groups (at the [edit protocols bgp] hierarchy level), for all peers in a group (at the [edit protocols bgp group group-name] level), or for an individual peer (at the [edit protocols bgp group group-name neighbor address] level).

Examples: Control Route Preference

Assign a preference of 160 to routes learned from the BGP system 192.168.1.1. The routing protocol process will prefer these routes over routes learned from other BGP systems, which have the default preference of 170. For routing instances, include the statement at the [edit routing-instances routing-instance-name routing-options] hierarchy level and the [edit routing-instances routing-instance-name protocols bgp] hierarchy level.

[edit]
routing-options {
    autonomous-system 23;
}
protocols {
    bgp {
        group 23 {
            type external;
            peer-as 56;
            neighbor 192.168.1.1 {
                preference 160; 
            }
        }
    }
}

Assign a preference of 140 to all routes learned by BGP systems. Because the default OSPF preference is 150, BGP routes will be preferred over those learned from OSPF.

[edit]
routing-options {
    autonomous-system 23;
}
protocols {
    bgp {
        preference 140; 
        group 23 {
            type external;
            peer-as 56;
            neighbor 192.168.1.1;
        }
    }
}

[Contents] [Prev] [Next] [Index] [Report an Error]