Jaycee's Networking

May 16, 2009

OSPF – Basic Configuration

Filed under: IOS, OSPF — Tags: — Jaycee @ 11:35 pm

A. Enabling OSPF on the Network:

router ospf 99
network 10.10.1.0 0.0.0.255 area 0

1. We establish an OSPF routing process with the process ID 99.

2. This routing process is responsible for the network 10.10.1.0/24, which belongs to area 0.

3. This router is part of the OSPF backbone area.

4. OSPF will run over all interfaces that match the network commands.

B. Sample Configuration:

1. An OSPF network with a single backbone router:

An OSPF network with a single backbone router

R1:

router ospf 99
 network 10.10.0.0 0.0.255.255 area 0

R2:

router ospf 99
 network 10.10.0.0 0.0.255.255 area 0
 network 10.11.0.0 0.0.255.255 area 1

R3:

router ospf 99
 network 10.10.0.0 0.0.255.255 area 0
 network 10.12.0.0 0.0.255.255 area 2

R4:

router ospf 99
 network 10.10.0.0 0.0.255.255 area 0
 network 10.13.0.0 0.0.255.255 area 3

a. It’s important to understand that it’s interfaces, not routers, that belong to area.

b. Router 1 needs a network statement only for area 0 because it doesn’t have interfaces in areas 1, 2, and 3.

b. R2, R3, R4 are all ABRs, and they need 2 network statements because they each participate in 2 areas.

c. Each network statement specifies the subnet that is associated with the area.

2. An OSPF network with a backbone across 3 ABRs:

An OSPF network with a backbone across three ABRs

R2:

router ospf 99
 network 10.10.0.0 0.0.255.255 area 0
 network 10.11.0.0 0.0.255.255 area 1

R3:

router ospf 99
 network 10.10.0.0 0.0.255.255 area 0
 network 10.12.0.0 0.0.255.255 area 2

R4:

router ospf 99
 network 10.10.0.0 0.0.255.255 area 0
 network 10.13.0.0 0.0.255.255 area 3

a. All 3 routers share area 0, which makes them all ABRs with no backbone router.

b. The backbone still exists- it just doesn’t have its own router.

C. Route Summarization:

Route summarization helps reduce the routing table size. OSPF distinguishes between two summarization types: inter-area and external.

1. Inter-area summarization:

a. It occurs when the ABR summarizes an area’s routes. An ABR can summarize routes within its area and beyond,, as long as all the subnets are contiguous and summarizable.

b. Just because areas are adjacent doesn’t mean their addressing is set up to be summarizable.

c. To enable inter-area summarization, use “area range” command.

d. As the example above, R2:

router ospf 99
 network 10.10.0.0 0.0.255.255 area 0
 network 10.11.0.0 0.0.255.255 area 1
 area 1 range 10.11.0.0 255.255.0.0

2. External summarization:

a. It occurs at ASBRs, where the entire network is summarized.

b. We can use external summarization when we are injecting external routes into OSPF.

c. To enable external summarization, use “summary-address” command. For example:

summary-address 10.0.0.0 255.0.0.0

d. We will use this command to summarize the EIGRP routes that get redistributed into OSPF.

D. Virtual Backbone Links:

1. Virtual Link — OSPF includes a mechanism lets you create a backbone out of two separate areas.

An OSPF network with a partitioned Area 0

2. As exameple above, it shows a network that requires a virtual link. In OSPF, all areas must be contiguous, meaning that they must physically be connected to each other.

3. When two areas are not contiguous, we solve the problem by creating a vitual link.

4. As the example above, we want to make R1 and R2 part of area 0, even though they are not contiguous. Since they share area 5, we can mend (修補改正) the partitioned area 0 by adding a virtual link to tunnel area 0 across area 5.

5. This tunneling brings the two distant routers together to act as though they are actually connected.

a. First, we should define a loopback interface, which we use as an unambiguous (清楚明白的) identifier for the router.

=> loopback interface is always up with a unique address and is not assiciated with any hardware.

b. Then we must create the virual link with the area command.

6. Virtual links cannot cross more than one area.

R1:

interface loopback0
 ip address 10.10.7.4 255.255.255.0
router ospf 99
 network 10.10.1.0 0.0.0.255 area 0
 network 10.10.7.0 0.0.0.255 area 0
 network 10.10.2.0 0.0.0.255 area 1
 network 10.10.3.0 0.0.0.255 area 2
 network 10.10.6.0 0.0.0.255 area 5
 ! Create the virtual link to R2's ID
 area 5 virtual-link 10.10.8.5

R2:

interface loopback0
 ip address 10.10.8.5 255.255.255.0
router ospf 99
 network 10.10.1.0 0.0.0.255 area 0
 network 10.10.9.0 0.0.0.255 area 0
 network 10.10.4.0 0.0.0.255 area 3
 network 10.10.5.0 0.0.0.255 area 4
 network 10.10.6.0 0.0.0.255 area 5
 ! Create the virtual link to R1's ID
 area 5 virtual-link 10.10.7.4

E. Interoperability with Other Vendors:

1. “ospf cost” command allows you to define a cost value for OSPF links when talking to another router.

2. Rule for calculating cost: cost = 100,000,000 / bandwidth

3. Example, T1 link would have a cost of 100,000,000/1,544,000 = 64.

interface serial0
 ip ospf cost 64

F. Default Routes in OSPF:

1. With “default-inforamtion” command, an ASBR can generate a default route into an OSPF domain.

2. Example below, the ASBR is told to propagate its default route (172.168.10.1) into the OSPF domain:

ip route 0.0.0.0 0.0.0.0 172.168.10.1
router ospf 99
 network 10.1.1.0 0.0.0.255 area 0
 default-information originate

G. NSSAs:

1. Before NSSAs existed, if a remote site on your network ran another routing protocol, it was difficult to provide full ruoting and also take advatantage of stub area.

2. With an NSSA, redistribution within a sub area is possible.

3. The following is a configuration that uses an NSSA to incorporate a remote network that is using RIP:

a. R2 is an offsite router running RIP; we want to incorporate it into our OSPF network.

b. R1 is connected to our OSPF network.

c. Area 2 joins R1 and R2 with an address of 192.168.44.0, and will be our NSSA.

R1 (is our main office router):

router ospf 99
 network 192.168.42.0 0.0.0.255 area 0
 network 192.168.43.0 0.0.0.255 area 1
 network 192.168.44.0 0.0.0.255 area 2
 area 2 nssa

R2 (is the remote office router running RIP):

router rip
 network 10.0.0.0
router ospf 99
 redistribute rip subnets
 network 192.168.44.0 0.0.0.255 area 2
 area 2 nssa

d. R2 needs to run both OSPF and RIP, but we have managed to shield R1 and the rest of our network from knowing about RIP.

e. “redistribute” command brings RIP information into the OSPF process.

f. “network” command define area 2, and we specify that area 2 is Not So Stubby.

H. OSPF Configuration Example:

1. The following example consists of 4 areas: Area 0 has 2 ABR router; R1 is the ABR for areas 1 and 2, while R4 is the ABR for area 3.

An OSPF network

R1:

interface Etherenet0
 ip address 172.16.1.1 255.255.255.0
interface Serial0
 ip address 10.12.1.1 255.255.255.0
interface serial1
 ip address 10.11.1.1 255.255.255.0
router ospf 100
 network 172.16.1.0 0.0.0.255 area 0
 network 10.11.0.0 0.0.255.255 area 1
 network 10.12.0.0 0.0.255.255 area 2

R2:

interface Etherenet0
 ip address 10.11.2.1 255.255.255.0
interface Serial0
 ip address 10.11.1.2 255.255.255.0
router ospf 100
 network 10.11.0.0 0.0.255.255 area 1

R3:

interface Etherenet0
 ip address 10.12.2.1 255.255.255.0
interface serial1
 ip address 10.12.1.2 255.255.255.0
router ospf 100
 network 10.12.0.0 0.0.255.255 area 2

R4:

interface Etherenet0
 ip address 172.16.1.2 255.255.255.0
interface Serial1
 ip address 172.30.1.1 255.255.255.0
router ospf 100
 network 172.16.1.0 0.0.0.255 area 0
 network 172.30.0.0 0.0.255.255 area 3

R5:

interface Etherenet0
 ip address 172.30.2.1 255.255.255.0
interface Serial0
 ip address 172.30.1.2 255.255.255.0
router ospf 100
 network 172.30.0.0 0.0.255.255 area 3

Verify:

R1#show ip route
Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, Ethernet0
     172.30.0.0/24 is subnetted, 2 subnets
O IA    172.30.2.0 [110/84] via 172.16.1.2, 00:03:59, Ethernet0
O IA    172.30.1.0 [110/74] via 172.16.1.2, 00:03:59, Ethernet0
     10.0.0.0/24 is subnetted, 4 subnets
C       10.11.1.0 is directly connected, Serial1
O       10.11.2.0 [110/74] via 10.11.1.2, 00:08:25, Serial1
O       10.12.2.0 [110/74] via 10.12.1.2, 00:08:25, Serial0
C       10.12.1.0 is directly connected, Serial0
R1#show ip ospf neighbor

Neighbor ID   Pri    State       Dead Time    Address        Interface
172.30.1.1      1    FULL/DR     00:00:37     172.16.1.2     Ethernet0
10.12.2.1       1    FULL/ -     00:00:35     10.12.1.2      Serial0
10.11.2.1       1    FULL/ -     00:00:30     10.11.1.2      Serial1

2. Putting route summarization to use:

R4#show ip route
Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, Ethernet0
     172.30.0.0/24 is subnetted, 2 subnets
O       172.30.2.0 [110/74] via 172.30.1.2, 00:18:15, Serial1
C       172.30.1.0 is directly connected, Serial1
     10.0.0.0/24 is subnetted, 4 subnets
O IA    10.11.1.0 [110/74] via 172.16.1.1, 00:10:17, Ethernet0
O IA    10.11.2.0 [110/84] via 172.16.1.1, 00:10:17, Ethernet0
O IA    10.12.2.0 [110/84] via 172.16.1.1, 00:10:08, Ethernet0
O IA    10.12.1.0 [110/74] via 172.16.1.1, 00:10:08, Ethernet0

There are 4 routes pointing to 172.16.1.1 for the various 10.x.x.x networks. We can simplify the routing table by changing the configuration on R1. Use “area range” command to do “Inter-area summarization”.

R1:

interface Etherenet0
 ip address 172.16.1.1 255.255.255.0
interface Serial0
 ip address 10.12.1.1 255.255.255.0
interface Serial1
 ip address 10.11.1.1 255.255.255.0
router ospf 100
 network 10.11.0.0 0.0.255.255 area 1
 network 10.12.0.0 0.0.255.255 area 2
 network 172.16.1.0 0.0.0.255 area 0
! Summarize the 10.11.0.0 and 10.12.0.0 networks
 area 1 range 10.11.0.0 255.255.0.0
 area 2 range 10.12.0.0 255.255.0.0
R4#show ip route
Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, Ethernet0
     172.30.0.0/24 is subnetted, 2 subnets
O       172.30.2.0 [110/74] via 172.30.1.2, 00:21:41, Serial1
C       172.30.1.0 is directly connected, Serial1
     10.0.0.0/16 is subnetted, 2 subnets
O IA    10.11.0.0 [110/74] via 172.16.1.1, 00:01:22, Ethernet0
O IA    10.12.0.0 [110/74] via 172.16.1.1, 00:01:13, Ethernet0

I. Redistributing EIGRP into OSPF:

Redistribuging EIGRP into OSPF

1. R4 runs EIGRP on interface Serial1, and R5 runs EIGRP exclusively. The challenge is getting redistribution between OSPF and EIGRP working.

R4:

interface Etherenet0
 ip address 172.16.1.2 255.255.255.0
interface Serial1
 ip address 172.30.1.1 255.255.255.0
router eigrp 100
 network 172.30.0.0
 ! Disable EIGRP on E0
 passive-interface Ethernet0
 ! Redistribute our static route into EIGRP
 redistribute static
 ! Stop EIGRP from summarizing routes
 no auto-summary
router ospf 100
 network 172.16.0.0 0.0.255.255 area 0
 ! Use the summary-address command because we're injecting a route into OSPF
 summary-address 172.30.0.0 255.255.0.0
 ! Redistribute EIGRP into OSPF
 redistribute eigrp 100 subnets
 default-metric 10
ip route 0.0.0.0 0.0.0.0 172.16.1.1

R5:

interface Etherenet0
 ip address 172.30.2.1 255.255.255.0
interface Serial0
 ip address 172.30.1.2 255.255.255.0
router eigrp 100
 network 172.30.0.0

Verify:

R1#show ip route
Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, Ethernet0
O E2 172.30.0.0/16 [110/10] via 172.16.1.2, 00:07:12, Ethernet0
     10.0.0.0/24 is subnetted, 5 subnets
C       10.11.1.0 is directly connected, Serial1
O       10.11.2.0 [110/74] via 10.11.1.2, 00:07:51, Serial1
O       10.12.2.0 [110/74] via 10.12.1.2, 00:07:51, Serial0
C       10.12.1.0 is directly connected, Serial0
O       10.0.0.0 is a summary, 00:07:45, Null0

2. Since we used the “summary-address” command, there is only one route to the 172.30.0.0/16 network.

J. OSPF show Commands:

1. show ip ospf border routers

R1#show ip border-routers

OSPF Process 100 internal Routing Table

Code: i - Intra-area route, I - Inter-area route

i 172.30.1.1 [10] via 172.16.1.2, ethernet0, ABR, Area 0, SPF 28

2. show ip ospf neighbor

R1#show ip ospf neighbor

Neighbor ID   Pri    State       Dead Time    Address        Interface
172.30.1.1      1    FULL/DR     00:00:37     172.16.1.2     Ethernet0
10.12.2.1       1    FULL/ -     00:00:35     10.12.1.2      Serial0
10.11.2.1       1    FULL/ -     00:00:30     10.11.1.2      Serial1

a. Neighbor ID is the OSPF router ID for the neighbor. (Router ID is either the highest IP of any interface on the router or the IP of the loopback interface.)

b. PRI indicates priority. (Priorities are used to establish the DR router; the router with the highes priority is the DR router.)

c. State reports the state of the connection to the neighbor. (FULL means the routers are fully adjacent)

d. Dead Time is the amount of time the router will wait without hearing a hello from the router before changing the neighbor’s state to DOWN.

e. Address is the IP address of the interface to which the neighbor is connected.

f. Interface shows the interface though which the neighbor is reached.

3. show ip ospf database

It displays the entire OSPF database for the router.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: