OSPF

Open Shortest Path Frist(OSPF) sends to its neighbor routers via link-state advertisements(LSA’s) these contain link state and link metric. LSAs are stored in a local database(LSDB) and they are flooded throughout a OSPF routing domain just as the originating router advertised them. All OSPF routers have a synced copy of the LSDB for an area. The LSDB provides each router with a complete topology of the network the router can then calculate the best path based off on the LSDB. When looking at an OSPF topology the shortest path will be shown as the protocol calculates the shortest path. Redundant links may not display until there is a link failure at which point a topology change would occur.

Area 0 is considered the backbone area that all others must connect to. Area 0 is the backbone transit between non-backbone areas

When a network is segmented into multiple areas routers will not have a complete LSDB of the network just their area. Doing this can save on router resources such as RAM and CPU. Router can run multiple OSPF instances these instance numbers are locally significant and routes do not advertise from one instance to another.

OSPF has 5 main packet types. Hello, Database Description DBD or DDP, Link-state report, Link-state update, Link-sate ACK. Hello packets are responsible for discovering and maintaining neighbors. The router ID must be unique.

The following are OSPF neighbor states; down, attempt, init, 2-way, exstart, exchange, loading, full. In networks with multiple routers connecting via a multi-access LAN segment such as a switch all routers will form adjacencies however this is not scalable LSAs traffic will become excessive. The routers may behave as if they are in a full mesh. OSPF can overcome this by creating a pseudonode to act as the Designated Router(DR). the DR can reduce the number of adjacencies on a LAN segment. There can also be a Backup DR(BDR)

OSPF Configuration

The OSPF process ID is only locally significant but should be kept the same for operationally consistent. It can be configured via 2 methods a network area statement or interface-specific configuration.

Network Statement

Explicit IPs

Router ospf 1 
 Network 192.168.0.1 0.0.0.0 area 0
Network 192.168.1.1 0.0.0.0 area 0
Network 192.168.2.1 0.0.0.0 area 0
Network 192.168.10.1 0.0.0.0 area 0

Configurations for All Interfaces

Router ospf 1 
Network 0.0.0.0 255.255.255.255 area 0

Configure via interface

Interface gi1/0
Ip address 192.168.0.1 255.255.255.0 
 Ip ospf 1 area 0 

By default the router ID is dynamic using the highest IP on any ip loopback interface if there are no loopback interfaces it will use any active physical interfaces. You can set a static ID via ‘router-id’ the OSPF process will need to be reset after this

router ospf 1
router-id 172.16.10.1
!
clear ip ospf process

Passive interface can be turned on

router ospf 1
passive-interface default
no passive-interface gi1/0/1
!

For a neighbor adjacency to form the following must be true. Router ID must be unique, the interface must share a common interface, MTU must match, area ID must match, DR enablement must match, hello and dead must match, authentication must match, area type flags must match.

Verify neighbor relationship

switch#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.1.1       1   FULL/DR         00:00:36    172.16.10.2     Vlan172
switch#

Advertise the Default Route

Ip route 0.0.0.0 0.0.0.0 64.25.25.1
!
Router ospf 1 
Default-information originate 

OSPF cost on links 100mbit and above is the same value to get around this you can configure ‘auto-cost reference-bandwidth 100‘ this command must be set on all routers to ensure the same logic is used in an area.

Router ospf 1 
 auto-cost reference-bandwidth 100

The DR/BDR election occurs during the 2-wayneighbor state and just before the exstart state. any router with an OSPF priority of 1 to 255 tries to become the DR. by default interfaces have a value of 1. This election cannot be preempted. Raising the priority value to a value higher than 1 makes an interface more favorable.

Conf t
Int gi1/0/1
Ip ospf priority 100
!
Clear ip ospf process
!
Show ip ospf neighbor 

Cisco also allows for defining the type of link that a interface belongs too; broadcast, non-broadcast, point-to-point, point-to-multipoint, lookback.

Conf t
Int lo1
Ip add 192.168.0.1 255.255.255.0
Ip ospf network point-to-point