Home‎ > ‎Routing Theory‎ > ‎OSPF‎ > ‎

Configuring OSPF


1. Introduction

In this section, you'll be presented with the steps involved in configuring OSPF over various physical network types. In addition, you will learn the commands to verify OSPF configurations. After you have learned the material in this section, the following labs will allow you to get some hands-on practice using these concepts.

2. Configuring OSPF

2.1 Enabling OSPF

As with other routing protocols, enabling OSPF requires that you:

  1. Create an OSPF routing process.
  2. Specify the range of IP addresses to be associated with the routing process, and assign area IDs to be associated with that range of IP addresses.

Use the following commands, starting in global configuration mode:

Step Command Purpose
1. router ospf process-id Enable OSPF routing, placing you in router configuration mode.
2. network address wildcard-mask area area-id Define an interface on which OSPF runs and define the area ID for that interface.

The OSPF process ID is a numerical value that is local to the router. It does not have to match any process IDs that might be running on other routers. It is possible to run more than one process on the same router. However, this will create multiple databases and cause more overhead on the router.

The wildcard mask in the network command allows a user to configure multiple interfaces into the same area with a single configuration line. The wildcard mask is an inverse mask and is used the same as an inverse mask with access lists.

The area ID is the area in which the interface(s) will be configured. It can be an integer 0 to 4294967295 or it can take the form of a dotted decimal number such as 0.0.0.0.


Router_D:
2A01  ! -- conf interfaces
2A02 interface ethernet 0
2A03 ip address 170.170.3.4 255.255.255.0
2A04 interface serial 0
2A05 ip address 170.170.7.4 255.255.255.0
2A06 !
2A07 ! -- enable ospf on router D
2A08 router ospf 7
2A09 network 170.170.3.0 0.0.0.255 area 0
2A10 network 170.170.7.0 0.0.0.255 area 51

In above example, the router ospf 7 command enables OSPF on Router_D. The first network command enables OSPF on interface Ethernet 0 and puts it in area 0. The second network statement enables OSPF on interface serial 0 and puts it in area 51.

Note that network area commands are executed consecutively. The second network area command affects only interfaces that do not match the first command. For example:

Masking Example: Area2 will not be used
2B01  ! -- one network that stomps on the other
2B02 router ospf 7
2B03 network 100.100.0.0 0.0.255.255 area 0
2B04 network 100.100.10.0 0.0.0.255 area 2

All interfaces with an IP address of 100.100.x.x will be placed into area 0; therefore, the second network area command is never applied.

2.2 Configuring OSPF Interface Parameters

As mentioned before, OSPF exchanges Hello packets on each OSPF-enabled segment. This is a form of keepalives as well as a method for neighbor discovery and DR/BDR election. The rate at which OSPF sends the hello packets out is called the "Hello Interval." The amount of time an OSPF router will wait for a hello packet before declaring the neighbor down is called the "Dead Interval." OSPF requires that these intervals be the same between two neighbors; otherwise the two routers will not become OSPF neighbors.

Use the following commands to modify these parameters on an interface basis:

Command Purpose
ip ospf hello-interval seconds Specify the length of time between the hello packets that the Cisco IOS® software sends on an OSPF interface.
ip ospf dead-interval seconds Set the number of seconds that a device's hello packets must not have been seen before its neighbors declare the OSPF router down.

An OSPF interface parameter that plays a very important role in the election of the DR and BDR is the OSPF priority. On a given segment the router with the highest priority will become the DR. If the priorities are the same, the DR will be the router with the highest router ID. To reiterate, the router ID is defined as the highest numerical ip address of the router's interfaces or the highest loopback ip address if it exists at the time that OSPF was configured on the router. If a user wishes a particular router to become the DR or if the user wishes that a particular router not be eligible as a DR/BDR, the following command can be used to modify the OSPF interface priority:

Command Purpose
ip ospf priority number Set priority to help determine the OSPF-designated router for a network.

If the ospf priority on the interface is set to 0, then the router can never become the DR or BDR for that network segment.

The metric that OSPF uses to determine shortest path is called the OSPF cost. This interface parameter can also be modified in order to manipulate routing decisions. The command follows:

Command Purpose
ip ospf cost cost Explicitly specify the cost of sending a packet on an OSPF interface.

OSPF interface parameters can be viewed with the command show ip ospf interface, as seen in the following example:

Viewing the OSPF interface parameters
2C01  ! -- at the command prompt
2C02 Router_D# show ip ospf interface ethernet 0
2C03 Ethernet0 is up, line protocol is up
2C04 Internet Address 170.170.3.4/24, Area 0
2C05 Process ID 7, Router ID 170.170.8.4, Network Type BROADCAST, Cost: 10
2C06 Transmit Delay is 1 sec, State BDR, Priority 1
2C07 Designated Router (ID) 170.170.13.3, Interface address 170.170.3.3
2C08 Backup Designated router (ID) 170.170.8.4, Interface address 170.170.3.4
2C09 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
2C10 Hello due in 00:00:08
2C11 Index 1/1, flood queue length 0
2C12 Next 0x0(0)/0x0(0)
2C13 Last flood scan length is 0, maximum is 3
2C14 Last flood scan time is 0 msec, maximum is 0 msec
2C15 Neighbor Count is 2, Adjacent neighbor count is 2
2C16 Adjacent with neighbor 170.170.3.2
2C17 Adjacent with neighbor 170.170.13.3 (Designated Router)
2C18 Suppress hello for 0 neighbor(s)
2C19 Router_D#

2.3 Configuring OSPF over Different Physical Networks

As mentioned above, OSPF classifies networks as being broadcast, NBMA, or point-to-point.

When configuring OSPF over NBMA networks, special care should be taken. Most NBMA networks, such as Frame Relay, are partially meshed networks and the physical topology does not provide the multi-access connectivity that OSPF assumes is there. The selection of DR becomes a very important issue because the DR and BDR have to have physical connectivity to all the neighboring routers. The neighbor command is used to give the DR/BDR a static list of all other routers attached to the network. This is needed because of the lack of broadcast capabilities.

The command follows:

Command: neighbor ip-address [priority number] [poll-interval seconds]
Purpose: Configure a router interconnecting to nonbroadcast networks.

In the above command, the IP address and priority are values given to the neighbor. The poll interval is the amount of time a NBMA interface will wait before sending a hello to a presumably dead neighbor.

Note that after the release of Cisco IOS 10.0, the neighbor command is not necessary. There are other ways of running OSPF over NBMA networks that are much more efficient.

2.4 Point-to-Point Subinterfaces

The use of subinterfaces is a way to split a physical interface into multiple logical interfaces. Each subinterface can be defined as point-to-point. A point-to-point subinterface has the properties of any physical point-to-point interface. As far as OSPF is concerned, an adjacency is always formed over a point-to-point network without electing a DR or BDR.

One drawback of point-to-point subinterfaces is that each point-to-point segment requires its own subnet.

The following is an example of configuring point-to-point subinterfaces with OSPF.

In the topology below, the serial 2 interface of Router_F can be logically split into two point-to-point subinterfaces. Each subinterface is assigned an address out of a unique subnet. Router_G and Router_H also have a subinterface configured.


Excerpts from the configurations for Router_F and Router_G follow:

Point to Point Config: Router_F Point to Point Config: Router_G:
2D01  ! -- define the primary interface 
2D02 interface Serial2
2D03 no ip address
2D04 encapsulation frame-relay
2D05 frame-relay lmi-type ansi
2D06 !
2D07 ! -- define the 1st subinterface
2D08 interface Serial2.7 point-to-point
2D09 ip address 170.170.11.6 255.255.255.0
2D10 frame-relay interface-dlci 101
2D11 !
2D12 ! -- define the 2nd subinterface
2D13 interface Serial2.8 point-to-point
2D14 ip address 170.170.10.6 255.255.255.0
2D15 frame-relay interface-dlci 103
2D16 !
2D17 ! -- Set the ospf areas
2D18 router ospf 7
2D19 network 170.170.11.0 0.0.0.255 area 0
2D20 network 170.170.10.0 0.0.0.255 area 0
2E01  ! -- define the primary interface 
2E02 interface Serial0
2E03 no ip address
2E04 encapsulation frame-relay
2E05 frame-relay lmi-type ANSI
2E06 !
2E07 ! -- define the subinterface
2E08 interface Serial0.6 point-to-point
2E09 ip address 170.170.11.7 255.255.255.0
2E10 frame-relay interface-dlci 110
2E01 !
2E02 ! -- Set the ospf areas
2E13 router ospf 7
2E14 network 170.170.11.0 0.0.0.255 area 0

2.5 Selecting Interface Network Types

The following command can be used to define the network type of an OSPF interface:

Command ip ospf network {broadcast | non-broadcast | {point-to-multipoint [non-broadcast] }}
Purpose Configure the OSPF network type for a specified interface.

Each network type that can be configured with the above command will be explained below.

2.6 Point-to-Multipoint Interfaces

A point-to-multipoint interface is defined as a numbered point-to-point interface that has multiple neighbors. Users do not have to worry about having a subnet for each point-to-point link, and the "NBMA cloud" could be configured as one subnet. Since the links are still considered point-to-point, the user would not have to worry about the election of DR and BDR. Point-to-multipoint exchanges additional link-state updates that contain descriptions of the connectivity to the neighboring routers, resulting in host routes for all the neighbors.

An example of how point-to-multipoint is configured follows:


Following are excerpts from the configurations of Router_F and Router_G in the above topology.

Point to Multipoint Config: Router_F Point to Multipoint Config: Router_G
2F01  ! -- define the serial interface
2F02 interface Serial1
2F03 ip address 170.170.9.5 255.255.255.0
2F04 no ip mroute-cache
2F05 encapsulation frame-relay
2F06 !
2F07 ! -- define the ospf point to multipoint
2F08 ip ospf network point-to-multipoint
2F09 frame-relay map ip 170.170.9.7 121 broadcast
2F10 frame-relay map ip 170.170.9.8 123 broadcast
2F11 !
2F12 ! -- define the ospf router
2F13 router ospf 7
2F14 network 170.170.9.0 0.0.0.255 area 0
2G01  ! -- define the serial interface
2G02 interface Serial0
2G03 no ip address
2G04 encapsulation frame-relay
2G05 frame-relay lmi-type ANSI
2G06 !
2G07 ! - define the subinterface
2G08 interface Serial0.5 multipoint
2G09 ip address 170.170.9.7 255.255.255.0
2G10 !
2G11 ! -- define the ospf point to multipoint
2G12 ip ospf network point-to-multipoint
2G13 frame-relay map ip 170.170.9.5 112 broadcast
2G14 !
2G15 ! -- define the ospf router
2G16 router ospf 7
2G17 network 170.170.9.0 0.0.0.255 area 0

As mentioned earlier, when point-to-multipoint interfaces are configured, host routes are generated for all the neighbors. This can be seen in the output from a show ip route on

Showing the Host Routes on Router_E
2H01  ! -- notice the host routes (/32)
2H02 Router_E# show ip route
2H03 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
2H04 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
2H05 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
2H06 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
2H07 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
2H08 U - per-user static route, o - ODR
2H09
2H10 Gateway of last resort is not set
2H11 170.170.0.0/16 is variably subnetted, 5 subnets, 2 masks
2H12 O 170.170.9.8/32 [110/64] via 170.170.9.8, 00:07:01, Serial1
2H13 C 170.170.9.0/24 is directly connected, Serial1
2H14 O 170.170.9.7/32 [110/64] via 170.170.9.7, 00:07:01, Serial1
2H15 Router_E#

Because of these host routes, Router_G will not need a Frame Relay map statement for Router_H, and Router_H will not need one for Router_G.

Also note there is not a DR or BDR elected on a point-to-multipoint interface:

No DR on point to multipoint interface: Router_E
2I01  ! -- no DR or BDR
2I02 Router_E# show ip ospf interface serial 1
2I03 Serial1 is up, line protocol is up
2I04 Internet Address 170.170.9.5/24, Area 0
2I05 Process ID 7, Router ID 170.170.9.5, Network Type POINT_TO_MULTIPOINT, Cost: 64
2I06 Transmit Delay is 1 sec, State POINT_TO_MULTIPOINT,
2I07 Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
2I08 Hello due in 00:00:04
2I09 Neighbor Count is 2, Adjacent neighbor count is 2
2I10 Adjacent with neighbor 170.170.12.8
2I11 Adjacent with neighbor 170.170.12.7
2I12 Suppress hello for 0 neighbor(s)
2I13 Router_E#

2.7 Broadcast Interfaces

Setting the interface type to broadcast will logically set the interface to be a broadcast interface, and it will behave as if the router were connected to a LAN or broadcast network. DR and BDR election will take place, so if there is not a full mesh topology, care must be taken about which router will become the DR. Use of the OSPF priority command should be considered if necessary.

The following is an example configuration for broadcast interfaces:


Router_F configuration:
2J01  ! -- set network as a broadcast & set as DR 
2J02 interface Serial1
2J03 ip address 170.170.9.5 255.255.255.0
2J04 no ip mroute-cache
2J05 encapsulation frame-relay
2J06 ip ospf network broadcast
2J07 ip ospf priority 5
2J08 frame-relay map ip 170.170.9.7 121 broadcast
2J09 frame-relay map ip 170.170.9.8 123 broadcast
2J10 !
2J11 router ospf 7
2J12 network 170.170.9.0 0.0.0.255 area 0

Router_G configuration:
2K01  ! -- set network as a broadcast
2K02 interface Serial0
2K03 no ip address
2K04 encapsulation frame-relay
2K05 frame-relay lmi-type ANSI
2K06 !
2K07 interface Serial0.5 multipoint
2K08 ip address 170.170.9.7 255.255.255.0
2K09 ip ospf network broadcast
2K10 frame-relay map ip 170.170.9.5 112 broadcast
2K11 !
2K12 router ospf 7
2K13 network 170.170.9.0 0.0.0.255 area 0

Router_H configuration:
2L01  ! -- set network as a broadcast
2L02 interface Serial0
2L03 no ip address
2L04 encapsulation frame-relay
2L05 frame-relay lmi-type ANSI
2L06 !
2L07 interface Serial0.5 multipoint
2L08 ip address 170.170.9.8 255.255.255.0
2L09 ip ospf network broadcast
2L10 frame-relay map ip 170.170.9.5 132 broadcast
2L11 !
2L12 router ospf 7
2L13 network 170.170.9.0 0.0.0.255 area 0

Note that in the configuration of Router_F, the interface OSPF priority was set to 5 (default is 1). This was because Router_F is the common router in the network; therefore, this should be the DR. Setting the priority to 5 while the others stayed at default 1 results in Router_F becoming the DR, as can be seen with the show ip ospf interface serial 1 command:

View Router_F as the DR
2M01  ! -- Notice the DR status
2M02 Router_F# sh ip ospf interface serial 1
2M03 Serial1 is up, line protocol is up
2M04 Internet Address 170.170.9.5/24, Area 0
2M05 Process ID 7, Router ID 170.170.9.5, Network Type BROADCAST, Cost: 64
2M06 Transmit Delay is 1 sec, State DR, Priority 5
2M07 Designated Router (ID) 170.170.9.5, Interface address 170.170.9.5
2M08 Backup Designated router (ID) 170.170.12.8, Interface address 170.170.9.8
2M09 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
2M10 Hello due in 00:00:05
2M11 Neighbor Count is 2, Adjacent neighbor count is 2
2M12 Adjacent with neighbor 170.170.12.8 (Backup Designated Router)
2M13 Adjacent with neighbor 170.170.12.7
2M14 Suppress hello for 0 neighbor(s)
2M15 Router_F#

It can also be seen that Router_H is the BDR from the output above. This may not be desirable since Router_H and Router_G do not have Frame Relay link between them. Router_G and Router_H could be prevented from becoming either DR or BDR by setting their interface priority to zero.

2.8 Configuring Route Summarization

Address summarization can help to conserve resources within the backbone area. Summarizing is the consolidation of multiple routes into one single advertisement. This is done at the ABRs or ASBRs summarizing into the direction of the backbone. This way, the backbone will receive the aggregate addresses and will inject the summarized route into other areas. Two types of summarization can be configured for OSPF:

Inter-area route summarization is done on ABRs and accounts for only routes within the OSPF domain. It does not account for external routes.

The router subcommand for inter-area summarization follows:

Command Purpose
area area-id range address mask Specify an address range for which a single route will be advertised.

In the above command, area-id is the area containing the networks to be summarized.


In the above topology, Area 51 contains networks 172.16.128.0/24 through 172.16.159.0/24.

Router_B can summarize these subnets into a single route with the area range command as follows:

Summerise Intra Area OSPF Routes
2N01  ! -- Summerise Intra Area Routes
2N02 router ospf 7
2N03 network 170.170.1.0 0.0.0.255 area 51
2N04 network 170.170.3.0 0.0.0.255 area 0
2N05 area 1 range 172.16.128.0 255.255.224.0

External route summarization is done on the ASBRs that are injecting the external routes. The router subcommand for external route summarization follows:

Command Purpose
summary-address address mask Specify an address and mask that covers redistributed routes, so only one summary route is advertised.


In the above topology, Router_A is redistributing several routes into OSPF: routes 172.16.128.0/24 – 172.16.159.0/24. Since these are external OSPF routes, they cannot be summarized with the area range command. To summarize external routes, use the summary-address command as shown in the example below. The summarization should take place in the ASBR; in this case, Router_A will do the summarization:

Summerise External OSPF Routes
2O01  ! -- Summerise External Routes
2O02 router ospf 7
2O03 summary-address 172.16.128.0 255.255.224.0
2O04 redistribute static subnets
2O05 network 170.170.1.0 0.0.0.255 area 51

2.9 Configuring Stub Areas and Totally Stubby Areas

As mentioned previously, stub areas are areas into which external LSAs are not flooded. Routing to these areas to the external networks is done based on the default route. An extension to stub areas is totally stubby areas. A totally stubby area is an area that blocks external routes and summary routes (inter-area routes) from being flooded. Only intra-area routes and the default route are injected into the area.

The router subcommand that configures an area as a stub follows:

Command Purpose
area area-id stub [no-summary] Define an area to be a stub area.

The keyword no-summary in the above command defines the area as a totally stubby area. If the keyword is not used, the area is just a stub area.


In the topology above, Router_A is redistributing routes 172.16.128.0/24–172.16.159.0/24 into OSPF. If we configured area 1 as a stub area, routers in area 1 would not learn about these networks. Instead, routers in area 1 would get a default route.

The configurations of Router_D and Router_F, for the topology above, are shown below:

The following is a show ip route from Router_F; note that a default route has been injected, but the external routes are not in the routing table.

Router_D: Router_F:
2P01  ! -- define area 1 as stub
2P02 router ospf 7
2P03 network 170.170.3.0 0.0.0.255 area 0
2P04 network 170.170.7.0 0.0.0.255 area 1
2P05 area 1 stub
2Q01  ! -- define area 1 as stub
2Q02 router ospf 7
2Q03 network 170.170.7.0 0.0.0.255 area 1
2Q04 area 1 stub

view from stub network
2R01  ! -- stub areas don't see external routes
2R01 Router_F# sh ip route
2R01 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
2R01 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
2R01 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
2R01 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
2R01 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
2R01 U - per-user static route, o - ODR
2R01
2R01 Gateway of last resort is 170.170.7.4 to network 0.0.0.0
2R01 170.170.0.0/24 is subnetted, 3 subnets
2R01 O IA 170.170.1.0 [110/138] via 170.170.7.4, 00:02:42, Serial0
2R01 O IA 170.170.3.0 [110/74] via 170.170.7.4, 00:02:42, Serial0
2R01 C 170.170.7.0 is directly connected, Serial0
2R01 O*IA 0.0.0.0/0 [110/65] via 170.170.7.4, 00:02:42, Serial0
2R01 Router_F#

To make area 1 totally stubby, add the no-summary keyword to the area stub command as follows:

Router_D: Router_F:
2S01  ! -- define area 1 as totaly stubby
2S01 router ospf 7
2S01 network 170.170.3.0 0.0.0.255 area 0
2S01 network 170.170.7.0 0.0.0.255 area 1
2S01 area 1 stub no-summary
2T01  ! -- define area 1 as totaly stubby
2T01 router ospf 7
2T01 network 170.170.7.0 0.0.0.255 area 1
2T01 area 1 stub no-summary

This results in the following routing table for Router_F:

view from within a totaly stubby network
2U01  ! -- totaly stubby areas don't see any routes from outside their area.
2U01 Router_F# sh ip route
2U01 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
2U01 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
2U01 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
2U01 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
2U01 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
2U01 U - per-user static route, o - ODR
2U01
2U01 Gateway of last resort is 170.170.7.4 to network 0.0.0.0
2U01 170.170.0.0/24 is subnetted, 1 subnets
2U01 C 170.170.7.0 is directly connected, Serial0
2U01 O*IA 0.0.0.0/0 [110/65] via 170.170.7.4, 00:00:00, Serial0
2U01 Router_F#

2.10 Configuring Not-So Stubby Areas

As mentioned before, it is sometimes necessary to redistribute external information into a stub area. This is possible with the NSSA. To configure NSSA, the following router subcommand is used:

Command Purpose
area area-id nssa [no-redistribution] [default-information-originate] Define an area to be NSSA.


In the above topology, area 51 is an NSSA area. Router_A is redistributing static routes into area 51. Router_A should send them to Router_B as type 7 LSAs (NSSA external LSA) and Router_B should translate the type 7 LSAs (NSSA external LSA) into type 5 LSAs (AS external LSA) and flood them to the rest of the network.

The configurations for Router_A and Router_B are as follows:

Router_A: Router_B:
2V01  ! -- define area 51 as a nssa
2V02 router ospf 7
2V03 redistribute static subnets
2V04 network 170.170.1.0 0.0.0.255 area 51
2V05 area 51 nssa
2V06 !
2V07 ip route 172.16.128.0 255.255.255.0 Serial1
2V08 ip route 172.16.129.0 255.255.255.0 Serial1
2V09 ip route 172.16.130.0 255.255.255.0 Serial1
2W01  ! -- define area 51 as a nssa
2W02 router ospf 7
2W03 network 170.170.1.0 0.0.0.255 area 51
2W04 network 170.170.3.0 0.0.0.255 area 0
2W05 area 51 nssa

If we take a look at the routing table of Router_B, we will see the type 7 NSSA (NSSA external LSA) routes:

view within an nssa area
2X01  ! -- note the nssa routes
2X02 Router_B# sh ip route
2X03 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
2X04 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
2X05 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
2X06 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
2X07 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
2X08 U - per-user static route, o - ODR, P - periodic downloaded static route
2X09 T - traffic engineered route
2X10
2X11 Gateway of last resort is not set
2X12 170.170.0.0/24 is subnetted, 3 subnets
2X13 C 170.170.1.0 is directly connected, Serial0
2X14 C 170.170.3.0 is directly connected, Ethernet0
2X15 O IA 170.170.7.0 [110/74] via 170.170.3.4, Ethernet0
2X16 172.16.0.0/24 is subnetted, 3 subnets
2X17 O N2 172.16.128.0 [110/20] via 170.170.1.1, Serial0
2X18 O N2 172.16.129.0 [110/20] via 170.170.1.1, Serial0
2X19 O N2 172.16.130.0 [110/20] via 170.170.1.1, Serial0
2X20 Router_B#

The OSPF database of Router_B shows that there are also type 5 LSAs (AS external LSA).

nssa's ospf database
2Y01  ! -- the ospf db with both types of routes
2Y01 Router_B# show ip ospf database
2Y01 OSPF Router with ID (170.170.3.2) (Process ID 7)
2Y01
2Y01 Router Link States (Area 0)
2Y01 Link ID ADV Router Age Seq# Checksum Link count
2Y01 170.170.3.2 170.170.3.2 1395 0x8000002A 0xB6DD 1
2Y01 170.170.8.4 170.170.8.4 973 0x80000029 0x5433 1
2Y01 Net Link States (Area 0)
2Y01 Link ID ADV Router Age Seq# Checksum
2Y01 170.170.3.2 170.170.3.2 1773 0x80000027 0x2281
2Y01 Summary Net Link States (Area 0)
2Y01 Link ID ADV Router Age Seq# Checksum
2Y01 170.170.1.0 170.170.3.2 1773 0x80000027 0x9392
2Y01 170.170.7.0 170.170.8.4 974 0x80000027 0x22F6
2Y01 Router Link States (Area 51)
2Y01 Link ID ADV Router Age Seq# Checksum Link count
2Y01 170.170.3.2 170.170.3.2 1378 0x8000002A 0x5F4C 2
2Y01 170.170.13.1 170.170.13.1 1381 0x80000038 0x3D59 2
2Y01 Summary Net Link States (Area 51)
2Y01 Link ID ADV Router Age Seq# Checksum
2Y01 170.170.3.0 170.170.3.2 1398 0x8000002A 0xFE52
2Y01 170.170.7.0 170.170.3.2 1398 0x80000028 0x59B5
2Y01 Type-7 AS External Link States (Area 51)
2Y01 Link ID ADV Router Age Seq# Checksum Tag
2Y01 172.16.128.0 170.170.13.1 124 0x80000002 0xFF9D 0
2Y01 172.16.129.0 170.170.13.1 125 0x80000002 0xF4A7 0
2Y01 172.16.130.0 170.170.13.1 125 0x80000002 0xE9B1 0
2Y01 Type-5 AS External Link States
2Y01 Link ID ADV Router Age Seq# Checksum Tag
2Y01 172.16.128.0 170.170.3.2 1367 0x80000001 0xD6DA 0
2Y01 172.16.129.0 170.170.3.2 1367 0x80000001 0xCBE4 0
2Y01 172.16.130.0 170.170.3.2 1367 0x80000001 0xC0EE 0
2Y01 Router_B#

Router_D and Router_F would see only the type 5 LSAs (AS external LSA).

2.11 Configuring OSPF On-Demand Circuits

To allow efficient operation of OSPF over on-demand circuits such as ISDN or dial-up lines, OSPF can be configured for on-demand circuits. The following interface subcommand is used for this:

Command Purpose
ip ospf demand-circuit Configure OSPF on an on-demand circuit.

3. External Routes

External routes are to destinations outside of the OSPF AS. When an external route is redistributed into OSPF, it must be assigned a metric that is compatible with OSPF. This is the responsibility of the ASBR, which can assign an OSPF metric to the external route. The ASBR is also responsible for categorizing the external route as either external type 1 (E1) or external type 2 (E2). The difference between the two is the way the metric of the route is calculated when determining shortest path. The cost of a an E2 route is always the external cost, irrespective of the internal cost. The cost of an E1 route is the sum of the internal and external costs. E1 routes are always preferred over E2 routes.


In the above topology, if the two ASBRs (Router_F and Router_C) are injecting external route 10.10.10.0/24 as E1 routes, Router_E would see the cost to 10.10.10.0/24 as 20 (5 + 10 + 5) through Router_C. The E1 cost through Router_F, as seen by Router_E, would be 30 (20 + 5 + 5). Therefore, the path through Router_C would be preferred. If the ASBRs were injecting the route as E2 routes, the Router_E cost to the network through Router_C would be 15 (10 + 5). The Router_E cost to the network through Router_F would be 10 (5 + 5). Therefore, the path through Router_F would be preferred.


If the external costs to the destination network are equal as in the above topology, and the external routes are injected as E2 routes, then the path selected as the best path would be the path with the lowest cost to the ASBR.

In the above topology the external costs are equal (10), so Router_E will select the path through Router_C because its cost through Router_C is 5, versus the cost to Router_F, which is 20.

The command for redistributing external routes into OSPF is as follows:

Command Purpose
redistribute protocol [process-id] [metric metric-value] [metric-type type-value] [subnets] This command redistributes routes from one routing domain into OSPF.

 

3.1 Originating Default Routes

An ASBR does not, by default, advertise a default route into an OSPF domain. It can be forced to with the following command:

Command Purpose
default-information originate [always] [metric metric-value] [metric-type type-value] [route-map map-name] Force the AS boundary router to generate a default route into the OSPF routing domain.

The "always" keyword will force the ASBR to advertise a default route, whether or not it has a default route in its routing table. Without the "always" keyword the ASBR will advertise a default route only if it has one. The "metric" and "metric-type" are the cost and type (E1/E2) assigned to the default route. The "route-map" can specify a set of conditions that need to be met before the default route will be advertised.

4. Summary

You have now learned the fundamentals of configuring OSPF. Now, you can gain hands-on experience by configuring OSPF in the OSPF Configuration Labs and use your troubleshooting knowledge in the OSPF Challenge Labs.

5. What's Next

Now proceed with the OSPF Lab Project.

-->

Comments