28 Oct 2020
5 types of packets are used in OSPF:
|1||Hello||Discovers neighbours and builds adjacencies between them. - default every 10 seconds|
|2||Database Description (DBD)||Checks for database synchronisation between routers
Contains an abbreviated list of the LSDB of the sending router
|3||Link-State Request (LSR)||Requests specific link-state records from router to router|
|4||Link-State Update (LSU)||Sends specifically requested link-state records
Contains 11 different LSAs
|5||Link-State Acknowledgment (LSAck)||Acknowledges the other packet types|
The five packets are used to create and maintain 3 OSPF databases, which are stored in RAM:
|Adjacency Database||Neighbour Table||* List of all established neighbour routers.
* This table is unique for each router.
* Can be viewed using the show ip ospf neighbor command.
|Link-state Database||Topology Table||* Lists information about all other routers in the network.
* This database represents the network topology.
* All routers within an area have identical LSDB.
*Can be viewed using the show ip ospf database command.
|Forwarding Database||Routing Table||* List of routes generated when an algorithm is run on the link-state database.
* The routing table of each router is unique and contains information on how and where to send packets to other routers.
* Can be viewed using the show ip route command.
Multiarea OSPF offers the following advantages:
LSUs are also used to forward OSPF routing updates, such as link changes.
An LSU packet can contain 11 different types of OSPFv2 LSAs. OSPFv3 renamed several of these LSAs and also contains two additional LSAs.
|3 or 4||Summary LSAs|
|5||Autonomous System External LSAs|
|6||Multicast OSPF LSAs|
|7||Defined for Not-So-Stubby Areas|
|8||External Attributes LSA for Border Gateway Protocol (BGPs)|
OSPF Type 1 packet is the Hello packet. Hello packets are used to do the following:
|Down State||1. No Hello packets received = Down.
2. Router sends Hello packets.
3. Transition to Init state.
|Init State||1. Hello packets are received from the neighbour.
* They contain the Router ID of the sending router.
2. Transition to Two-Way state.
|Two-Way State||* In this state, communication between the two routers is bidirectional.
* On multiaccess links, the routers elect a Designated Router (DR) and a Backup Designated Router (BDR).
* Transition to ExStart state.
|ExStart State||On point-to-point networks, the two routers decide which router will initiate the DBD packet exchange and decide upon the initial DBD packet sequence number.|
|Exchange State||1. Routers exchange DBD packets.
2. If additional router information is required then transition to Loading; otherwise, transition to the Full state.
|Loading State||1. LSRs and LSUs are used to gain additional route information.
2. Routes are processed using the Dijkstra’s SPF algorithm.
3. Transition to the Full state.
|Full State||The link-state database of the router is fully synchronised.|
Decide first router
In the ExStart state
The router with the higher router ID will be the first router to send DBD packets
Send an LSR
two challenges for OSPF regarding the flooding of LSAs, as follows:
Creation of multiple adjacencies -
Ethernet networks could potentially interconnect many OSPF routers over a common link.
Creating adjacencies with every router is unnecessary and undesirable.
It would lead to an excessive number of LSAs exchanged between routers on the same network.
Extensive flooding of Link-State Advertisements (LSA) -
Calculate Number of Adjacenies:
n ( n-1 ) / 2 = # Adjacenies
5 ( n-1 ) / 2 = 10 Adjacenies
The solution to managing the number of adjacencies and the flooding of LSAs on a multiaccess network is the DR.
OSPF elects a DR to be the collection and distribution point for LSAs sent and received.
Enable OSPF using the
router ospf <process-id> within the global configuration mode, you will be taken into the router configuration mode.
R1(config)# router ospf 10 R1(config-router)#
A process ID can be between 1 and 65,535 and is significant to the individual router, this is not required to establish adjacencies.
A router ID is a 32-bit value, represented as an IPv4 address. The router ID uniquely identifies an OSPF router. The router ID can be assigned automatically or manually configured by an administrator.
R1(config-router)# router-id 126.96.36.199 R1# show ip protocols
The addition of a new router does not initiate a new election process.
R1(config-if)# interface Loopback 1 R1(config-if)# ip address 188.8.131.52 255.255.255.255 R1(config-if)# end R1# show ip protocols | include Router ID Router ID 184.108.40.206 R1#
A 32-bit host route (255.255.255.255) would not get advertised as a route to other OSPF routers.
An active OSPF router does not allow the router ID to be changed until the router is reloaded or the OSPF process is reset.
R1# clear ip ospf process Reset ALL OSPF processes? [no]: y
Clearing the OSPF process is the preferred method to reset the router ID.
Typically the inverse of the subnet mask configured.
The easiest method for calculating a wildcard mask is to subtract the network subnet mask from 255.255.255.255.
255.255.255.255 - 255.255.255.0 (/24 subnet mask) _________________ 000.000.000.255
Network: 192.168.226.96 /27 Subnet Mask: 255.255.255.224 Wildcard Mask: 0 . 0 . 0 . 31
There are two ways to advertise a network using the
network command, the first is to use a wildcard to include all the network addresses or use
0.0.0.0 and the network address.
R1(config)# router ospf 10 R1(config-router)# network 10.10.1.0 0.0.0.255 area 0 R1(config-router)#
R1(config)# router ospf 10 R1(config-router)# network 10.10.1.1 0.0.0.0 area 0 R1(config-router)#
We can also directly configure OSPF on the interface using the
ip ospf command.
R1(config-router)# interface GigabitEthernet 0/0/0 R1(config-if)# ip ospf 10 area 0 R1(config-if)#
Passive interfaces prevent the transmission of routing messages through a particular interface.
R1(config)# router ospf 10 R1(config-router)# passive-interface loopback 0 R1(config-router)# end
R1# show ip protocols Passive Interface(s): Loopback0
By default OSPF will elect a DR and BDR on Ethernet interfaces, this election is unnecessary when there is a point-to-point (1-to-1) connection.
ip ospf network point-to-point on all interfaces we can disable the DR/BDR election process.
R1# show ip ospf interface GigabitEthernet 0/0/0 Network Type POINT_TO_POINT
Multi-access OSPF networks use an elected router to control the distribution of LSA (Link-State Advertisements).
Routers can be connected to the same switch to form a multi-access network. Ethernet LANs are the most common example of a multi-access network.
The DR is responsible for collecting and distributing LSAs sent and received using multicast IPv4 address 220.127.116.11
A BDR is also elected in case the DR fails. The BDR listens passively and maintains a relationship with all the routers.
All other routers become a DROTHER, using the multi-access address 18.104.22.168 which only the DR and BDR will listen.
show ip ospf interfacecommand.
show ip ospf neighborcommand
ip ospf priority value, where 0 does not become a DR.
Default Cisco OSPF Costs
|Interface Type||Reference Bandwidth in bps||Default Bandwidth in bps||Cost|
|10 Gigabiti Ethernet (10Gbps)||100,000,000||/||10,000,000,000||0.01 = 1|
|Gigabit Ethernet (1Gbps)||100,000,000||/||1,000,000,000||0.1 = 1|
|Fast Ethernet (100Mbps)||100,000,000||/||100,000,000||1|
Because the OSPF cost value must be an integer, FastEthernet, Gigabit Ethernet, and 10 Gigabit Ethernet (10 GigE) interfaces share the same cost.
To correct this situation, you can:
auto-cost reference-bandwidth Mbpscommand on each OSPF router.
ip ospf costcommand on necessary interfaces.
To return to the default reference bandwidth, use the
auto-cost reference-bandwidth 100 command.
Create a default route
R2(config)# ip route 0.0.0.0 0.0.0.0 s0/0/0
Use the OSPF originate command
R2(config)# router ospf 10 R2(config-router)# default-information originate R2(config-router)# end
The following two commands are particularly useful for verifying routing:
show ip interface brief- This verifies that the desired interfaces are active with correct IP addressing.
show ip route- This verifies that the routing table contains all the expected routes.
Additional commands for determining that OSPF is operating as expected include the following:
show ip ospf neighbor- check the router has formed an adjacency.
show ip protocols- quick way to verify vital OSPF configuration information.
show ip ospf- examine the OSPFv2 process ID and router ID, area information and last SPF algorithm executed.
show ip ospf interface- shows the process ID, the local router ID, the type of network, OSPF cost, DR and BDR information on multiaccess links, and adjacent neighbors.
show ip ospf interface brief- shows a quick summary of OSPF enabled interfaces.