Viewing Routes Learned by OSPF

Table of contents:

Problem

You want to check the routes that are being generated by the Dijkstra SPF calculation to make sure that the router is learning the expected routes.

Solution

Use the show ospf route command to see the contents of the OSPF routing table:

	aviva@RouterG>  
show ospf route
	Prefix Path Route NH Metric NextHop Nexthop
	 Type Type Type Interface addr/label
	192.168.17.1 Intra Router IP 1 fe-1/0/1.0 10.0.0.2
	192.168.18.1 Intra Router IP 1 fe-0/0/1.0 10.0.1.1
	10.0.0.0/24 Intra Network IP 1 fe-1/0/1.0
	10.0.1.0/24 Intra Network IP 1 fe-0/0/1.0
	10.0.2.0/24 Intra Network IP 2 fe-0/0/1.0 10.0.1.1
	 fe-1/0/1.0 10.0.0.2
	192.168.17.1/32 Intra Network IP 1 fe-1/0/1.0 10.0.0.2
	192.168.18.1/32 Intra Network IP 1 fe-0/0/1.0 10.0.1.1

Discussion

OSPF routers perform an SPF calculation to determine the best route to a destination and places these routes in its routing table. The show ospf route command displays whats in the OSPF routing table. The Prefix column shows the destinations on the network, and you also see the interface used to reach the next hop toward the destination and the IP address of that next hop.

You can find out which routes the router has learned from OSPF by checking the unicast routing table:

	aviva@RouterG> show route table inet.0
	inet.0: 11 destinations, 11 routes (11 active, 0 holddown, 0 hidden)
	+ = Active Route, - = Last Active, * = Both
	10.0.0.0/24 *[Direct/0] 3d 01:42:24
	 > via fe-1/0/1.0
	10.0.0.1/32 *[Local/0] 3d 01:42:24
	 Local via fe-1/0/1.0
	10.0.1.0/24 *[Direct/0] 3d 01:42:24
	 > via fe-0/0/1.0
	10.0.1.2/32 *[Local/0] 3d 01:42:24
	 Local via fe-0/0/1.0
	10.0.2.0/24 *[OSPF/10] 00:18:28, metric 2
	 to 10.0.1.1 via fe-0/0/1.0
	 > to 10.0.0.2 via fe-1/0/1.0
	10.0.16.0/24 *[Direct/0] 3d 01:42:24
	 > via fe-1/0/0.0
	10.0.16.2/32 *[Local/0] 3d 01:42:24
	 Local via fe-1/0/0.0
	192.168.17.1/32 *[OSPF/10] 00:18:28, metric 1
	 > to 10.0.0.2 via fe-1/0/1.0
	192.168.18.1/32 *[OSPF/10] 00:18:28, metric 1
	 > to 10.0.1.1 via fe-0/0/1.0
	192.168.19.1/32 *[Direct/0] 3d 01:40:56
	 > via lo0.0
	224.0.0.5/32 *[OSPF/10] 2d 20:52:32, metric 1
	 MultiRecv

The route entries starting with [ OSPF/10] are those learned from OSPF. The router has learned four routes from OSPF:

  • 192.168.17.1/32 and 192.168.18.1./32 are router loopback addresses that are the two OSPF neighbors we saw in the OSPF routing table.
  • 10.0.2.0/24 is a subnetwork that is the subnet between our two neighbors (which we also saw in the OSPF database).
  • 224.0.0.5/32 is the OSPF multicast address.

The routes to the two loopback addresses show up in the routing table because the router ID is configured on the routers lo0 addresses, not with the set routing-options router-id command.

The value of 10 in the brackets is the JUNOS default value for the OSPF administrative distance, also called the routing preference, which is used to select what route is installed in the forwarding table when several protocols calculate routes to the same destination. A preference of 10 is the default for internal OSPF routes, which are those within the domain. The preference value for routes outside the domain that OSPF advertises is 150. You can change the preference value by configuring the preference statement for the OSPF area. The numbers following the brackets show how long the routing table has known about the route. The metric value (either 1 or 2) is the cost to this address. Understanding the routing table is discussed more in Recipe 9.1.

You might find it strange that a multicast address, 224.0.0.5/32, is present in the inet.0 routing table, which is the unicast routing table. This is simply a result of a JUNOS design decision. Instead of establishing a separate routing table for the few multicast routes used by routing protocols for receiving protocol packets, which are well-known addresses, the JUNOS software places these routes in the unicast routing table.

You can also see just the routes learned by OSPF:

	aviva@RouterG> show route protocol ospf table inet.0
	inet.0: 14 destinations, 14 routes (14 active, 0 holddown, 0 hidden)
	+ = Active Route, - = Last Active, * = Both
	10.0.2.0/24 *[OSPF/10] 00:00:26, metric 2
	 to 10.0.1.1 via fe-0/0/1.0
	 > to 10.0.0.2 via fe-1/0/1.0
	192.168.17.1/32 *[OSPF/10] 00:00:26, metric 1
	 > to 10.0.0.2 via fe-1/0/1.0
	192.168.18.1/32 *[OSPF/10] 00:00:31, metric 1
	 > to 10.0.1.1 via fe-0/0/1.0
	224.0.0.5/32 *[OSPF/10] 00:00:42, metric 1
	 MultiRecv


Router Configuration and File Management

Basic Router Security and Access Control

IPSec

SNMP

Logging

NTP

Router Interfaces

IP Routing

Routing Policy and Firewall Filters

RIP

IS-IS

OSPF

BGP

MPLS

VPNs

IP Multicast



JUNOS Cookbook
Junos Cookbook (Cookbooks (OReilly))
ISBN: 0596100140
EAN: 2147483647
Year: 2007
Pages: 290
Authors: Aviva Garrett

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net