Ex2 Chapter 11 – OSPF

 - Describe the background and basic features of OSPF.
 - Identify and apply the basic OSPF configuration commands.
 - Describe, modify and calculate the metric used by OSPF.
 - Describe the Designated Router/Backup Designated Router (DR/BDR) election proess in multiaccess networks.
 - Employ the default-information originate command to configure and propagate a default route in OSPF.

Initial development of OSPF began in 1987. 
In 1989, an experimental OSPFv1 was published as RFC 1131.  In 1991 the now accepted version OSPFv2 was created.
OSPF is encapsulated within an IP Packet header.  The following information is used:
Protocol field = 89
Multicast Address = or

It is good practice to authenticate transmitted routing information.
OSPF has an administrative distance of 110. 

Open-Shortest-Path-First (OSPF) is the most widely used interior gateway protocol routing protocol on the world because it is a public (non-proprietary) routing protocol while its biggest rival, EIGRP, is a Cisco proprietary protocol so other vendors can’t use it. OSPF is a complex link-state routing protocol. Link-state routing protocols generate routing updates only when a change occurs in the network topology. When a link changes state, the device that detected the change creates a link-state advertisement (LSA) concerning that link and sends to all neighboring devices using a special multicast address. Each routing device takes a copy of the LSA, updates its link-state database (LSDB), and forwards the LSA to all neighboring devices.

There are 3 type of tables
Neighbor table
+ Contain information about the neighbors
+ Neighbor is a router which shares a link on same network
+ Another relationship is adjacency
+ Not necessarily all neighbors
+ LSA updates are only when adjacency is established
Topology table
+ Contain information about all network and path to reach any network
+ All LSA’s are entered into the topology table
+ When topology changes LSA’s are generated and send new LSA’s
+ On topology table an algorithm is run to create a shortest path, this algorithm is known as SPF or dijkstra algorithm
Routing Table
+ Also knows as forwarding database
+ Generated when an algorithm is run on the topology database
+ Routing table for each router is unique

OSPF packets (LSPs)

1.  Hello - Discovers neighbors and buils adjaciencies between them
2.  DBD - Checks for database synchronization between routers
3.  LSR - Requests specific link-state records from router to router
4.  LSU - Send specifically requested link-state records (LSR replies), contains 11 types of LSA (advertisments).
5.  LSAck - Acknowledges the other packet types (LSU reception acknowledgement)

Hello Packets Used to
•  Discover OSPF neighbors and establish neighbor adjacencies.
•  Advertise parameters on which two routers must agree to become neighbors.
•  Elect the Designated Router (DR) and Backup Designated Router (BDR) on multiaccess networks like Ethernet and Frame Relay.

To change a hello packet or dead packet you must enter the specific interface and then issue the appropriate commands.

OSPF Working Steps

1.  Before an OSPF router can flood its link-states to other routers, it must first determine if there are any other OSPF neighbors on any of its links.
2.  Before two routers can form an OSPF neighbor adjacency, they must agree on three values: Hello interval, Dead interval, and network type.
a.  Default Hello – 10 (Point-to-Point, Multi-access), 30secs (NBMA)
b.  Dead Interval (time to wait before declaring link down) – 4 hello interval 40 (Point-to-Point, Multi-access), 120secs (NBMA
3.  Each OSPF router maintains a link-state database containing the LSAs received from all other routers.  Once a router has received all of LSAs and built its local link-state database, OSPF uses Dijkstra's shortest path first (SPF) algorithm to create an SPF tree.

Adjancencies only if same
– Hello and dead intervals
– Area ID (Area 0 in this case)
– Authentication password
– Stub area flag

Now R1 and R2 are neighbors but they don’t exchange LSAs immediately.
Instead, they sends Database Description (DD or DBD) packets which contain an abbreviated list of the sending router’s link-state database.
The neighbors also determine who will be the master and who will be the slave. The router which higher router-id will become master and initiates the database exchange. The receiver acknowledges a received DD packet by sending an identical DD packet back to the sender. Each DD packet has a sequence number and only the master can increment sequence numbers.

OSPF Packet types
Type - Identifies the OSPF packet type as one of the following:
  • 1) Hello - Establishes and maintains neighbor relationships.
  • 2) DD - Database description (DD or DBD) - Describes the contents of the topological database. These messages are exchanged when an adjacency is initialized.
  • 3) LSR - Link-state request - Requests pieces of the topological database from neighbor routers. These messages are exchanged after a router discovers (by examining database-description packets) that parts of its topological database are outdated.
  • 4) LSU - Link-state update - Responds to a link-state request packet. These messages also are used for the regular dispersal of LSAs. Several LSAs can be included within a single link-state update packet.There are 11 types of Lisk-State Advertisements (LSA)
  • 5) LSAck - Link-state acknowledgment - Acknowledges link-state update packets
LSUs and LSAs
Link-state updates (LSUs) are the packets used for OSPF routing updates.  An LSU can
contain one of ten link-state advertisements (LSAs).  An LSU is made up of one or
more LSAs.

DR/BDR Election
To reduce OSPF traffic in Broadcast mustiaccess networks (LAN), OSPF elects Designated Router (DR) and backup DR (BDR).
DR - responsable for updating all other OSPF routers when change occurs in multiaccess network.
BDR - monitors the DR and take over as DR if the currect DR fails.

- highest OSPF interface priority
- second highest OSPF interface priority
If priority are equals, highest Router-ID break the tie.

DR is elected, until:
- DR fails,
- OSPF process on DR fails,
 - multiaccess interface on the DR fails.

Configuring OSPF

You turn on OSPF just like EIGRP with router OSPF <process_id>.
Process ID could be number from 1-65535.
It is very important to note there is a significant difference between EIGRP and OSPF in that the process id on OSPF routers does not need to be the same.
It is a local process id and does not reflect the network at large.

Enable OSPF
As with other routing protocols, enabling OSPF requires that you create an OSPF routing process, 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:





router ospf process-id

Enable OSPF routing, which places you in router configuration mode.


network address wildcard-mask area area-id

Define an interface on which OSPF runs and define the area ID for that interface.

interface Ethernet 0
ip address interface Serial 0
ip address
router ospf 1
network area 0
network area 2
area 0 range
area 2 range
OSPF unlike EIGRP requires a wildcard mask and the area identification.
When running single area OSPF you must use area 0 (best practice).  
Router(config-router)# network area 0
An OSPF area is a group of routers that share link-state information. 
All routers that intend to share routing information with each other must have the same area number.

How to compute the Router ID

The Router ID (RID) is an IP address used to identify the router and is chosen using the following sequence:
(first) The router ID can be manually assigned
-  (second) The highest IP address assigned to a loopback (logical) interface.
-  (third) If a loopback interface is not defined, the highest IP address of all active router’s physical interfaces will be chosen.

The OSPF router ID is used to uniquely identify each router in the OSPF routing domain.
1.  router-id: Use the IP address configured with the router-id command.
2.  highest loopback If the router-id command is not set, the router chooses the highest IP address of any of its loopback interfaces.
3.  highest active IP . If no loopback interfaces are configured, it chooses the highest active IP address from its physical interfaces. [Note: The interface does not need to be a part of the OSPF messaging to be considered for router ID.]
To view Router ID issue any of the following:
# show ip protocols
- ospf process id
- router id
- networks
- administrative distance
# show ip ospf
- ospf process ID
- router ID
- OSPF area
- SPF algorithm last worked time
- SPF scheduler
# show ip ospf interface
- Hello/Dead intervals
# show ip route [ospf]
-  "O” means OSPF
Loopback Router ID
Until recently (v.12.0) the router-id command did not exist as a part of the Cisco IOS. 
Engineers running OSPF used the loopback address to force router-id values.  The benefit of using a loopback address over physical addresses is that the interface will never go down because it is virtual.

Router-ID command
To create a specific router id with a more recent IOS version issue.
Router(config)# router ospf 1
Router(config-router)# router-id  ip-address
The router id is selected immediately after the first network command is issued.  You should have the loopback address set or router-id command issued before using the network command.  In the scenario that you need to change the router-id or that OSPF is already running you can issue the following command.
Router# clear ip ospf process
In some cases you may need to actually reload the entire router.  Note: Two routers cannot share the same router-id, if they do the network will have problems.

Troubleshooting OSPF

Useful command:
show ip ospf neighbor
Two routers may not form an adjacency if:
•  The subnet masks do not match, causing the routers to be on separate networks.
•  OSPF Hello or Dead Timers do not match.
•  OSPF Network Types do not match.
•  There is a missing or incorrect OSPF network command.
router#show ip ospf neighbor
Neighbor    ID Pri State Dead Time Address    Interface 1  Full/ -    32 POS 1/1/1 1  Full/ -    35 POS 1/1/3 1  Full/ -    40 CL CL-A
Neighbor ID - The router ID of the neighboring router.
Pri - The OSPF priority of the interface. This is discussed in a later section.
State - The OSPF state of the interface. FULL state means that the router and its neighbor have identical OSPF link-state databases. OSPF states are discussed in CCNP.
Dead Time - The amount of time remaining that the router will wait to receive an OSPF Hello packet from the neighbor before declaring the neighbor down. This value is reset when the interface receives a Hello packet.
Address - The IP address of the neighbor's interface to which this router is directly connected.
Interface - The interface on which this router has formed adjacency with the neighbor.
Flapping link - routing problem where an advirtised route between two nodes alternates (flaps) back and forth between two paths due to a network problem that causes intermittent interface failures (constantly recalculate SPF, preventing proper convergence).

OSPF interface costs table
By default the ospf cost calculation is based on a reference bandwidth of 100Mb
To overcome this issue you can set an auto-cost reference bandwidth  to affect this calculation.
Interface    Bandwidth   OSPF Interface Cost
Loopback     8G          1
Enternet     1G          1
Enternet     100M        10
Enternet     10M         100
Modem        2M          500
Modem        62500       16000
Serial       115200      10850
Serial       9600        65535
Calculating the Metric (cost)
The OSPF metric is called cost.

OSPF chooses the lowest cost values.

The Cisco IOS uses the cumulative bandwidths of the outgoing interfaces from the router to the destination network as the cost value.
To compute the cost divide 10^8 / links bps (100mbps). 
For example, compute T1 cost: 10^8 / 1,544,000 bps = 64.
Compute 56 kpbs cost: 10^8 / 56,000 = 1785.

Default values for Cisco serial links are T1 bandwidth, even if that is not what the line is carrying.  Never assume the value though and confirm by issuing show int s0/0.

To change the default bandwidth value of an interface.  Enter the interface and issue
bandwidth 64
(or appropriate bandwidth in kpbs).
To view the cost enter
show ip ospf cost interface s0/0
You may also directly configure the cost per interface by entering the interface and issuing ip ospf cost 1562 (or appropriate cost value).  This command is useful in multi-vendor scenarios where the metric may be determined another way.
ip ospf cost 1562 is equivalent to bandwidth 64

Reference Bandwidth - defaults to 10 to the 8th power (100 mbps)
The reference bandwidth can be modified to accommodate networks with links faster than 100,000,000 bps (100 Mbps) using the OSPF command
auto-cost reference-bandwidth
OSPF Network Types
OSPF defines 5 network types:
1) Point-to-point
2) Broadcast mustiaccess
3) Nonbroadcast multiaccess
4) Point-to-multipoint
5) Virtual links

NBMA (non-broadcast multiaccess) - multiaccess network either does not supporting broacasting (ex: X.25) or in which broadcast is not feasible (ATM, Frame Relay)

Multi-access networks can create two challenges for OSPF regarding the flooding of LSAs:
1.  Creation of multiple adjacencies, one adjacency for every pair of routers.
2.  Extensive flooding of LSAs (Link-State Advertisements).

On multi-access networks, OSPF elects a Designated Router (DR) to be the collection and distribution point for LSAs sent and received. A Backup Designated Router (BDR) is also elected in case the Designated Router fails. All other routers become DROthers (this indicates a router that is neither the DR or the BDR).  This means that instead of flooding LSAs to all routers in the network, DROthers only send their LSAs to the DR and BDR using the multicast address

DR/BDR Election
How do the DR and BDR get elected? The following criteria are applied:
1. DR: Router with the highest OSPF interface priority.
2. BDR: Router with the second highest OSPF interface priority.
3. If OSPF interface priorities are equal, the highest router ID is used to break the tie.

When the DR is elected, it remains the DR until one of the following conditions occurs:
•  The DR fails.
•  The OSPF process on the DR fails.
•  The multiaccess interface on the DR fails.

To change the priority of a link you can issue inside a physical interface:
Router(config-if)#ip ospf priority {0 - 255}
Note: Setting the priority to 0 guarantees it cannot be a DR or BDR.  Default value for all interfaces is 1.
Router with the highest priority will become the DR and the router with the next highest priority will become the BDR.
A value of 0 makes the router ineligible to become a DR or BDR.

Default Route
Like RIP, OSPF uses
#default-information originate
to advertise the static static route.
O*E2 [110/1] via, 00:05:34, Serial0/0/1
E2 denotes that this route is an OSPF External Type 2 route.
OSPF external routes fall in one of two categories: External Type 1 (E1) or External Type 2 (E2).
The difference between the two is in the way the OSPF cost of the route is calculated at each router.

Key points
+ Is a public (non-proprietary) routing protocol.
+ Is the only link-state routing protocol you learn in CCNA
+ This works by using the Dijkstra algorithm
+ IP Protocol = 89 (OSPF)
+ Destination: musticast or
+ Information about its neighbors (local connectivity) is sent to the entire network using multicasting
+ Routing information is shared through Link-state updates (LSAs)
+ HELLO messages are used to maintain adjacent neighbors.
By default, OSPF routers send Hello packets every 10 seconds on multiaccess and point-to-point segments and every 30 seconds on non-broadcast multiaccess (NBMA) segments (like Frame Relay, X.25, ATM).
+ Is a classless routing protocol because it does not assume the default subnet masks are used. It sends the subnet mask in the routing update.
+ Supports VLSM and route summarization
+ Uses COST as a metric which CISCO defines as the inverse of the bandwidth
+ Uses AREAs to subdivide large networks, providing a hierarchical structure and limit the multicast LSAs within routers of the same area — Area 0 is called backbone area and all other areas connect directly to it. All OSPF networks must have a backbone area
+ Only support IP but it’s not bad as we are all using IP, right? :)
Area Border Routers (ABR) are any routers that have one interface in one area and another interface in another area


#sh ip ospf 55         
 Routing Process "ospf 55" with ID
   Domain ID type 0x0005, value
 Start time: 00:02:12.980, Time elapsed: 36w4d
 Supports opaque LSA
 Connected to MPLS VPN Superbackbone, VRF vrf-name
 Event-log disabled
 It is an area border and autonomous system boundary router
 Redistributing External Routes from,
    connected, includes subnets in redistribution
    bgp 123, includes subnets in redistribution
 Router is not originating router-LSAs with maximum metric
 Incremental-SPF disabled
 Minimum LSA interval 5 secs
 Minimum LSA arrival 1000 msecs
 Reference bandwidth unit is 100 mbps
    Area 55
        Number of interfaces in this area is 1
        Area has no authentication
        SPF algorithm last executed 19w4d ago
        SPF algorithm executed 22 times
        Flood list length 0
#sh ip ospf 55 interface
GigabitEthernet1/13 is up, line protocol is up (connected)
  Internet Address, Area 55, Attached via Network Statement
  Process ID 55, Router ID, Network Type BROADCAST, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           1         no          no            Base
  Transmit Delay is 1 sec, State BDR, Priority 1
  Designated Router (ID), Interface address
  Backup Designated router (ID), Interface address
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:04
    Adjacent with neighbor  (Designated Router)
  Suppress hello for 0 neighbor(s)

#sh ip ospf 55 neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface        1   FULL/DR         00:00:31      GigabitEthernet1/13

#sh ip ospf 55 database
            OSPF Router with ID ( (Process ID 55)

                Router Link States (Area 55)

Link ID         ADV Router      Age         Seq#       Checksum Link count      813         0x80002B25 0x007D68 1      703         0x8000486D 0x0093E9 1

                Net Link States (Area 55)
Link ID         ADV Router      Age         Seq#       Checksum      703         0x80001707 0x007EA4

                Type-5 AS External Link States
Link ID         ADV Router      Age         Seq#       Checksum Tag      703         0x800007D5 0x00B656 3489702149      703         0x8000450C 0x0032B0 3489702149

No comments :

Post a Comment