OSPF Configuration

OSPF Relations Requirement

For two routers configured with OSPF to form a neighbor relationship, they must have interfaces that are either directly connected or connected to a multiaccess network media such as Ethernet. In addition, the IP addresses and subnet masks must be in the same network and the OSPF hello and dead timers must be set to the same value. Routers configured with OSPF will form neighbor relationships with any other routers that meet these requirements .

Before implementing OSPF on a network, you should always determine the desired precedence for designated router (DR) and backup designated router (BDR) election

it is important to configure IP addresses on Loopback interfaces to configure router IDs on all routers prior to starting the OSPF process on any of the routers; once the OSPF process is started, it does not re-elect the DR unless the DR fails or the OSPF process on the DR is restarted .

Don’t forget that on serial point-to-point networks no DR and BDR can be elected .

The default administrative distance of the OSPF routes is 110

OSPF Neighbor State

Down
In this state, a router has not heard a hello packet from any OSPF neighbor yet.
Attempt
This state is applied only on NBMA networks in which the neighbors are not discovered dynamically but must be configured manually (‘neighbor’ statement in the config-router context).
Init
A router has heard a hello packet from its neighbor(s), which among other parameters the Router IDs of all the neighbors are listed  (look at hello packet structure in the next post).
2-Way
A router has seen its own Router ID in the hello packet from the neighbor(s). This means that bidirectional communication has been established between the routers.
ExStart
In this state the master/slave relationship is established necessary to exchange Database Description Packets. Since all the packets have their sequence number allowing routers to detect more recent information, initial numbers are negotiated in this state. The router with the highest Router ID becomes the master.
Exchange
The routers will send Database Description packets (description of the LDSB). Link State Request packets to request more recent LSAs are also sent in this state.
Loading
The Link State Request packets are sent to neighbors in the loading state. They request more recent LSAs discovered in the Exchange state. Link State Updates are sent in response to LSRs.
Full
OSPF neighbors are fully adjacent. All information about networks/subnets have been exchanged and acknowledged.

 

OSPF Packet Types

In the Neighbor State Machine description, a few types of OSPF packets were mentioned. OSPF uses five types of packets for communication.

Type 1 – Hello

This packet type is used to discover neighbors and maintain the adjacencies between them. More details regarding a hello packet will be presented in the next post.

Type 2 – Database Description

It is used to describe the LSAs so that the receiving router (neighbor) can determine if all LSAs have been synchronized between them (all routers in the area must have the same LSDB). It is accomplished by exchanging the headers of LSAs (Database Description packets aka DD packets) with the neighbor(s). The receiving router will check if it has a match for all LSAs in its local database. If not, LSR packets are sent to retrieve the missing LSAs.

Type 3 – Link State Request

During the exchange state the router creates a list of all missing or older LSAs in the so called Link State Request List. Then, it sends one or more LSR packets asking the neighbor for the copy of all these LSAs.

Type 4 – Link State Update

It is the response to LSR packets. Contains one or more LSAs which are sent to the neighbor which sent LSR. Upon receiving them the router is flooding them to all its neighbors in order to maintain the same LSDB within the OSPF area.

Type 5 – Link State Acknowledgment

Each LSA the router receives must be acknowledged in order to synchronize the LSDB with neighbors reliably. This packet is used to acknowledge the reception of all LSAs.

 

LSA’s

Internal router generate                       Router Link States
DR (designated Router) generate         Net Link States

to be continued…. more details

Type of route definitions :

O   = OSPF
IA  = OSPF inter area
E1 = OSPF External type 1
E2 = OSPF EXternal type 2 ( default metric )

The difference in External Type 1 (E1) and External Type 2 (E2) metrics is that only the cost of the path from the ASBR to the external destination is re  ected with E2 routes. E1 routes include the cost to the ASBR to re  ect the entire path to the external destination

 

ABR    = Area Border Router
A router with interfaces in two (or more) different areas is an area border router ( and its always connected to the backbone )
ASBR  = Autonomous System Boundary Router
An ASBR is a router that redistributes other routing protocols and external autonomous systems (AS) into its own OSPF area.

 

Config#interface Loopback X

(Config)#Router OSPF 1
(Config-rtr)# router-id x.x.x.x
(Config-rtr)# network x.x.x.x (address) x.x.x.x (wildcard mask) area 0 ( this is locally significant ) meaning that the network address configured will enable ospf process on all interface that match the network statement .
(Config-rtr)#

Loopback interfaces

Loopback interfaces are considered the ‘stub’ networks by OSPF process and advertised with /32 network mask by default. In order to change it, the ‘ip ospf network point-to-point’ should be used on loopback interfaces.

(config-if)#interface loopback #
(config-if)#ip ospf network point-to-point
(config-if)#ip ospf # area #
(config-if)#router ospf #
(config-router)#network network x.x.x.x (address) x.x.x.x (wildcard mask)  area x
(config-router)#


ROUTER-ID and Priority

(config-if)#router ospf 1
(config-router)#router-id 2.2.2.2

Router ID for an OSPF process is to guarantee a stable router ID for the device, even if a router were to restart. Without a router ID configured, OSPF chooses the highest IP address of all loopback interfaces to be the device’s router ID. If no loopback interfaces exist, OSPF will choose the highest IP address of all physical interfaces that are in the up/up line and protocol state.

if ever you introduce a new router with a higher router-id ( configure manually or not ) you need to issue the command :
clear ip ospf process

OSPF will not use the same ID for multiple processes. Consider a situation where two OSPF processes are configured (router ospf 1 and router ospf 100) and a router ID has not been configured for either OSPF process. If process 100 is configured first, it will take the highest available loopback interface IP address. When the second process 1 is configured, it will take the highest available, which is actually the second highest

OSPF PRIORITY :
(config-if)#ip ospf priority X ( highest = DR ) ( Lowest BDR ) ( 0 = Droder )
if it is configure to 0  the router becomes DRother and does not participate in the election process.

 OSPF Network Commands

It is best practice to use the network x.x.x.x area x command when multiple network need to be advertised , but if only one network is to be advertised
the command ip ospf area x ( configure on the interface ) is best practice .

OSPF has two features related to point-to-multipoint networks. One feature applies to broadcast networks; the other feature applies to nonbroadcast networks:
On point-to-multipoint, broadcast networks, you can use the neighbor command, and you must specify a cost to that neighbor.
Since Multicast doesnt work on some type of media ( frame-relay , ATM etc…. ) we need to use unicast byusing the command “Neighbor” 

To configure OSPF routers interconnecting to nonbroadcast networks, use the neighbor command in router configuration mode. To remove a configuration, use the no form of this command.
neighbor ip-address [priority number] [poll-interval seconds] [cost number] [database-filter all]
no neighbor ip-address [priority number] [poll-interval seconds] [cost number] [database-filter all]

OSPF Route Summarization

(config-rtr)Area “area# ” range ip address and mask

OSPF Route Redistribution

The subnets parameter is an OSPF-speci  c option that is required for redistributing routes that are not subnetted at their classful bit boundaries. OSPF discards subnetted routes during redistribution if the subnets parameter is not used with the redistribute command.

The Connected parameter is required to redistribute connected route if not only the route of the redistributed Protocol will be redistribute .

Verifying configuration :

Show ip protocols
Show ip ospf
Show ip ospf interface
Many information can be found trough this command : Router ID , Hello and Dead timers , Cost , Priority and the Area DR and BDR info .
Show ip ospf database
LSA’s
Show ip ospf neighbors
The state tell’s us if neighbors have exchange their LSA if yes than we can read FULL

 

Leave a Comment