Wednesday, April 15, 2009

Basic OSPF Configuration

OSPF is configured by entering router configuration mode and identifying the range of interface addresses on which it should run and the areas they are in. When setting up OSPF, a process ID must be used (8 is used in the example), but the process ID does not have to agree on different OSPF devices for them to exchange information. The network statement uses a wildcard mask and can specify any range from a single address to all addresses. Unlike EIGRP, the wildcard mask is not optional. The following example shows a router configured as an ABR. Interfaces falling with the 192.168.1.0 network are placed in area 0, and interfaces falling within the 172.16.1.0 network are placed in area 1.

Router(config)#router ospf 8
Router(config-router)#network 192.168.1.0 0.0.0.255 area 0
Router(config-router)#network 172.16.1.0 0.0.0.255 area 1


Router ID
The SPF algorithm is used to map the shortest path between a series of nodes. This causes an issue with IP, because an IP router is not identified by a single IP address—its interfaces are. For this reason, a single IP address is designated as the “name” of the router—the RID.

By default, the RID is the highest loopback IP address. If no loopback addresses are configured, the RID is the highest IP address on an active interface when the OSPF process is started. The RID is selected when OSPF starts and—for reasons of stability—is not changed until OSPF restarts. The OSPF process can be restarted by rebooting or by using the command clear ip ospf process. Either choice affects routing in your network for a period of time and should be used only with caution.

A loopback interface is a virtual interface, so it is more stable than a physical interface for RID use. A loopback address is configured by creating an interface and assigning an IP address.

Router(config)#interface loopback0
Router(config-if)#ip address 10.0.0.1 255.255.255.255

The loopback address does not have to be included in the OSPF routing process, but if you advertise it, you are able to ping or trace to it. This can help in troubleshooting.

A way to override the default RID selection is to statically assign it using the OSPF router-id command.

Router(config)#router ospf 8
Router(config-router)#router-id 10.0.0.1


Troubleshooting OSPF
The neighbor initialization process can be viewed using the debug ip ospf adjacencies command. The neighbor table can be seen with show ip ospf neighbors, which also identifies adjacency status, and reveals the designated router and backup designated router. Use the debug ip ospf packet command to view all OSPF packets in real time.

Often, the first place OSPF issues are noticed is when inspecting the routing table—show ip route. To filter the routing table and show only the routes learned from OSPF, use show ip route ospf.

The command show ip protocols offers a wealth of information for any routing protocol issue. Use this command to verify parameters, timer values, identified networks, and OSPF neighbors (routing information sources).

Use show ip ospf to verify the RID, timers, and counters. Because wildcard masks sometimes incorrectly group interfaces to areas, another good place to check is show ip ospf interface. This shows the interfaces on which OSPF runs and their current correct assigned area.


OSPF Network Types
The SPF algorithm builds a directed graph—paths made up of a series of points connected by direct links. One of the consequences of this directed-graph approach is that the algorithm has no way to handle a multiaccess network, such as an Ethernet VLAN. The solution used by OSPF is to elect one router, called the Designated Router (DR), to represent the entire segment. Point-to-point links fit the SPF model perfectly and don’t need any special modeling method. On a point-topoint link, no DR is elected and all traffic is multicast to 224.0.0.5.

OSPF supports five network types:

NBMA—Default for multipoint serial interfaces. RFC-compliant mode that uses DRs and requires manual neighbor configuration.
Point-to–multipoint (P2MP)—Doesn’t use DRs so adjacencies increase logarithmically with routers. Resilient RFC compliant mode that automatically discovers neighbors.
Point-to-multipoint nonbroadcast (P2MNB)—Proprietary mode that is used on Layer 2 facilities where dynamic neighbor discovery is not supported. Requires manual neighbor configuration.
Broadcast—Default mode for LANs. Uses DRs and automatic neighbor discovery. Proprietary when used on WAN interface.
Point-to–point (P2P)—Proprietary mode that discovers neighbors and doesn’t require a DR.

If the default interface type is unsatisfactory, you can statically configure it with the command ip ospf network under interface configuration mode:

Router(config-if)#ip ospf network point-to-multipoint

When using the NBMA or P2MP nonbroadcast mode, neighbors must be manually defined under the routing process:

Router(config-router)#neighbor 172.16.0.1

No comments:

Post a Comment