OSPF

OSPF (Open Shortest Path First)  

OSPF (Open Shortest Path First) is a link state routing protocol. Because it is an open standard, it is implemented by a variety of network vendors. OSPF will run on most routers that don’t necessarily have to be Cisco routers (unlike EIGRP which can be run only on Cisco routers).   OSPF is a classless routing protocol that supports VLSM and CIDR, manual route summarization, incremental updates, equal cost load balancing and many other useful features. OSPF uses only one parameter as the metric, namely interface cost. The administrative distance of OSPF routes is, by default, 110. OSPF uses multicast addresses 224.0.0.5 and 224.0.0.6 for routing updates.   Routers running OSPF have to establish neighbor relationships before exchanging routes. Because OSPF is a link state routing protocol, neighbors doesn’t exchange routing tables. Instead, they exchange information about network toplogy. Each OSFP router then runs SFP algorithm to calculate the best routes and adds those to the routing table. Because each router knows the entire topology of a network, a chance for a routing loop to occur is minimal.   Each OSPF router stores routing and topology information in three tables: •    Neighbor table – stores information about OSPF neighbors  •    Topology table – stores the topology structure of a network •    Routing table –  stores the best routes
OSPF neighbors
OSPF routers need to establish a neighbor relationship before exchanging routing updates. OSPF neighbors are dynamically discovered by sending Hello packets out each OSPF-enabled interface on a router. Hello packets are sent to the multicast IP address of 224.0.0.5.   The process is explained in the following figure: 
 
  Routers R1 and R2 are directly connected. After OSFP is enabled both routers send Hellos to each other to establish a neighbor relationship. You can verify that the neighbor relationship has indeed been established by typing the show ip ospf neighbors command. 
   In the example above, you can see that the router-id of R2 is  2.2.2.2. Each OSPF router is assigned a router ID. A router ID is determined by using one of the following:   1.    Using the router-id command under the OSPF process 2.    Using the highest IP address of the router’s loopback interfaces 3.    Using the highest IP address of the router’s physical interfaces   The following fields in the Hello packets must be the same on both routers in order for routers to become neighbors:
 subnet  area id  hello and dead interval timers  authentication  area stub flag  MTU

By default, OSPF sends hello packets every 10 second on an Ethernet network (Hello interval). A dead timer is four times the value of the hello interval, so if a routers on an Ethernet network doesn’t receive at least one Hello packet from an OSFP neighbor for 40 seconds, the routers declares that neighbor „down“.
OSPF neighbor states
Before establishing a neighbor relationship, OSPF routers need to go through several state changes. These states are explained below.   1. Init state – a router has received a Hello message from the other OSFP router 2. 2-way state – the neighbor has received the Hello message and replied with a Hello message of his own 3. Exstart state – beginning of the LSDB exchange between both routers. Routers are starting to exchange link state information. 4. Exchange state – DBD (Database Descriptor) packets are exchanged. DBDs contain LSAs headers. Routers will use this information to see what LSAs need to be exchanged. 5. Loading state – one neighbor sends LSRs (Link State Requests) for every network it doesn’t know about. The other neighbor replies with the LSUs (Link State Updates) which contain information about requested networks. After all the requested information have been received, other neighbor goes through the same process 6. Full state – both routers have the synchronized database and are fully adjacent with each other.
OSPF areas
OSPF uses the concept of areas. An area is a logical grouping of contiguous networks and routers. All routers in the same area have the same topology table, but they don’t know about routers in the other areas. The main benefits of creating areas is that the size of the topology and the routing table on a router is reduced, less time is required to run the SFP algorithm and routing updates are also reduced.   

Each area in the OSPF network has to connect to the backbone area (area 0). All router inside an area must have the same area ID to become OSPF neighbors. A router that has interfaces in more than one area (area 0 and area 1, for example) is called Area Border Router (ABR). A router that connects an OSPF network to other routing domains (EIGRP network, for example) is called Autonomous System Border Routers (ASBR).   NOTE – in OSPF, manual route summarization is possible only on ABRs and ASBRs.   To better understand the concept of areas, consider the following example.
 All routers are running OSPF. Routers R1 and R2 are inside the backbone area (area 0). Router R3 is an ABR, because it has interfaces in two areas, namely area 0 and area 1. Router R4 and R5 are inside area 1. Router R6 is an ASBR, because it connects OSFP network to another routing domain (an EIGRP domain in this case). If the R1’s directly connected subnet fails, router R1 sends the routing update only to R2 and R3, because all routing updates all localized inside the area.

 NOTE – the role of an ABR is to advertise address summaries to neighboring areas. The role of an ASBR is to connect an OSPF routing domain to another external network (e.g. Internet, EIGRP network…).
LSA, LSU and LSR
The LSAs (Link-State Advertisements) are used by OSPF routers to exchange topology information. Each LSA contains  routing and toplogy information to describe a part of an OSPF network. When two neighbors decide to exchange routes, they send each other a list of all LSAa in their respective topology database. Each router then checks its topology database and  sends a Link State Request (LSR) message requesting all LSAs not found in its topology table. Other router responds with the Link State Update (LSU) that contains all LSAs requested by the other neighbor.   The concept is explained in the following example:
    After configuring OSPF on both routers, routers exchange LSAs to describe their respective topology database. Router R1 sends an LSA header for its directly connected network 10.0.1.0/24. Router R2 check its topology database and determines that it doesn’t have information about that network. Router R2 then sends Link State Request message requesting further information about that network. Router R1 responds with Link State Update which contains information about subnet 10.0.1.0/24 (next hop address, cost…). 

Open Shortest Path First (OSPF) Protocol Configuration
Router(config)# router ospf process_ID Router(config-router)# network network_id wildcard_mask area area_#
Note:
Process id: A value in the range 1–65,535 identifies the OSPF Process ID. OSPF Process ID is a unique number on this router that groups a series of OSPF configuration commands under a specific running process.
Wildcard Mask: The wildcard mask (wildcard_mask) given above is the inverse mask of the subnet mask. A 0 octet in the wildcard mask indicates that the corresponding octet in the network must match exactly. On the other hand, a 255 indicates that you don’t care what the corresponding octet is in the network number. A network and wildcard mask combination of 192.168.10.0 0.0.0.0 would match 192.168.10.0 only, and nothing else.
Area Number: The area_# given above is the Area Number. Area Number can always be zero (0) for small networks, but for larger networks, the Area Number need to be properly planned as all routing updates must traverse Area 0. 
Open Shortest Path First (OSPF) Protocol - Lab Practice
The following diagram shows our lab setup. We have three routers, three switches and three hosts connected as below. The host names, IP addresses and the interfaces of the routers are shown in diagram. The IP addresses of the hosts are also shown in the diagram.
 
Hostname and IP address configuration in Router01
Connect to Router01 console and use the following IOS commands to configure host name as Router01.
Router>enable Router#configure terminal Enter configuration commands, one per line.  End with CNTL/Z. Router(config)#hostname Router01 Router01(config)#
Use the following IOS commands to open the fast ethernet interface Fa0/0 configuration mode on Router01 and configure IP address as 172.16.0.1/16.
Router01>enable Router01#configure terminal Enter configuration commands, one per line.  End with CNTL/Z. Router01(config)#interface fa0/0 Router01(config-if)#ip address 172.16.0.1 255.255.0.0 Router01(config-if)#no shutdown
Use the following IOS commands to open the serial interface S0/0 configuration mode on Router01 and configure IP address as 172.17.0.1/16. You have to set a clock rate also using the "clock rate" command on S0/0 interface, since this is the DCE side.
                 

Router01>enable Router01#configure terminal Enter configuration commands, one per line.  End with CNTL/Z. Router01(config)#interface s0/0 Router01(config-if)#clock rate 64000 Router01(config-if)#ip address 172.17.0.1 255.255.0.0 Router01(config-if)#no shutdown
Do remember to run the "copy running-config startup-config" command from enable mode, if you want to save the changes you have made in the router.
Hostname and IP address configuration in Router02
Connect to Router02 console and use the following IOS commands to configure host name as Router02.
Router>enable Router#configure terminal Enter configuration commands, one per line.  End with CNTL/Z. Router(config)#hostname Router02 Router02(config)#
Use the following IOS commands to open the fast ethernet interface Fa0/0 configuration mode on Router02 and configure IP address as 172.18.0.1/16.
                   Router02>enable  Router02#configure terminal Enter configuration commands, one per line.  End with CNTL/Z. Router02(config)#interface fa0/0 Router02(config-if)#ip address 172.18.0.1 255.255.0.0 Router02(config-if)#no shutdown
Use the following IOS commands to open the serial interface S0/0 configuration mode on Router02 and configure IP address as 172.17.0.2/16.
Router02>enable Router02#configure terminal Enter configuration commands, one per line.  End with CNTL/Z. Router02(config)#interface s0/0 Router02(config-if)#ip address 172.17.0.2 255.255.0.0 Router02(config-if)#no shutdown
Use the following IOS commands to open the serial interface S0/1 configuration mode on Router02 and configure IP address as 172.19.0.1/16. You have to set a clock rate also using the "clock rate" command on S0/1 interface, since this is the DCE side.

Router02>enable Router02#configure terminal Enter configuration commands, one per line.  End with CNTL/Z. Router02(config)#interface s0/1 Router02(config-if)#clock rate 64000 Router02(config-if)#ip address 172.19.0.1 255.255.0.0 Router02(config-if)#no shutdown
Do remember to run the "copy running-config startup-config" command from enable mode, if you want to save the changes you have made in the router.
Hostname and IP address configuration in Router03
Connect to Router03 console and use the following IOS commands to configure host name as Router03.
Router>enable Router#configure terminal Enter configuration commands, one per line.  End with CNTL/Z. Router(config)#hostname Router03 Router03(config)#
Use the following IOS commands to open the fast ethernet interface Fa0/0 configuration mode on Router03 and configure IP address as 172.20.0.1/16.
Router03>enable Router03#configure terminal Enter configuration commands, one per line.  End with CNTL/Z. Router03(config)#interface fa0/0 Router03(config-if)#ip address 172.20.0.1 255.255.0.0 Router03(config-if)#no shutdown
Use the following IOS commands to open the serial interface S0/1 configuration mode on Router03 and configure IP address as 172.19.0.2/16.
Router03>enable Router03#configure terminal Enter configuration commands, one per line.  End with CNTL/Z. Router03(config)#interface s0/1 Router03(config-if)#ip address 172.19.0.2 255.255.0.0 Router03(config-if)#no shutdown
Do remember to run the "copy running-config startup-config" command from enable mode, if you want to save the changes you have made in the router.

Open Shortest Path First (OSPF) Protocol configuration in Router01
Connect to Router01 console and use the following IOS commands to configure Open Shortest Path First (OSPF) Protocol in Router01. Please refer the beginning of this lesson to view the Open Shortest Path First (OSPF) Protocol configuration IOS commands.
Using the IOS "network" command, as shown below, we specify only the directly connected networks of this router.
Router01>enable Router01#configure terminal Enter configuration commands, one per line.  End with CNTL/Z. Router01(config)#router ospf 1 Router01(config-router)#network 172.16.0.0 0.0.255.255 area 0 Router01(config-router)#network 172.17.0.0 0.0.255.255 area 0 Router01(config-router)#exit Router01(config)#exit Router01#
Do remember to run the "copy running-config startup-config" command from enable mode, if you want to save the changes you have made in the router.
Open Shortest Path First (OSPF) Protocol configuration in Router02
Connect to Router02 console and use the following IOS commands to configure Open Shortest Path First (OSPF) Protocol in Router02. Please refer the beginning of this lesson to view the Open Shortest Path First (OSPF) Protocol configuration IOS commands.
Using the IOS "network" command, as shown below, we specify only the directly connected networks of this router.
Router02> Router02>enable Router02#configure terminal Enter configuration commands, one per line.  End with CNTL/Z. Router02(config)#router ospf 1 Router02(config-router)#network 172.17.0.0 0.0.255.255 area 0 Router02(config-router)#network 172.18.0.0 0.0.255.255 area 0 Router02(config-router)#network 172.19.0.0 0.0.255.255 area 0 Router02(config-router)#exit Router02(config)#exit
Do remember to run the "copy running-config startup-config" command from enable mode, if you want to save the changes you have made in the router.

Open Shortest Path First (OSPF) Protocol configuration in Router03
Connect to Router03 console and use the following IOS commands to configure Open Shortest Path First (OSPF) Protocol in Router03. Please refer the beginning of this lesson to view the Open Shortest Path First (OSPF) Protocol configuration IOS commands.
Using the IOS "network" command, as shown below, we specify only the directly connected networks of this router.
                   Router03>enable Router03#configure terminal Enter configuration commands, one per line.  End with CNTL/Z. Router03(config)#router ospf 1 Router03(config-router)#network 172.19.0.0 0.0.255.255 area 0 Router03(config-router)#network 172.20.0.0 0.0.255.255 area 0 Router03(config-router)#exit Router03(config)#exit Router03#
Do remember to run the "copy running-config startup-config" command from enable mode, if you want to save the changes you have made in the router.
How to view the routing table in Router01
After the initial configuration and Open Shortest Path First (OSPF) Protocol configuration in all routers, we can use the "show ip route" to view the routing table in Router01, 


NIYONGABO Olivier
niyolivier90@gmail.com

https://www.youtube.com/watch?v=M43Sh0UiBxg&t=27s

No comments:

Post a Comment

Comment On ICT Smart Solution Shares

Energy Solution, Smart Choice Within Reach

 
ICT Smart Solution © 2017-2019 | Designed by NIYONGABO Olivier