What is the order of preference for choosing the router ID of an OSPF router?

Hierarchy Level

[edit logical-systems logical-system-name routing-instances routing-instance-name routing-options],
[edit logical-systems logical-system-name routing-options],
[edit routing-instances routing-instance-name routing-options],
[edit routing-options]

Description

Specify the routing device’s IP address.

The router identifier is used by BGP and OSPF to identify the routing device from which a packet originated. The router identifier usually is the IP address of the local routing device. If you do not configure a router identifier, the IP address of the first interface to come online is used. This is usually the loopback interface. Otherwise, the first hardware interface with an IP address is used.

Note:

We strongly recommend that you configure the router identifier under the [edit routing-options] hierarchy level to avoid unpredictable behavior if the interface address on a loopback interface changes.

You must configure a router-id in order for BGP and OSPF to function in a routing instance. Use the show route instance detail command to display the router-id value for a routing instance. If the router-id is 0.0.0.0, then the routing instance has no router-id.

For more information about the router identifier in OSPF, see Example: Configuring an OSPF Router Identifier.

Note:

If you run OSPF for IPv6 or BGP for IPv6 in a routing instance, you must configure an IPv4 router identifier (router-id) in the routing instance itself. In other words, the IPv4 router-id in the main routing instance is not inherited by other routing instances. Even if you run only IPv6 OSPF or BGP in a routing instance, the IPv4 router-id must be configured because OSPF and BGP, even when used exclusively with IPv6, use the IPv4 router-id for handshaking. If you do not configure the IPv4 router-id in the IPv6 OSPF or BGP routing instance, then the IPv6 protocols will use invalid IPv4 address 0.0.0.0 and the adjacencies and connections will fail.

When you configure a router ID with an IP address that differs from the BGP local address for EVPN routing instances, you must also configure a policy that exports the local IP address for BGP routes. This ensures that EVPN traffic will be properly routed. For more information on exporting BGP routes, see Basic BGP Routing Policies.

Options

address—IP address of the routing device.

  • Default: Address of the first interface encountered by Junos OS

Starting in Junos OS Release 20.4R1, you can establish a BGP connection with the BGP identifier that is a 4-octet, unsigned, and non-zero integer and it needs to be unique only within the Autonomous System (AS) per RFC6286, Autonomous-System-Wide Unique BGP Identifier for BGP-4

Required Privilege Level

routing—To view this statement in the configuration.

routing-control—To add this statement to the configuration.

Release Information

Statement introduced before Junos OS Release 7.4.

Open Shortest Path First (OSPF) is a link state routing protocol that supports hierarchical routing by allowing the domain to be divided into multiple areas for better manageability and scalability. Depending on the point where a network is sourced, there are various types of routes that could be present in a OSPF domain. When there are multiple routes to a particular network in a OSPF domain, the type of the route influences the route that is selected and installed by the router in the routing table. In OSPF, routes that are learned by a router from OSPF sources within the same area are known as inta-area routes. Routes that originate from an OSPF router in a different area are considered as inter-area routes. Certain networks could belong to a domain outside OSPF, which could then be redistributed into the OSPF by an Autonomous System Boundary Router (ASBR). Such routes are considered external routes. They can be further divided into external type-1 or external type-2 routes, depending on how they are advertised while being redistributing on the ASBR. The difference between these two types is the way in which the metric for the route is calculated. OSPF-running routers use these criteria to select the best route to be installed in the routing table:

A) When there are multiple routes available to the same network with different route types, routers use this order of preference (from highest to lowest): 1. Intra-area routes. 2. Inter-area routes. 3. External Type-1 routes. 4. External Type-2 routes.
B) If there are multiple routes to a network with the same route type, the OSPF metric calculated as cost based on the bandwidth is used for selecting the best route. The route with the lowest value for cost is chosen as the best route.
C) If there are multiple routes to a network with the same route type and cost, it chooses all the routes to be installed in the routing table, and the router does equal cost load balancing across multiple paths.

For more information refer to:

View more Cisco How-To Tutorials

http://www.BradReese.Com

Brad Reese is research manager at BradReese.Com, advancing the careers of 600,000-plus certified individuals in the growing Cisco Career Certification Program.

Copyright © 2008 IDG Communications, Inc.

What is order of preference for router ID selection in OSPF?

OSPF uses the following criteria to select the router ID: Manual configuration of the router ID. Highest IP address on a loopback interface. Highest IP address on a non-loopback interface.

How is the router ID chosen in OSPF?

If there is no OSPF Router ID configured, the highest IP address on any of the Routers Loopback Interfaces is selected as the OSPF Router ID. If there is no Loopback Interfaces configured, the highest IP address on its active interfaces is selected as the OSPF Router ID.

What will an OSPF router prefer to use first as a router ID?

So when OSPF is going through the process, it looks for the highest IP address associated with the loopback interface first. If it doesn't find a loopback interface that's when it'll look at the active physical interfaces. So those physical interfaces that are up/up and then use the highest IP address out of those.

Which of the following is the order of precedence for choosing the router ID?

The order of precedence by which a Router selects it's Router ID is as follows: Router ID set manually using the router-id command. Highest active Loopback IP address. Highest active Interface IP address.