top of page
Writer's pictureMukesh Chanderia

Interview Questions OSPF

Updated: Oct 31, 2022

Link-state routing protocols have a complete map of the network. Hence, it could calculate the shortest path to all the different destinations. The downside is that this is more CPU intensive as compared to distance vector routing protocol (RIP).


OSPF protocol number is 89 & it uses two IP multicast addresses


225.0.0.5 from DR to all OSPF routers (Including BDR)

224.0.0.6 from all routers to DR/BDR.


An LSA contains routing and topology information which is sent by OSPF router to its neighbors and thus link state database or LSDB is created which is nothing but complete map of the network.


Once every router has a complete map it can start calculating the shortest path to all the different destinations by using the algorithm called shortest-path first (SPF).


OSPF works with the concepts of areas and area 0 (backbone area) is that from which all other areas get connected. So, area 0 also has information from all other areas.


Routers between two areas (say between area 0 and area 1) are called area border routers or ABR.


Routers running other routing protocols and redistributing them in ospf (this applies to redistributing static or connected routes as well) are called ASBR (Autonomous System Border Routers).


By default, each OSPF LSA is only valid for 30 minutes. If the LSA expires, then the router that created the LSA will resend the LSA and increase the sequence number.


All our OSPF routers will only form full neighbor adjacencies with the Designated Router (DR) and a Backup Designated Router (BDR) and not with all other neighbors.


Cost


Cost = Reference Bandwidth / Interface Bandwidth


The reference bandwidth is a default value on Cisco routers, which is a 100Mbps interface.

For a 100 Mbps interface = 100/100 = 1


Note: Cost can’t be less than one so, by default, ospf cost for 100 MB,1GB,10 GB and 40 GB will be same.


Note: The lower the cost, the better the path.


Cisco routers have three methods to change the OSPF interface cost:


1. By directly using the interface command ‘ip ospf cost <1-65535>’


Router #conf t

Router(config)#int gi0/0/0

Router(config-if) ##ip ospf cost <1-65535>

We can verify this by using the ‘show ip ospf interface’ command.



2. Changing the ‘interface bandwidth’ setting (in kilobits), which changes the calculated value.


Router# conf t

Router(config)#int gi0/0/0

Router(config-if) ##bandwidth <1-10000000>


3. Changing the OSPF reference bandwidth setting, which changes the calculated value.


Router#conf t

Router(config)#router ospf 1

Router(config-router) #auto-cost reference-bandwidth 100000


NOTE

Please ensure reference bandwidth is the same across all routers. The reference bandwidth command warns you that you need to make the same change across all your routers. This will allow all routers to make their calculations on the same information.


MSS AND MTU


MSS (maximum segment size) is like the MTU, but used with TCP at layer 4.


MSS is the maximum size that the payload can be, after subtracting space for the IP, TCP, and other headers. So, if the MTU (Maximum Transmission Unit) is 1500 bytes, and the IP and TCP headers are 20 bytes each, the MSS is 1460 bytes.



Load Balancing


By Default, four equal cost paths will be placed in routing table.

Maximum of 16 equal paths can be configured.

To make paths equal cost, change the “cost” of a link.


ospf-router(config)#router ospf 3

ospf-router(config-router) #maximum-paths 16


OSPF Packet Types


Hello: neighbor discovery, build neighbor adjacencies, and maintain them.


DBD: This packet is used to check if the LSDB between 2 routers is the same. The DBD summarizes the LSDB.


LSR: Requests specific link-state records from an OSPF neighbor.


LSU: Sends specific link-state records that were requested. This packet is like an envelope with multiple LSAs in it.


LSAck: OSPF is a reliable protocol, so we have a packet to acknowledge the others.


OSPF States


  1. Down: no OSPF neighbors detected at this moment.

  2. Init: Hello packet received.

  3. Two-way: own router ID found in received hello packet.

  4. Ex start: master and slave roles determined.

  5. Exchange: database description packets (DBD) are sent.

  6. Loading: exchange of LSRs (Link state request) and LSUs (Link state update) packets.

  7. Full: OSPF routers now have an adjacency.


OSPF Network Types


To see network type: show ip OSPF interface


To change network type interface level command ip ospf network.


ospf-router(config)#int et0/1


ospf-router(config-if) #ip ospf network?

broadcast Specify OSPF broadcast multi-access network

non-broadcast Specify OSPF NBMA network

point-to-multipoint Specify OSPF point-to-multipoint network

point-to-point Specify OSPF point-to-point network


Non-Broadcast (NBMA) 1) Select a DR and BDR 2) OSPF expects us to configure neighbors


Broadcast –> Cisco Propriety 1) Select a DR and BDR 2) Neighbor are discovered through multicast


Point-to-multipoint 1) No DR and BDR 2) Neighbor are discovered through multicast


Point-to-multipoint non-broadcast –> Cisco Propriety 1) No DR and BDR 2) OSPF expects us to configure neighbors


Point-to-Point 1) No DR and BDR 2) Neighbour are discovered through multicast


OSPF will advertise a loop back as /32 irrespective of subnet mask. So, advertise correct subnet mask change network type as Point-to-Point.


Priority 0


To ensure routers do not take part in DR/BDR election.


Udaipur(config-if) #ip ospf priority 0


There’s also a command you can use on the Hub router to make sure a spoken router never becomes a DR or BDR


Hub(config)#router ospf 1 Hub(config-router) #neighbor 192.168.123.2 priority 0


OSPF LSA Types


Router LSA (LSA Type 1)

In this LSA you will find a list with all the directly connected links of this router. It is confined within an area.


Network LSA (LSA Type 2)

This LSA is created for each multi-access network means the broadcast and non-broadcast network types require a DR/BDR. Just like LSA 1 it also stays within the area.


Summary LSA (LSA Type 3)

Summarize inter-area routes by ABR.


Summary ASBR LSA (LSA Type 4)

ASBR Router flips a bit in its router LSA to identify herself as an ASBR.


When ABR receives this router LSA it will create a Type 4 summary ASBR LSA and flood it into area 0. This LSA will also be flooded in all other areas from area 0 so that all OSPF routers know where to find the ASBR.


Autonomous system external LSA (LSA Type 5)

Type 5 external LSA is generated by ASBR for all routes which are redistributed in OSPF. This LSA floods in all areas (E1 or E2).

Multicast OSPF LSA (LSA Type 6)

Not supported by Cisco. PIM (Protocol Independent Multicast) is used for multicast Configurations.

Not-so-stubby area LSA (LSA Type 7)

NSSA areas do not allow type 5 external LSAs. Since type 5 is not allowed that's why we have a type 7 external LSA that carries the exact same information but is not blocked within the NSSA area. After reaching ABR it gets converted as a type 5 LSA.


Route Summarization


Inter Area Route Summarization in OSPF (Only ABR)


1) A summary route will only be advertised if you have at least one subnet that falls within the summary range.


2)Your ABR that creates the summary route will create a null0 interface to prevent loops.


Udaipur(config)#router ospf 1 Udaipur(config-router) #area 0 range 192.168.0.0 255.255.0.0


External Route Summarization (ABR ABR or ASBR)


A null0 entry will be created in the routing table for the summary route.


Udaipur(config)#router ospf 1 Udaipur(config-router) ##summary-address 192.168.0.0 255.255.0.0


To advertise Default route in OSPF


Udaipur(config)#router ospf 1 Udaipur(config-router) # default-information originate –> It advertise when default route is present in routing table


Udaipur(config-router) # default-information always originate -⇾ it will advertise the default route even if you don't have it in the routing table.


OSPF Area Types


Stub area: block all type 5 external LSAs: To reach networks in other areas there will be a default route.


Udaipur(config)#router ospf 1 Udaipur(config-router) ##area 1 stub


Totally stub area: block type 5 external LSAs and type 3 summary LSAs. A default route gets injected.


Udaipur(config)#router ospf 1 Udaipur(config-router) ##area 1 stub no-summary


NSSA (not so stubby area) : Stub Area with ASBR: type 7 external LSA are allowed.


Required to configure default route.


Udaipur(config)#router ospf 1 Udaipur(config-router) ##area 1 nssa

Udaipur(config)#router ospf 1 Udaipur(config-router) ##area 1 nssa default-information-originate


Totally NSSA (totally not so stubby area): Blocks type 3 and type 5 summary LSAs. A default route gets injected.

Udaipur(config)#router ospf 1 Udaipur(config-router) #area 1 nssa no-summary


Note: The backbone area cannot become stub or totally stub area.


OSPF Authentication


Plaintext authentication


Udaipur(config)#interface fastEthernet 0/0 Udaipur(config-if) #ip ospf authentication Udaipur(config-if) #ip ospf authentication-key CITYOFLAKES


If there are lots of interfaces to enable authentication, then it’s better to enable one entire area.


Udaipur(config)#router ospf 1 Udaipur(config-router) ##area 0 authentication

Udaipur# debug ip ospf packet

Aut:0 is no authentication. Aut:1 is plaintext authentication. Aut:2 is MD5 authentication


MD5 authentication


Udaipur(config)#interface FastEthernet 0/0 Udaipur(config-if) ##ip ospf message-digest-key 1 md5 CITYOFLAKES Udaipur(config-if) #ip ospf authentication message-digest


Note: It doesn't matter which key number you choose, but it has to be the same on both ends.


Udaipur(config)#router ospf 1 Udaipur(config-router) ##area 0 authentication message-digest


OSPF Virtual Links


All areas have to be connected to area 0 which is the backbone area. If because of some reason direct physical link connection to area 0 isn’t possible then we need to connect it by virtual link.


Udaipur(config)#router ospf 1 Udaipur(config-router) #area 1 virtual-link 1.1.1.1


E1 & E2 Routes


E1: Cost of both external & internal route is calculated to reach ASBR.


E2: Cost of external routes takes precedence over internal route to reach ASBR.

In the case of tie, only internal route is calculated.





95 views0 comments

Recent Posts

See All

Comments


bottom of page