Computer Networks

[Day 8] 4. OSPF Configuration and Key Concepts

D
DITISS Admin
••5 min read

OSPF Configuration Example:

Topology:

(172.16.10.1/24) A (172.16.20.1/24) <-----------------------------> (172.16.20.2/24) B (172.16.30.1/24)

Router A Configuration:

  1. Enter OSPF Configuration:

    bash
    A(config)# router ospf 10
    
    • Process ID: The
      10
      here is the OSPF process ID, used to identify OSPF processes in the router's microcontroller. It does not need to match between neighboring routers.
  2. Configure Networks for OSPF:

    bash
    A(config-router)# network 172.16.10.0 0.0.0.255 area 0
    A(config-router)# network 172.16.20.0 0.0.0.255 area 0
    

Router B Configuration:

  1. Enter OSPF Configuration:

    bash
    B(config)# router ospf 10
    
  2. Configure Networks for OSPF:

    bash
    B(config-router)# network 172.16.20.0 0.0.0.255 area 0
    B(config-router)# network 172.16.30.0 0.0.0.255 area 0
    

Key OSPF Concepts

Wild Card Mask:

  • The wildcard mask is the inverse of a subnet mask.
    • Example: Subnet mask
      255.255.255.0
      → Wildcard mask
      0.0.0.255
      .
    • Wildcard masks define which bits of an IP address should be ignored during network matching.

Changing OSPF Areas:

  • If you want to configure a network in a different OSPF area, specify the area ID:

    bash
    A(config-router)# network 172.16.10.0 0.0.0.255 area 1
    

Passive Interface in OSPF

  • A passive interface stops sending or receiving OSPF Hello packets while still advertising the connected network in OSPF.
  • Usage: To prevent unnecessary OSPF traffic on specific interfaces, such as those connected to end devices.

Loopback Interface in OSPF

  • A loopback interface is often used to assign a stable, always-up IP address for OSPF's Router ID.

  • Commands to configure a loopback interface:

    bash
    A(config)# int lo0
    A(config-if)# ip address 1.1.1.1 255.255.255.255
    A(config-if)# no shut
    

Useful OSPF Commands:

  1. show ip ospf database

    • Displays the link-state database (LSDB), showing all the collected LSAs.
  2. show ip ospf neighbor

    • Displays the neighbor database, listing all OSPF neighbors and their statuses.
  3. show ip route

    • Displays the routing table, including OSPF-learned routes.

OSPF Route Types in the Routing Table:

  • O: OSPF routes.
    • OI: Inter-area routes (between areas).
    • Oi: Intra-area routes (within the same area).
    • O E2 or O E1: External OSPF routes (from outside the OSPF domain).

Designated Router (DR) and Backup Designated Router (BDR)

  • On broadcast or multi-access networks (e.g., Ethernet), OSPF elects a Designated Router (DR) and Backup Designated Router (BDR) to reduce overhead.
    • DR: Collects and distributes LSAs for the segment, acting as the main point of communication.
    • BDR: Takes over if the DR fails.

Election Process:

  1. The DR is the router with the highest Router ID (RID) among all routers on the segment.
  2. The BDR is the router with the second-highest RID.
  3. Only occurs on Ethernet networks (not point-to-point or others).

Important Notes:

  • The BDR is elected first, and if a DR is missing, the BDR is promoted to DR.
  • A newly added router with a higher priority or RID cannot preempt the current DR/BDR. It must wait for a re-election, which happens only when both the DR and BDR fail.

Advantages of Wildcard Masks

  • Flexibility: Allows OSPF to specify multiple subnets or ranges efficiently.
  • Precision: Controls which networks are included in OSPF processes.

Additional Notes

  • Host Mask: A wildcard mask of
    0.0.0.0
    represents a single host, used for identifying specific devices in OSPF.

Read Next

8/26/2026

[Day 8] 5. EIGRP

### **Enhanced Interior Gateway Routing Protocol (EIGRP)** - **Type**: Hybrid routing protocol, combining the best features of both distance-vector...

8/26/2026

[Day 9] 1. Exclusive Features of EIGRP and Commands

#### **Auto Summarization** - **Auto Summarization** in EIGRP automatically summarizes routes at classful network boundaries, reducing the routing...