Open Shortest Path First

OSPF is a link-state routing protocol. Link-state protocols use Dijkstra's shortest path first (SPF) algorithm to populate the routing table. OSPF shares information with every router in the network. OSPF is a classless protocol and supports VLSM.

OSPF in a Single Area

When configuring any OSPF router, you must establish for which area assignment the interface will be enabled. OSPF has some basic rules when it comes to area assignment. OSPF must be configured with areas. The backbone area 0, or 0.0.0.0, must be configured if you use more than one area assignment. If your OSPF design has only one area, it may have any number. Table 1-11 defines common OSPF terminology.

Table 1-11 Common OSPF Terms

Term

Description

Hello packet

Exchanged by the routers for neighbor discovery and forming adjacencies, neighbor keepalives, and designated router (DR)/backup DR (BDR) election.

Link state

Information is shared between directly connected routers. This information propagates unchanged throughout the network and is also used to create an SPF tree.

Area

A group of routers and links that share the same area ID. All OSPF routers require area assignments. All routers within an area have the same database. Link-state flooding is limited to an area.

Autonomous system

A network under a common network administration domain running common routing protocols.

Cost

(OSPF metric)

The routing metric used by OSPF. Lower costs are always preferred. You can manually configure the cost of an interface with the ip ospf cost command. By default, the cost is calculated by using the formula, cost = 108 4 bandwidth.

Router ID

Each OSPF router requires a unique router ID, which is the highest IP address configured on a Cisco router or the highest-numbered loopback address. You can manually assign the router ID.

Adjacency

When two OSPF routers have exchanged information between each other and have the same topology table. Adjacency can have a number of states or exchange states:

Init state—When Hello packets have been sent and are awaiting a reply to establish two-way communication.

Establish bidirectional (two-way) communication—Accomplished by the discovery of the Hello protocol routers and the election of a DR.

Exstart—Two neighbor routers form a master/slave relationship and agree upon a starting sequence that will be incremented to ensure that LSAs are acknowledged.

Exchange state—Database Description (DD) packets continue to flow as the slave router acknowledges the master's packets. OSPF is operational because the routers can send and receive LSAs between each other. DD packets contain information such as the router ID, area ID, checksum, if authentication is used, link-state type, and the advertising router. LSA packets also contain information such as router ID, and additionally include MTU sizes, DD sequence numbering, and any options.

Loading state—Link-state requests are sent to neighbors, asking for recent advertisements that have been discovered in Exchange state but not received.

Full state—Neighbor routers are fully adjacent because their link-state databases are fully synchronized within the area. Routing tables begin to be populated.

Table 1-11 Common OSPF Terms (Continued)

Term

Description

Topology table

Also called the link-state table, contains every link in the entire network.

Designated router (DR)

Ensures adjacencies between all neighbors on a multiaccess network (such as Ethernet). This ensures that not all routers need to maintain full adjacencies with each other.

The DR is selected based on the priority. In a tie, the router with the highest router ID is selected.

Backup DR

Designed to perform the same functions in case the DR fails.

Link-state advertisement

(LSA)

A packet that contains all relevant information regarding a router's links and the state of those links.

Priority

Sets the router's priority so a DR or BDR can be correctly elected.

Router links

Describe the state and cost of the router's interfaces to the area. Router links use LSA type 1.

Summary links

Originated by Area Border Routers, these links describe networks in the AS. Summary links use LSA type 3 and 4.

Network links

Originated by DRs. Network links use LSA type 2.

External links

Originated by Autonomous System Boundary Routers; they advertise destinations external to the AS or the default route external to the AS.

Area Border Router (ABR)

Router located on the border of one or more OSPF areas to connect those areas to the backbone network.

Autonomous

System

Boundary

Router

(ASBR)

An ABR located between an OSPF autonomous system and a non-OSPF network.

The configuration steps to enable OSPF in a single area are as follows:

Step 1 Start OSPF with the command router ospf process ID. The process ID is locally significant to the router.

Step 2 Enable the interfaces with the network command. For example, to place the network 131.108.1.0 in area 1, the Cisco IOS command is network 131.108.1.0 0.0.0.255 area 1.

Step 3

Identify area assignments.

Step 4 (Optional) Assign the router ID with the router-id router-id Cisco IOS command under the OSPF process.

NOTE The following is a list of reasons OSPF (link-state) is considered a better routing protocol than RIPv1 (distance vector):

■ OSPF has no hop count limitation. (RIP has a limit of 15 hops only.)

■ OSPF understands VLSM and allows for summarization.

■ OSPF uses multicasts (not broadcasts) to send updates.

■ OSPF converges much faster than RIP because OSPF propagates changes immediately. OSPF is faster because it sends the link update and then calculates the local routing table. RIP calculates the local routing table and then sends an update.

■ OSPF allows for load balancing with up to six equal-cost paths.

■ OSPF has authentication available (RIPv2 does also, but RIPv1 does not).

■ OSPF allows sophisticated tagging of external routes injected by other autonomous systems.

■ OSPF configuration, monitoring, and troubleshooting have a far greater Cisco IOS tool base than RIP.

Multiple OSPF Areas

An OSPF area is a logical grouping of routers and links by a network administrator. OSPF routers in any area share the same topological view (also known as the OSPF or database) of the network. OSPF is configured in multiple areas to reduce routing table sizes, which in return reduces the topological database and CPU/memory requirements on a router.

Routing tables become very large even with just 50 routers. Cisco does not recommend the number of routers per area. Recommended networking design, however, typically recommends no more than 50 routers per area. The OSPF database is exchanged in full every 30 minutes, and if this database is too large, every time this occurs, the amount of bandwidth used over the network increases and can cause severe delays in sending user-based traffic because convergence times are increased.

Area assignments allow OSPF designers to limit and confine changes. Additionally, a number of predefined area types, outlined in Table 1-12, help to reduce the demand on routers.

Table 1-12 Additional Area Types

Area Type

Function

Stubby area

Does not accept LSA types 4 and 5, which are summary links and external link advertisements, respectively. The only way to achieve a route to unknown destinations is a default route injected by the ABR.

Totally stubby area

Blocks LSA types 3, 4, and 5. Only a single type 3 LSA advertising the default route is allowed. This solution is Cisco proprietary and is used to further reduce a topological database.

Not-so-stubby area

(NSSA)

Used primarily for connections to an ISP. This area is designed to allow type 7 LSAs only. All advertised routes can be flooded through the NSSA and an ABR translates it into a type 5 LSA. Basically, a type 7 LSA (if the P bit is set to 1) is converted to a type 5 LSA and flooded through the rest of the network. The bit P is used to tell the NSSA ABR whether to translate type 7 into type 5. If the P bit is set to 0, no translation takes place. Type 4 or 5 LSAs are not permitted. This advertisement is not propagated to the rest of the network. NSSAs typically provide a default route.

Table 1-13 defines the challenges across various media types, such as Frame Relay and broadcast media.

Table 1-13 SPF over Various Media Types Using Cisco IOS Software

Method

Description

Point-to-point nonbroadcast

Used typically for Frame Relay interfaces.

Point-to-point

The default mode for subinterfaces.

Point-to-multipoint

Used for multiple destinations.

Nonbroadcast

Nonbroadcast multiaccess (NBMA) mode.

Broadcast

Used in Ethernet and broadcast environments where the election of DR/BDR takes place. To define the DR, use the Cisco IOS command ip ospf priority priority-number. The priority-number is 1 to 255. The highest priority will be to elect the DR.

Ethernet is an example of a broadcast medium for which OSPF will elect a DR to minimize the number of OSPF updates. Each multiaccess OSPF network that has at least two attached routers has a designated router elected by the OSPF Hello protocol. The DR reduces the number of adjacencies required on a multiaccess network, which reduces the amount of routing protocol traffic and the size of the topological database, especially when more than two routers are deployed on this network segment. In a nonbroadcast multi-access (or NBMA) network, OSPF elects both a DR and a BDR. NBMA simulates a broadcast model by electing a DR and a BDR. There are two ways to simulate a broadcast model on an NBMA network: define the network type as broadcast with the ip ospf network broadcast interface subcommand or configure the neighbor statements by using the router ospf command.

Virtual Links

All OSPF areas must be connected to the backbone area (Area 0). Figure 1-16 demonstrates a topology where an area (Area 100) is not directly connected to the backbone.

Figure 1-16 OSPF Area Assignment

Figure 1-16 OSPF Area Assignment

To ensure that Area 100 is reachable by the backbone, a virtual link can be configured over the transit area (200), and IP connectivity will be maintained. Virtual links are typically used in a transition phase (for example, when one company buys another and both companies use OSPF). Another solution to the problem depicted in Figure 1-16 is to install a physical link between Router C or Router D and the backbone core network.

OSPF Configuration Example

Figure 1-17 demonstrates a two-router topology and displays three OSPF areas, with Area 2 partitioned from the backbone, necessitating a virtual link.

Figure 1-17 Typical Cisco 1OS OSPF topology

Virtual Link Required

Figure 1-17 Typical Cisco 1OS OSPF topology

Virtual Link Required

R1's Loopbacks in Area 0 Loopback0 131.108.2.1/24 Loopback1 131.108.3.1/24 Loopback2 131.108.4.1/24 Loopback3 131.108.5.1/24 Loopback4 131.108.6.1/24 Loopback5 131.108.7.1/24

R2's Loopbacks in Area 1 Loopback0 131.108.9.1/24 Loopback1 131.108.10.1/24 Loopback2 131.108.11.1/24 Loopback3 131.108.12.1/24 Loopback4 131.108.13.1/24 Loopback5 131.108.14.1/24 Loopback6 131.108.15.1/24

Example 1-18 displays the full working configuration of R1.

Example 1-18 Rl's OSPF Configuration hostname R1 enable password cisco interface Loopback0 ip address 131.108.2.1 255.255.255.0 ip ospf network point-to-point

interface Loopback1 ip address 131.108.3.1 255.255.255.0 ip ospf network point-to-point

interface Loopback2 ip address 131.108.4.1 255.255.255.0 ip ospf network point-to-point

Example 1-18 R1's OSPF Configuration (Continued)

interface Loopback3

ip address 131.108.5.1 255.255.255.0

ip ospf network point-to-point

interface Loopback4

ip address 131.108.6.1 255.255.255.0

ip ospf network point-to-point

interface Loopback5

ip address 131.108.7.1 255.255.255.0

ip ospf network point-to-point

interface Ethernet0/0

ip address 131.108.1.1 255.255.255.0

!

interface Serial0/0

bandwidth 256

ip address 131.108.255.1 255.255.255

252

encapsulation frame-relay

ip ospf network point-to-point

interface Serial0/1

bandwidth 256

ip address 131.108.255.5 255.255.255

252

encapsulation frame-relay

ip ospf network point-to-point

router ospf 1

router-id 131.108.7.1

area 1 virtual-link 131.108.15.1

network 131.108.0.0 0.0.7.255 area 0

network 131.108.255.0 0.0.0.3 area 1

network 131.108.255.4 0.0.0.3 area 1

!

end

By default, loopback interfaces are stub hosts in OSPF and are advertised as 32-bit hosts. The Cisco IOS command ip ospf network point-to-point advertises the loopback networks as /24 networks (in this case, you use the /24 subnet mask). The Frame Relay connection is configured as point-to-point to ensure that no manual OSPF neighbor configuration is required to form OSPF neighbors. The virtual link is configured across the transit area, 1, to the R2 router ID of 131.108.15.1.

Example 1-19 displays R2's full working configuration.

Example 1-19 R2's OSPF Configuration

hostname R2

enable password cisco

interface LoopbackO

ip address 131.108.9.1 255.255.255.0

ip ospf network point-to-point

interface Loopbackl

ip address 131.108.10.1 255.255.255.0

ip ospf network point-to-point

interface Loopback2

ip address 131.108.11.1 255.255.255.1

ip ospf network point-to-point

interface Loopback3

ip address 131.108.12.1 255.255.255.1

ip ospf network point-to-point

interface Loopback4

ip address 131.108.13.1 255.255.255.1

ip ospf network point-to-point

!

interface Loopback5

ip address 131.108.14.1 255.255.255.1

ip ospf network point-to-point

interface Loopback6

ip address 131.108.15.1 255.255.255.1

ip ospf network point-to-point

interface Ethernet0/0

ip address 131.108.8.1 255.255.255.0

!

interface Serial0/0

ip address 131.108.255.2 255.255.255

252

encapsulation frame-relay

ip ospf network point-to-point

interface Serial0/1

ip address 131.108.255.6 255.255.255

252

encapsulation frame-relay

ip ospf network point-to-point

router ospf 1

Example 1-19 R2's OSPF Configuration (Continued)

router-id 131.108.15.1 area 1 virtual-link 131

.108.7.

1

network

131

108

8.0 0.0

.0.255

area 2

network

131

108

9.0 0.C

.0.255

area 1

network

131

108

10.0 0

0.0.255

area

1

network

131

108

11.0 0

0.0.255

area

1

network

131

108

12.0 0

0.0.255

area

1

network

131

108

13.0 0.

0.0.255

area

1

network

131

108

14.0 0

0.0.255

area

1

network

131

108

15.0 0.

0.0.255

area

1

network

131

108

255.0 0

.0.0.3

area 1

network

131

108

255.4 0

.0.0.3

area 1

end

Example 1-20 displays the IP OSPF routing table on R1.

Example 1-20 show ip route ospf on R1

R1#show ip route ospf

131.108.0.0/16 is variably subnetted, 17 subnets, 2 masks

R1#show ip route ospf

131.108.0.0/16 is variably subnetted, 17 subnets, 2 masks

O

131.1

38.15.0/24

[1

0/391]

via

131.1

98.255

6,

00

00

41,

Serial0/1

[1

0/391]

via

131.1

98.255

2,

00

00

41,

Serial0/0

O

131.1

38.14.0/24

[1

0/391]

via

131.1

98.255

6,

00

00

41,

Serial0/1

[1

0/391]

via

131.1

98.255

2,

00

00

41,

Serial0/0

O

131.1

08.13.0/24

[1

0/391]

via

131.1

98.255

6,

00

00

41,

Serial0/1

[1

0/391]

via

131.1

98.255

2,

00

00

41,

Serial0/0

O

131.1

38.12.0/24

[1

0/391]

via

131.1

98.255

6,

00

00

41,

Serial0/1

[1

0/391]

via

131.1

98.255

2,

00

00

41,

Serial0/0

O

131.1

38.11.0/24

[1

0/391]

via

131.1

98.255

6,

00

00

41,

Serial0/1

[1

0/391]

via

131.1

98.255

2,

00

00

41,

Serial0/0

O

131.1

38.10.0/24

[1

0/391]

via

131.1

98.255

6,

00

00

41,

Serial0/1

[1

0/391]

via

131.1

98.255

2,

00

00

41,

Serial0/0

O

131.1

08.9.0/24

[1

0/391]

via

131.1

98.255

6,

00

00

41,

Serial0/1

[1

0/391]

via

131.1

98.255

2,

00

00

42,

Serial0/0

O IA

131.1

38.8.0/24

[1

10/400]

via

131.1

98.255

6,

00

00

42,

Serial0/1

[1

10/400]

via

131.1

98.255

2,

00

00

42,

Serial0/0

R1's routing table has the remote OSPF networks labeled as O IA because the network 131.108.8.0/24 is part of an area not directly attached to R1. Also, R1 is automatically load balancing across the two paths because the cost metric is the same (391). The administrative distance is 110 (the default).

NOTE The election of the designated router in networks such as Frame Relay is important, and you must ensure that the hub or core network router is the elected DR so that the hub router disseminates information to all spoke routers. To ensure that the hub is the DR, you can disable the DR election process on edge routers with the Cisco IOS command ip ospf priority 0.

0 0

Post a comment