Thursday, March 29, 2012

Singe Area OSPF Routing Example


Advertisement

Advertisement
The Open Shortest Path First routing protocol is a critical piece of knowledge for any networking professional working in an enterprise environment. Most major networking certifications covering routing and switching including the Cisco Certified Network Associate (CCNA), Cisco Certified Network Professional (CCNP), and Cisco Certified Internetwork Expert (CCIE) extensively test OSPF knowledge and skills. OSPF is the most popular dynamic routing protocol used in complex enterprise networks. This example will demonstrate the concepts and configuration involved with setting up a single area OSPF network. This lab is built using Dynamips/GNS3 and shows configuration using Ethernet as the layer 2 switching protocol between the routers. Frame Relay will be covered in a different post because there are special issues involving network types and non-broadcast multiaccess (NBMA) networks.

For our topology we will be demonstrating basic OSPF routing using 2 virtual Cisco c7200 routers and 2 Cisco c3725 routers configured in the following topology. There is also another c3725 router that is being used as an Ethernet Switch in the virtual topology:



There are two ways to configure OSPF for IPv4 networks. OSPF can be configured directly on the interface or using the global router ospf command. Most organizations develop standards for using one or the other, since troubleshooting complexity can increase if both are used throughout a network. If both are specified, the interface configuration takes precedence over the global configuration.

Let's start out by configuring the necessary interfaces in the backbone area (area 0):
Router Configuration
R1 interface GigabitEthernet0/0
 ip address 192.168.0.1 255.255.255.252
!
interface FastEthernet1/0
 ip address 10.0.0.1 255.255.255.248
!
R2 interface GigabitEthernet0/0
 ip address 192.168.0.2 255.255.255.252
!
interface FastEthernet1/0
 ip address 10.0.0.2 255.255.255.248
!
R3 interface FastEthernet0/0
 ip address 10.0.0.3 255.255.255.248
!
R4 interface FastEthernet0/1
 ip address 10.0.0.4 255.255.255.248
!

Next, configure the routing protocols on the 4 routers:

Router OSPF Configuration
R1 router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 auto-cost reference-bandwidth 1000
 network 10.0.0.0 0.0.0.7 area 0
 network 192.168.0.0 0.0.0.3 area 0
!
R2 router ospf 1
 router-id 2.2.2.2
 log-adjacency-changes
 auto-cost reference-bandwidth 1000
 network 10.0.0.0 0.0.0.7 area 0
 network 192.168.0.0 0.0.0.3 area 0
!
R3 router ospf 1
 router-id 3.3.3.3
 log-adjacency-changes
 auto-cost reference-bandwidth 1000
 network 10.0.0.0 0.0.0.7 area 0
!
R4 router ospf 1
 router-id 4.4.4.4
 log-adjacency-changes
 auto-cost reference-bandwidth 1000
 network 10.0.0.0 0.0.0.7 area 0
!

Why did we change the default bandwidth used in the OSPF metric calculation? In this case, we have Gigabit Ethernet interfaces and using the default reference bandwidth of 100 Mb/s, the Fast Ethernet and Gigabit Ethernet interfaces would have the exact same cost of 1. See OSPF Cost/Metric Calculation for more details.  Additionally, we statically set the router IDs. If we did not do this, then the router id would be determined by the following, listed from highest precedence to lowest precedence:
  • Statically assigned OSPF router ID (highest)
  • Highest IPv4 address of up/up loopback interface
  • Highest IPv4 address of up/up interface on router (lowest)
If the OSPF process can't determine a valid router ID (this happens when none of the above are configured or in native IPv6 implementations of OSPF with no RID specified), the OSPF process does not start. Note also that the ospf process IDs in the configuration above do not have to match, but sometimes this can be convenient on larger networks if multiple OSPF routing domains are used.

With the configuration above, the OSPF database consists of 6 LSAs: 4 router LSAs (type 1) and 2 transit networks (type 2 LSAs):

R3#show ip ospf database

            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         493         0x80000007 0x000A13 2
2.2.2.2         2.2.2.2         486         0x80000007 0x00E52D 2
3.3.3.3         3.3.3.3         76          0x80000007 0x00A44C 1
4.4.4.4         4.4.4.4         533         0x80000005 0x006A7F 1

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.0.0.4        4.4.4.4         77          0x80000005 0x00905E
192.168.0.2     2.2.2.2         737         0x80000003 0x00FDBD



In this instance, the OSPF database is not fully optimized because the Gi0/0 interfaces for R1 and R2 are point to point IP links. We can reduce the size of the OSPF database in this example by setting the OSPF network type to point-to-point. Even with the /30 (255.255.255.252) mask, OSPF still considers this a broadcast network. To resolve this on R1 and R2:


R1(config)#Interface GigabitEthernet 0/0
R1(config-if)#ip ospf network point-to-point


After making this change on R1 and R2, we now have the OSPF database reduced to 5 total LSAs:


R3#show ip ospf database

            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         97          0x80000008 0x0017F1 3
2.2.2.2         2.2.2.2         15          0x80000008 0x00DC26 3
3.3.3.3         3.3.3.3         447         0x80000007 0x00A44C 1
4.4.4.4         4.4.4.4         904         0x80000005 0x006A7F 1

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.0.0.4        4.4.4.4         448         0x80000005 0x00905E


Something else worth noting is that in a single area, OSPF only propagates type 1 and type 2 LSAs. An Area Border Router (ABR) autonomous system border router (ASBR) is required to see any of the other LSA types that are related to unicast routing.


See Also
The Road to the CCIE
The OSPF Stub Area

No comments:

Post a Comment