OSPF - Open Shortest Path First


  • OSPF is a Link State Routing protocol, ISIS (Intermediate system to intermediate system) is another example of Link State Routing Protocol.
  • Area is a collection of routers and networks, it's number can be anthing between 1 4294967295.
  • it sends triggered updates
  • Route summerization is performed only by ABR.
  • Sends Hello packet on choosen OSPF running interfaces.
  • OSPF uses SPF algorithm to calculate best bath


Hello messages are sent after every 10 seconds on broadcast / Point to point networks and every 30 seconds on NBMA networks like frame relay.
















Types of OSPF

  1. Single Area OSPF
  2. Multiple Area OSPF
 

Configuring a Topology

First of all, always count the total no of networks in topology



Convergence is when each router has all these networks in topology in its routing table.

  • You can perform convergence dynamically (through routing protocols) or statically by static routes.
  • The basic goal of routing protocols is to perform convergence
It’s written in lab that you cannot perform static routes, especially in CCIE lab. You’re only permitted to configure routing protocols and where it is required to define static routes, they will ask you to configure static routes, so we’re going to perform convergence in this topology.Basic difference between configuration of RIP and OSPF is that we need to configure Wildcard mask in case of OSPF and the second is Area ID which we’ll have to configure once again in the case of OSPF.

Basic difference between configuration of RIP and OSPF is that we need to configure Wildcard mask in case of OSPF and the second is Area ID which we’ll have to configure once again in the case of OSPF.


Wildcard mask

Whenever you want to calculate wildcard mask write first address and the last one and the bits which are similar write zero and which columns are different write one.

For example, deriving wild card mask of an IP 1.1.1.1 255.255.255.255 (in this case starting and ending address of this IP address is same)

1.1.1.1
1.1.1.1
0.0.0.0            
(Because all columns match so we write all zeros)


Calculating wild card mask
192.168.1.0
192.168.1.255

Opening binary
192.168.1.00000000
192.168.1.11111111
 0   .   0 . 0.    255

Calculating wild card mask
192.1.1.0
192.1.1.31

Opening binary
192.1.1. 00000000
192.1.1. 00011111
  0  .0.0. 00011111
  0 . 0.0. 31

Wildcard mask is used at two places 

       
I.    Access control list
II.    OSPF

Wild card mask used in Access control list and that of OSPF are totally different.

To check
A(config-router)# network 1.0.0.0 0.0.31.0
INVALID, Discontinuous Mask

A(config)# access-list 1 permit 1.0.0.0  0.0.31.0
Valid – working


OSPF wildcard mask must be continuous whereas ACL wild card mask can be discontinuous.


In OSPF where first bit didn’t match after that we’ll not check the bits next to that bit.








Verification commands

# show ip route
# show ip protocol


Configuring routing protocols

A(config)# router ospf 1
A(config-router)# network 1.0.0.0 255.0.0.0 area 0
A(config-router)#exit


B(config)# router ospf 1
B(config-router)# network 1.0.0.0 255.0.0.0 area 0
B(config-router)# network 2.0.0.0 255.0.0.0 area 0
B(config-router)#exit


C(config)# router ospf 1
C(config-router)# network 2.0.0.0 255.0.0.0 area 0
C(config-router)#exit


Basic Purpose of routing protocols is to perform convergence


Troubleshooting commands

# show ip ospf
# show ip ospf database
# show ip ospf neighbor
# show ip ospf interface

Show ip ospf is extremely important command which you’ll give 100 times in CCIE exam.


Router ID

There are three concepts of Router ID (Same concept in all protocols)

             I.    Hard coded Router ID (Enforce router to adopt hard coated router ID).
            II.    Highest IP address of any logical (Virtual) interface will be router ID even if physical interface has the highest IP address.
          III.    The highest IP address on any physical interface (when there’s no virtual interface)

§  Never use a physical interface’s IP or Logical interface IP as your router ID always use hard coded Router ID.

A(config-router)# router-id 1.1.1.1


Router ID is command of new IOS it’s not supported in old IOS versions.

A network with same routing policies is called Autonomous System


In an autonomous system you can have multiple areas, in one area you can have multiple networks and every network has its own DR and BDR, if it is a multi-access (Ethernet) interface.











When you’ve got multiple areas there must be area zero in between them, because area 0 is the back bone area, it makes different areas communicate with each other.


Serial link is not multi-access its point to point link.


OSPF Election
Elections occurs in a multi-access network for becoming
DR (Designated Router)

BDR (Backup Designated Router)

Router A won the election as DR and B router gets promoted to BDR, one network can have only one DR and only one BDR, the remaining routers will become DR others. 

Election in OSPF is stable one election is finalized it will never change, if they change then it means that our databases will keep on changing.
The Election of DR and BDR depends upon two factors
  1. Priority
  2. Router ID
By Default, in OSPF all the routers have same priority i.e. 1 and it’s tunable.

The router with highest priority wins the election and the router with second highest Priority will become BDR all others becomes DR Others.

Waiting state is for DR and BDR only and not for DR Others

I.        First of all Priority will be checked Router with highest priority wins election and one with second highest priority becomes BDR.

        

II.       If Priority is equal router with highest Router-ID wins DR election and router with second highest Router-ID becomes BDR and rest of the router becomes DR other.

      

Now even if any router with higher priority or higher router-id will come, doesn’t matter OSPF elections are stable because stability is very critical requirement on networks.


How to make Proper high end router your DR and BDR?

I.     You must complete configurations within 40 seconds in order to make the                        appropriate router with highest priority, DR for your network.
 II.     You must clear OSPF process in order to organize OSPF Elections once again.

Router# clear ip ospf process
Now Elections will take place once again

Highly recommended not to use this command in live environment, it will give you down time


 §  What if DR goes down?
BDR will get promoted to DR and the router with the third highest priority will take place of BDR.
  
§  What if DR comes up once again?
Once the elections are finalized the elections will not occur again until you issue clear OSPF process command and the coming router will become DR Other.
  
§  Now if the new DR goes down?
BDR will become DR and the elections will occur for the BDR.
  
§  What is role of DR and BDR?
OSPF didn’t broadcasts its packets, it multicasts, on the other hand in the case of RIP it broadcasts its packets, to ensure debug rip’s packets


As a result you’ll see rip send it’s packets to 255.255.255.255, but when you debug OSPF packets you’ll see it sends it’s packets on two multicast address.

I)             224.0.0.5
II)            224.0.0.6


How many networks a router can have?

It depends upon the Number of interfaces, because every interface represents one network.

At the same time, it is possible that we’ve made some loop back interfaces then every loop back interface will also have a different network so it can’t be answered accurately.

It can have 15 or even 100 networks, so when we say that a router has 15 networks then it will send all its networks to its neighbors for performing convergence.

One possibility is that router broadcast its networks and sends it to everybody which is not at all efficient.


OSPF multicasts, it is kind of centralized communication.

§    When a new router comes up in a network it talks to group of DR’s, DR and BDR are responsible for informing everybody about network.





















§  Why DR and BDR?

If there are 100 routers and everybody is sending it’s advertisements to everybody it will eat up all the bandwidth and it will take a long time to converge,

DR and BDR handles the convergence, OSPF running routers multicast network updates to DR and BDR instead of broadcasting.



§  The very first process in OSPF is DR and BDR election.

Because DR and BDR are responsible for communication, to manage the database of LSA it’s another responsibility of DR and BDR. 


§  Every network has its own DR and BDR provided if it’s multi-access network



How many DR and BDR are there in this Topology?
















There could be three DR and BDR in this topology

No DR/BDR elections on serial (point to point) links they will talk directly to each other.

How many DR and BDR are there in this Topology?








There are four networks in topology and each network will have its own DR and BDR if it’s multi-access network, two are serial so there could be two DR and BDR.


How many DR and BDR are there in this Topology?



One DR one BDR and one DR other


To check which interfaces are running OSPF


Router# show ip ospf interface

R1#show ip ospf interface
FastEthernet0/0 is up, line protocol is up
  Internet Address 200.100.1.1/24, Area 0, Attached via Network Statement
  Process ID 1, Router ID 200.100.1.1, Network Type BROADCAST, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           1         no          no            Base
  Transmit Delay is 1 sec, State DROTHER, Priority 1
  Designated Router (ID) 200.100.1.3, Interface address 200.100.1.3
  Backup Designated router (ID) 200.100.1.4, Interface address 200.100.1.4
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:02
  Supports Link-local Signaling (LLS)
  Cisco NSF helper support enabled
  IETF NSF helper support enabled
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 2
  Last flood scan time is 0 msec, maximum is 4 msec
  Neighbor Count is 3, Adjacent neighbor count is 2
    Adjacent with neighbor 200.100.1.3  (Designated Router)
    Adjacent with neighbor 200.100.1.4  (Backup Designated Router)

  Suppress hello for 0 neighbor(s)


A router is DR / BDR / DR other at interface level not as a whole, a router can be DR / BDR / DR Other at the same time at different interfaces.










Practice LAB








                     I.    Configure that router with lowest priority first so that it can become DR
                    II.    Now configure that router second priority so that it can become BDR
                  III.    And now configure the highest priority router to become DR other
                  IV.    Clear OSPF process to see the fair elections result


Types of routers

  • Internal router - Router with all interfaces in the same area.
  • Backbone Router/ Backbone internal router - Router who’s all interfaces are in the same area and that area is back bone area.
  • Area Border Router - Router which provides connectivity between two areas and make possible for them to communicate with each other.
  • Autonomous System Boundary Router system and make possible for them to communicate with each other.


IR
Internal Router
ABR
Area Border Router
BBIR
Backbone Internal Router
ASBR
Autonomous System Boundary Router

DR, BDR, IR, BIR, ABR, and ASBR a router can have multiple states at the same time.


§  Topology is physical arrangement of devices

Three steps are involved in convergence.
I. Neignbor table. (Contains details of directly connected neighbors)
II. Topology table. (Contains picture of complete network, all routes in network)
III. Routing table. (Contains the best path to reach any network)

Neighbor table
It is made when OSPF process starts and routers send LSAs to their directly connected neighbors


Neighbor table is different on each and every router, it contains details of directly connected neighbors.

Database/ Topology table

Also known as topology table, it contains all possible paths for reaching a destination, it contains details about all the devices and complete picture of network, database table is same on all routers.

Example

If you take a snap of this room and distribute this picture to all so every person in this room will see the same map of the class 

Routing Table

After algorithm is applied on database table to find the best path to a destination (Every routing protocol have its own algorithm OSPF uses dijkstra algorithm) It is also different on each router.


It is not possible for a router to make topology table without making neighbor table, similarly it’s not possible for router to make routing table without making topology table, these are sequential steps.


Convergence is when information on all the routers has been advertised or shared to all other devices in network.


OSPF policy to count the best path is cost and RIP policy for the same purpose is hop count so both these protocols have the different routing policies.









Router A and C are connecting through B, Router B is making them communicate with each other as Router B is in area 0 and Area 1 as well so it is ABR (Area Border Router).


Do you think LSA 4 will also go to Router A?

If there’s any ASBR in the network, then LSA 4 will also come to A because LSA 4 tells the location of ASBR as gateway.

Because anything generated by ASBR is LSA 5 so if there would be ASBR then definitely there would be LSA 5 as well.

A# show ip route
A# show ip protocols
A# configure terminal
A(config)# router ospf 1
A(config-router)# network 1.0.0.0 0.255.255.255 area 0
A(config-router)# network 200.100.50.0 0.0.0.255 area 0
A(config-router)# exit

B# show ip route
B# show ip protocols
B# configure terminal
B(config)# router ospf 1
B(config-router)# network 1.0.0.0 0.255.255.255 area 0
B(config-router)# network 200.100.100.0 0.0.0.255 area 0
B(config-router)# network 2.0.0.0 0.255.255.255 area 1
B(config-router)# exit

C# show ip route
C# show ip protocols
C# configure terminal
C(config)# router ospf 1
C(config-router)# network 2.0.0.0 0.255.255.255 area 1
C(config-router)# network 200.100.150.0 0.0.0.255 area 1
C(config-router)# exit


Routes appearing with only “O” could be LSA 1 and LSA 2 they can never be LSA 3 or 4.

In same OSPF instance (Process ID) routes coming from another area without redistribution (i.e. LSA 3) will appear in routing table with OIA.

Routes appearing with OE2 are LSA 5 i.e. generated by ASBR.


Routing table on router A




Routing table on router B












Routing table on router C












Show ip ospf on router B











Configuring C to make it ASBR

We will connect Router C to another autonomous system as we don’t have another autonomous system so we’ll declare some static routes pointing towards null zero.
C(config)# ip route 192.168.1.0 255.255.255.0 null 0
C(config)# ip route 192.168.2.0 255.255.255.0 null 0
C(config)# ip route 192.168.3.0 255.255.255.0 null 0
C(config)# ip route 192.168.4.0 255.255.255.0 null 0

Because on router c there’s another autonomous system which we represented by Static routes pointing towards null zero, so router c is connecting this AS to another AS but there’s no communication so it’s not an ASBR now we’ll make communication possible by redistributing those static routes into ospf.

So make an arrow in the direction where we are going to inject routes and now go into head and through the tail into head.









C# configure terminal
C(config)# router ospf 1
C(config-router)# redistribute static subnets
C(config-router)# exit

Always include word “Subnet” so that all those addresses which are not subnets are also redistributed there’s no need to tell the language because static routes can adopt any language.


Now check if these redistributed routes have been reached on B or not













Now because routes have been injected and reached B No Router C is ASBR











Route Summarization

It’s the longest match for all the entries in the routing table pointing towards the same interface.
When routes become too much then it comes a time when you need to minimize the no of routes, because you need to conserve your RAM.

Bigger size of tables increases the utilization of Ram and Flash and these are the biggest recourses in your router.

For example, in a routing table there is an entry
H A R O O N / 6  serial 0
H A S H I M / 6    serial 1
At CCNA level we say “/” tells us that how many network bits are there, actually this “/” tells us how many bits of the coming packets we need to match.
If a packet “HAROON AHMED” is coming, then it’s first 6 bits will be matched and in case if first six bits matches the packet will be sent on serial 0.
Now if the size of routing table has increased like 50 MB then we’ll have to decrease the size. So you’ll perform route summarization, and it’s the longest match which is pointing towards the same interface and they must be contagious.
16, 17, 18, 19, 20
If routes are pointing towards different interfaces, then route summarization is not possible.
Ha / 2

Now there’s only one entry in the routing table.

Benefit
First there were two entries and now it’s only one. (Resource management)

Disadvantage

If hannan comes only first two bits will be matched and he’ll have permission to enter the network, it’s a very big security loophole. So route summarization can be practiced within an organization within a domain where you trust that nobody is going to break the security.

How to configure summary-Address

C(config)# router ospf 1

C(config-router)# summary-address 192.168.0.0 255.255.248.0


Post a Comment

0 Comments