Professional Documents
Culture Documents
OSPF
OSPF
OSPF
com/networks/ospf
Each network you advertise, you’ll have to put it into an area and the area number
can be from 0 to 4294967295
Different areas in OSPF communicate with each other through area 0, areas
cannot communicate with each other until and unless area 0 is in between them,
area 0 can communicate with all areas
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
You can run multiple instances of OSPF at the same time on a router and every
OSPF instance have an identification number and it can be from 1 to 65535
Route Summarization is performed by ABR (Area Border Router)
OSPF is IETF recommended IGP (Interior Gateway Routing Protocol) and is most
widely used IGP in the world
OSPF also have capacity to support Type of Service (TOS) routing
Condition 1
Area 0 is communicating with Area 1, but Area 2 cannot communicate with Area 1 and
Area 0
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
Condition 2
In this case only Area 2 is communicating with Area 0, and Area 1 cannot communicate
with Area 2 and Area 0.
Condition 3
In this case you can see all the areas are communicating with each other, Area 0 is in
between so Area 1 and 2 can communicate with each other and both of them can
communicate with area 0.
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
[table id=5 /]
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
Neighbor Table
Maintains information about all of its neighbors, every router will have its own
neighbor table and it will be different for every router.
Topology Table
Topology table contains all possible paths to a destination. It is the picture of the
network and topology table of all the devices in a network will be same.
Routing Table
It contains the best path to a destination.
Inverse mask
OSPF uses inverse mask or Wild Card Mask instead of Subnet Mask (used by RIP),
some people define it as opposite to Subnet mask for example.
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
255.255.255.0 0.0.0.225
255.255.255.224 0.0.0.31
225.255.255.255 0.0.0.0
Wild card mask is used in OSPF and access lists, OSPF wild card mask should
be continuous.
Convergence
A state in which all the routers in the network knows about all networks in the topology,
the basic goal of routing is to perform convergence.
Static Routing
By static routes
Dynamic routing
Dynamically with the help of routing protocols
Router ID
Each OSPF running router uses a router ID, a Router ID is a 32 bit number assigned to
each router running OSPF to uniquely identify a router within an autonomous system.
Selection of router ID
An OSPF running router chooses the Router ID in following sequence
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
Never use IP address of the physical interface as your Router ID, as there are
possibilities for physical interface to go down, it can malfunction or it can go
down because of any problem, always hard coat IP address from a virtual
interface as your OSPF Router ID.
Autonomous system
A network with the same routing policies is called autonomous system.
In an autonomous system you can have multiple areas
In one area you can have multiple networks
Every network have its own DR and BDR, if it’s a multi-access network (Ethernet)
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
OSPF Elections
Elections occur in a multi-access network, 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
By Default in OSPF all the routers have same priority i.e. 1 and it’s tune-able.
The router with highest priority wins the election and the router with second highest
Priority will become BDR all others becomes DR Others.
DR – BDR Election
First of all Router Priority will be checked, Router with highest priority wins election and
the one with second highest priority becomes BDR.
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
If priority is same
If the Priority is same in that case router with highest Router ID will become DR and one
with second highest Router ID will become BDR.
Now if another router with higher Priority or Router ID joins the network, it will not affect
the Network or OSPF elections, OSPF elections are stable, as stability is very serious
requirement for networks.
Always make a good configuration and stable router DR or BDR in your Network
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
If DR goes down BDR will get promoted to DR and the router with third highest
priority will take pace of BDR
If new elected DR also goes down, new BDR will be promoted to BDR and
elections will take place for new BDR, and the rest will remain as DR others
If old DR comes back again, it will not affect the OSPFprocess, OSPF elections
are very stable and re-elect process will not start again until and unless router
reboots or you use clear ip ospf command
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
Topology 1
Topology 2
Topology 3
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
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
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
A router can have DR, BDR, IR, BIR, ABR and ASBR, all these states at same
time.
Convergence in OSPF
There are three steps involved in convergence
1. Neighbor table
2. Topology Table
3. Routing Table
Neighbor Table
Neighbor table is made when OSPF process is started 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
Topology Table
Database table also known as topology table, it contains all possible paths for
reaching a destination. It contains details about all the devices, it contains complete
picture of network, and database table is same on all routers
We’re living in the same city, so if we buy map for our city everybody will have the
same map.
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
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 so these are sequential steps
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
We made areas to reduce the LSA traffic, if LSA are also sent across the areas then what
is the benefit of areas? In-fact the LSA within an area are fully detailed LSA and that
which are sent across the area are just summary LSA.
OSPF States
There are seven states of OSPF
I. Down
II. Init (One way state)
III. Two way state
IV. ExStart
V. Exchange
VI. Loading
VII. Full
DOWN
Router R1 sends Hello packet to router R2, if fields in hello packet do not matches with
R2, R1 will go in down state.
After 10 seconds Router A will send another Hello packet and will be in INIT state
and once again packet miss match will occur hence going once again to down
state and it’ll be stuck between these two states
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
Init State
R1 have sent hello packet to R2 and its fields are matched, now R1 is waiting for R2 to
respond this state is called Init State.
DR and BDR elections takes place after two way state before Exstart state and DR and
BDR are finalized.
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
ExStart State
At this stage the Master and slave are declared, this decision is made to start the
communication, master starts the communication first, means it will send its link state
database first.
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
Exchange State:
DBD (Database Description Packets) and LSR (Link State Request Packets) are
exchanged in this state
Master sends DBD’S (Database Description) first DBD’S are just summary for all the
routes
First Master sends the DBD (summary for all the routes) to slave, Slave compares that
DBD with its database
If there’s something missing slave sends LSR (link state request) “Hey buddy, please
send me details about 5.0.0.0 I don’t know about this network”
Loading State:
Slave in turn sends LSU (Link state update) to the master with Next hop, Cost, Metric,
Master starts loading these details into its memory, and is in loading state.
After that same process is repeated, but this time slave sends DBD and Master Checks.
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
How many LSA’s are in one LSU depends upon LSR, Let suppose if 10 networks were
missing from R2 database, R2 will send LSR for 10 networks, so R1 instead of sending
10 LSA’s send one LSU containing 10 LSA’s
Full State
After all these DBD, LSR, LSU and LsAck (comparison of database) is completed and all
the networks are loaded into memory i.e. database table, this state is called full state.
Now we can run SPF algorithm to get the best path for our routing table.
Virtual links
When we’re talking about a link it should always be in between at-least two devices, to
be more specific when we talk about a virtual link it’s obvious that it requires atleast two
or more devices.
A virtual link is a link from any area which is not directly connected to area 0 to backbone
area (area 0) through a non-backbone area.
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
You cannot make a virtual link from any device to any other device, there are certain
conditions both deices should meet in order to make a virtual link.
In the above topology, which router have which area can be seen in the table below
Router Areas
R1 A0
R2 A0, A1
R3 A1, A2
R4 A2
Only on those routers who meets both the requirements, we can make a virtual link
R2 – R3
R2 – R4 X
So Virtual link can be made between R2 and R3 only, Between R2 and R4 they don’t
meet both the requirements.
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
Stub area
A stub area is an area which does not receive route advertisements external to the
Autonomous system (AS) and routing from within the area is based entirely on a default
route.
Areas through which or into which AS external advertisements are not flooded.
An area where LSA 5 have got nothing to do, you can see LSA 1, 2, 3 and 4 but you won’t
see LSA 5 in stub area.
ABR Blocks LSA 5 and inject a default static route 0.0.0.0, Replacing LSA 5 with
default static route.
You might want to create stub areas when much of the topological database
consists of AS external advertisements
This reduces the size of the routing databases (topological databases) for the
area's internal routers hence reducing the amount of memory required on the
internal routers in the stub area
Before creating stub you can see O, O IA, OE1 and OE2 in your table and after creating
stub you’ll see only O, O IA and O*IA 0.0.0.0, means replacing LSA 5 with O*IA 0.0.0.0
When an area border router is configured for a stub area, the router automatically
injects a default route instead of flooding area with external routes, so that
routers in the stub area can reach destinations outside the area.
An area is stub, not the router, and you need to give “area xx stub” command to
all the routers in that area.
When you configure an area as stub, it means that there’s only one exit point,
single exit point.
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
Stub areas are made, where we want to reduce the size of routing table, where
there is trusted network, our own network.
Like in route summarization, size of routing table is reduced in stub area also but
it’s a security loophole because now our traffic is going for unwanted destinations
(Networks) also.
When you make a stub area it’s not right to say that you don’t have connection to
the outside world, you have connection but LSA from outside are not coming in
and you’re using default static route to go out of your network.
Not every area can be a stub area, there are several conditions where we cannot
make a stub area
Backbone can never have single exit point, which is very much logical, backbone
is where the whole world connects.
Many people make a mistake, to make an area stub they go to ABR and give
command to make area stub, which is wrong, to make an area stub you’ll have to
configure area as stub on all routers inside the area.
To make an area, stub area we’ll have to configure on all routers, configuring on
only ABR may give you results sometimes but this is not the right way, to have
stable and predictable result you should configure on all routers, LSA’s will
disappear from routing table and default route will be injected, in cases of
mistake mostly default route is not injected
Here in totally stub area you will see only routes with “O” and for “O IA” a default
route (0.0.0.0) will be injected.
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
In Totally stub area we’ll see only LSA 1 and LSA 2 (Routes with “O”) means we
can see routes from our own area only where as in stub area we’ll see LSA 1, 2,
3 and LSA 4 which means we can see routes from our own Autonomous System.
LSA 5 is already filtered in stub area now in totally stub area LSA 3 and 4 (Summary LSA
– which is originated by ABR) are also filtered to enter your area so it’s not necessary to
go on all routers just go to ABR from where they are originating and give command of
totally stubby area.
It is sufficient to configure totally stubby area only on ABR, because LSA 3, 4 are
originated by ABR.
When we go back from totally stub area “no area 1 stub no-summary”, it goes
only one step back i.e. stub, we’ll have to give this command once again “no area
1 stub” then it will come out of stub.
If I make Area 1 NSSA area one will not suppress LSA produced by R1 but it will
suppress LSA 5 produced by R4 or any other ASBR.
www.itworldcentral.com
Connecting professional minds…
www.itworldcentral.com/networks/ospf
NSSA didn’t block LSA 5 of ASBR in its own area, even if there are 10 ASBR in
area but blocks LSA 5 of external ASBR’s, and covers LSA 5 of its own ASBR
with a covering of LSA 7.
After configuring Area 1 as stub area when R1 will generate LSA5 and advertise them
routers in Area 1 will see LSA5 arrived which is block, so to deal with this problem routers
in Area 1 covers LSA5 with another LSA cover which is LSA7 and when the border router
want to advertise it, it will open the covering of LSA7 and will advertise it as LSA5.
OSPF OPERATION
1. OSPF speaking router send hello packets out on OSPF enabled interfaces and if
both sides sharing a common data link agree on certain parameters specified in
their respective Hello packets, they become neighbors
2. Adjacencies which are like a point to point virtual link are formed between those
neighbors which have same attributes or values in hello packets.
3. All OSPF running routers sends LSA over their adjacencies, LSA’s explains all the
links of a router and their state along with neighbors, the link might be pointing to
Stub networks, to network in other areas, to another external network (maybe they
are advertised) or to a stub network.
4. On receiving LSA from neighbor every OSPF running router records LSA in its
Link-state Database and sends a copy of it to other neighbors.
5. By flooding LSA throughout area, all the routers will build identical link state
database.
6. All routers apply SPF algorithm on database to generate loop-free graph
describing shortest possible (with lowest cost) to every known destination or
network with itself as the root, this graph is known as SPF Tree.
7. Each router builds its own routing table from SPF tree.
www.itworldcentral.com
Connecting professional minds…