OSPF (Open Shortest Path First)
OSPF (Open Shortest Path First)
OSPF (Open Shortest Path First)
(Reference: http://www.cisco.com/warp/public/104/29.html)
OSPF Designated Routers
In multi-access networks such as
Ethernet, there is the possibility of
many neighbor relationships on the
same physical segment. In the above
example, four routers are connected
into the same multi-access segment.
Using the following formula (where
“n” is the number of routers):
n(n-1)/2
…..it is apparent that 6 separate adjacencies are needed for a fully meshed
network. Increase the number of routers to five, and 10 separate adjacencies
would be required. This leads to a considerable amount of unnecessary
Link State Advertisement (LSA) traffic.
If a link off of Router A were to fail, it would flood this information to all
neighbors. Each neighbor, in turn, would then flood that same information
to all other neighbors. This is a waste of bandwidth and processor load.
To prevent this, OSPF will elect a Designated Router (DR) for each multi-
access networks, accessed via multicast address 224.0.0.6. For redundancy
purposes, a Backup Designated Router (BDR) is also elected.
OSPF routers will form adjacencies with the DR and BDR. If a change
occurs to a link, the update is forwarded only to the DR, which then
forwards it to all other routers. This greatly reduces the flooding of LSAs.
DR and BDR elections are determined by a router’s OSPF priority,
which is configured on a per-interface basis (a router can have interfaces
in multiple multi-access networks). The router with the highest priority
becomes the DR; second highest becomes the BDR. If there is a tie in
priority, whichever router has the highest Router ID will become the DR.
To change the priority on an interface:
Router(config-if)# ip ospf priority 125
Notice that the ospf network type has been changed to broadcast, and the
broadcast parameter was added to the frame-relay map command. The
neighbor no longer needs to be specified, as multicasts will be allowed
out this map.
The default OSPF network type for Ethernet and Token Ring is
Broadcast Multi-Access. To configure manually:
Router(config)# interface e0
Router(config-if)# ip ospf network broadcast
The default OSPF network type for T1’s (HDLC or PPP) and Point-to-
Point Frame Relay is Point-to-Point. To configure manually:
Router(config)# interface s0
Router(config-if)# encapsulation frame-relay
Router(config)# interface s0.1 point-to-point
Router(config-if)# frame-relay map ip 10.1.1.1 101 broadcast
Router(config-if)# ip ospf network point-to-point
Configuring OSPF Network Types (continued)
The default OSPF network type for Point-to-Multipoint Frame Relay is still
Non-broadcast Multi-access Network (NBMA). However, OSPF
supports an additional network type called Point-to-Multipoint, which will
allow neighbor discovery to occur automatically. To configure:
Router(config)# interface s0
Router(config-if)# encapsulation frame-relay
Router(config)# interface s0.2 multipoint
Router(config-if)# frame-relay map ip 10.1.1.1 101 broadcast
Router(config-if)# ip ospf network point-to-multipoint
Type Cost
Serial (56K) 1785
Serial (64K) 1562
T1 (1.544Mbps) 64
Token Ring (4Mbps) 25
Ethernet (10 Mbps) 10
Token Ring (16 Mbps) 6
Fast Ethernet 1
Changing the cost of an interface can alter which path OSPF deems
the “shortest,” and thus should be used with great care.
To alter how OSPF calculates its default metrics for interfaces:
Router(config)# router ospf 1
Router(config-router)# ospf auto-cost reference-bandwidth 100
The above ospf auto-cost command has a value of 100 configured, which is
actually the default. This indicates that a 100Mbps link will have a cost of 1
(because 100/100 is 1). All other costs are based off of this. For example,
the cost of 4 Mbps Token Ring is 25 because 100/4 = 25.
OSPF Area Types
In order to control the propagation of LSAs in the OSPF domain,
several area types were developed.
Standard Area – A “normal” OSPF area.
• Like Standard areas, Stub area routers will share Type 1 and Type 2
LSAs to build their topology tables.
• Stub areas will also accept Type 3 LSAs to reach other areas.
• Stub areas will not accept Type 4 or Type 5 LSAs, detailing routes to
external networks.
The purpose of Stub areas is to limit the number of LSAs flooded into the
area, to conserve bandwidth and router CPUs. The Stub’s ABR will
automatically inject a default route into the Stub area, so that those
routers can reach the external networks. The ABR will be the next-hop for
the default route.
Configuration of stub areas is relatively simple:
Router(config)# router ospf 1
Router(config-router)# network 10.1.0.0 0.0.7.255 area 1
Router(config-router)# area 1 stub
The area 1 stub command must be configured on all routers in the Stub area.
No ASBRs are allowed in a Stub area.
OSPF Area Types (continued)
External
Networks
More External
Networks
Area 1 Area 2
Router G
Router A Router
Router C Router D
Area 1 Area 2
Router G
Router A Router E
Router C Router D
External
Networks
Router A Router C
Router B
Router A must have a default route in its routing table in order for the
above command to function. Router A’s default route would point to some
upstream router in the external Autonomous System.
If a default route does not exist in its routing table, Router A can still
be forced to advertise a default route using the always parameter:
RouterA(config)# router ospf 1 RouterA(config-router)#
default-information originate always
OSPF and Default Routes (continued)
The ABRs of Stub and Totally Stubby areas automatically generate (and
inject) a default route (0.0.0.0/0) into the area. Routers in Stub areas use this
default route to reach external networks, while routers in Totally Stubby areas
use the default route to reach both inter-area and external networks.
To control the “cost” metric of the default route in Stub or Totally
Stubby areas (configured on the ABR):
Router(config)# router ospf 1
Router(config-router)# area 1 stub
Router(config-router)# area 1 default-cost 10
Reference: (http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094a74.shtml)
OSPF SPF Timers
To adjust the SPF timers in OSPF:
Router(config)# router ospf 1
Router(config-router)# timers spf 10 15