Chapter 5: Configuration Basics

Learn how to configure OSPF from basic setup through advanced interface configuration and verification.

Basic OSPF Configuration

This section covers the fundamental steps to configure OSPF on routers, including process creation, network statements, and router ID assignment.

Configuration Prerequisites

Before configuring OSPF, ensure the following requirements are met:

Hardware Requirements
  • Sufficient memory for LSDB
  • CPU capacity for SPF calculations
  • Network interfaces configured
  • Layer 2 connectivity established
Software Requirements
  • OSPF feature enabled
  • IP routing enabled
  • Appropriate IOS/JunOS version
  • Correct licensing (if required)

Basic Configuration Steps

Configuration Process
  1. Enable OSPF process
  2. Configure Router ID
  3. Define networks and areas
  4. Configure interface parameters
  5. Verify configuration

Cisco IOS Configuration

Enable OSPF Process

Basic OSPF Process Configuration
# Enable OSPF process
Router(config)# router ospf 1

# Configure Router ID (optional but recommended)
Router(config-router)# router-id 1.1.1.1

# Define networks and areas
Router(config-router)# network 192.168.1.0 0.0.0.255 area 0
Router(config-router)# network 10.1.1.0 0.0.0.255 area 1

Complete Cisco Configuration Example

Full Configuration
# Enter global configuration mode
Router> enable
Router# configure terminal

# Configure hostname
Router(config)# hostname R1

# Configure interfaces
R1(config)# interface GigabitEthernet0/0
R1(config-if)# ip address 192.168.1.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit

R1(config)# interface GigabitEthernet0/1
R1(config-if)# ip address 10.1.1.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit

# Configure OSPF
R1(config)# router ospf 1
R1(config-router)# router-id 1.1.1.1
R1(config-router)# network 192.168.1.0 0.0.0.255 area 0
R1(config-router)# network 10.1.1.0 0.0.0.255 area 1
R1(config-router)# exit

# Save configuration
R1(config)# end
R1# write memory

Juniper JunOS Configuration

Enable OSPF Process

Basic OSPF Process Configuration
# Configure Router ID
set routing-options router-id 1.1.1.1

# Configure OSPF areas and interfaces
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.1 interface ge-0/0/1.0

Complete Juniper Configuration Example

Full Configuration
# Configure interfaces
set interfaces ge-0/0/0 unit 0 family inet address 192.168.1.1/24
set interfaces ge-0/0/1 unit 0 family inet address 10.1.1.1/24

# Configure Router ID
set routing-options router-id 1.1.1.1

# Configure OSPF
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.1 interface ge-0/0/1.0

# Commit configuration
commit

Router ID Selection

The Router ID is a critical OSPF parameter that uniquely identifies each router:

Router ID Selection Priority
  1. Manually configured router-id (highest priority)
  2. Highest IP address on loopback interface
  3. Highest IP address on physical interface (lowest priority)

Router ID Configuration Examples

Cisco IOS
# Manual Router ID
router ospf 1
 router-id 1.1.1.1

# Loopback interface (recommended)
interface loopback0
 ip address 1.1.1.1 255.255.255.255

router ospf 1
 network 1.1.1.1 0.0.0.0 area 0
Juniper JunOS
# Manual Router ID
set routing-options router-id 1.1.1.1

# Loopback interface (recommended)
set interfaces lo0 unit 0 family inet address 1.1.1.1/32

set protocols ospf area 0.0.0.0 interface lo0.0 passive

Network Statement Wildcards

Understanding wildcard masks is crucial for proper OSPF configuration:

Wildcard Mask Examples
Network Subnet Mask Wildcard Mask OSPF Network Statement
192.168.1.0/24 255.255.255.0 0.0.0.255 network 192.168.1.0 0.0.0.255 area 0
10.1.1.1/32 255.255.255.255 0.0.0.0 network 10.1.1.1 0.0.0.0 area 0
172.16.0.0/16 255.255.0.0 0.0.255.255 network 172.16.0.0 0.0.255.255 area 0
All interfaces - 255.255.255.255 network 0.0.0.0 255.255.255.255 area 0

Common Configuration Mistakes

Avoid These Errors
  • Incorrect wildcard masks: Double-check calculations
  • Missing router-id: Can cause instability
  • Wrong area assignments: Breaks connectivity
  • Passive interfaces: Forgetting to configure
  • MTU mismatches: Prevents adjacency formation

Area Configuration

OSPF areas provide hierarchical routing structure, reduce database size, and improve network scalability through area-based topology hiding.

Area Types Overview

OSPF supports several area types, each with specific characteristics and use cases:

Standard Areas
  • Backbone Area (Area 0)
  • Normal Areas
  • Full LSA types supported
  • Complete routing information
Special Areas
  • Stub Areas
  • Totally Stub Areas
  • NSSA Areas
  • Totally NSSA Areas

Backbone Area (Area 0)

Backbone Area Requirements
  • Mandatory: Must exist in multi-area networks
  • Central: All other areas must connect to Area 0
  • Contiguous: Must be physically connected
  • Transit: Inter-area traffic flows through backbone

Stub Areas

Stub areas reduce memory and CPU usage by blocking external LSAs:

Stub Area Benefits
  • Reduced Memory: No Type-5 LSAs
  • Lower CPU: Fewer SPF calculations
  • Faster Convergence: Smaller database
  • Default Route: ABR injects 0.0.0.0/0

Stub Area Configuration

Cisco IOS - Stub Area
# Configure stub area
router ospf 1
 area 2 stub
 network 192.168.3.0 0.0.0.255 area 2

# Configure on ABR with custom cost
router ospf 1
 area 2 stub
 area 2 default-cost 10
Cisco IOS - Totally Stub
# Configure totally stub area
router ospf 1
 area 2 stub no-summary
 network 192.168.3.0 0.0.0.255 area 2

# Default cost configuration
router ospf 1
 area 2 default-cost 20

NSSA Areas

Not-So-Stubby Areas (NSSA) combine stub area benefits with external route injection:

NSSA Characteristics
  • No Type-5 LSAs: External routes blocked from backbone
  • Type-7 LSAs: Local external routes allowed
  • ASBR Support: Can contain autonomous system boundary routers
  • Translation: ABR converts Type-7 to Type-5

NSSA Configuration

Cisco IOS - NSSA
# Configure NSSA area
router ospf 1
 area 3 nssa
 network 192.168.4.0 0.0.0.255 area 3

# NSSA with default route
router ospf 1
 area 3 nssa default-information-originate
Cisco IOS - Totally NSSA
# Configure totally NSSA area
router ospf 1
 area 3 nssa no-summary
 network 192.168.4.0 0.0.0.255 area 3

# Default route and cost
router ospf 1
 area 3 nssa default-information-originate metric 100

Interface Configuration

Interface-specific OSPF configuration controls timers, costs, network types, and authentication on a per-interface basis for optimal performance.

Interface Configuration Methods

OSPF interfaces can be configured using two primary methods:

Network Statement Method
  • Configure under router ospf process
  • Uses network and wildcard mask
  • Matches interface IP addresses
  • Traditional method
Interface Command Method
  • Configure directly on interface
  • More granular control
  • Easier troubleshooting
  • Modern preferred method

Interface Cost Configuration

Cost is the most important interface parameter for path selection:

Cost Configuration Examples

Cisco IOS
# Manual cost configuration
interface gigabitethernet0/0
 ip ospf cost 10

# Auto-cost reference bandwidth
router ospf 1
 auto-cost reference-bandwidth 10000

# Interface bandwidth method
interface gigabitethernet0/0
 bandwidth 100000
Juniper JunOS
# Manual cost configuration
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 metric 10

# Reference bandwidth
set protocols ospf reference-bandwidth 10g

# Interface bandwidth
set interfaces ge-0/0/0 bandwidth 100m

Timer Configuration

OSPF timers must match between neighbors for adjacency formation:

Timer Requirements
  • Hello/Dead Interval: Must match between neighbors
  • Dead Interval: Typically 4x hello interval
  • Retransmit Interval: Should be > expected RTT
  • Transmit Delay: Should be > serialization delay

Timer Configuration Examples

Cisco IOS
# Fast timers for quick convergence
interface gigabitethernet0/0
 ip ospf hello-interval 1
 ip ospf dead-interval 4
 ip ospf retransmit-interval 2
 ip ospf transmit-delay 1

# Slow timers for WAN links
interface serial0/0
 ip ospf hello-interval 30
 ip ospf dead-interval 120
 ip ospf retransmit-interval 10
 ip ospf transmit-delay 5
Juniper JunOS
# Fast timers for quick convergence
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 hello-interval 1
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 dead-interval 4
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 retransmit-interval 2
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 transit-delay 1

# Slow timers for WAN links
set protocols ospf area 0.0.0.0 interface t1-0/0/0.0 hello-interval 30
set protocols ospf area 0.0.0.0 interface t1-0/0/0.0 dead-interval 120

Passive Interface Configuration

Passive interfaces participate in OSPF but don't send/receive OSPF packets:

Passive Interface Benefits
  • Security: Prevent OSPF adjacencies on user-facing interfaces
  • Bandwidth: Reduce OSPF traffic on low-bandwidth links
  • Stability: Prevent unnecessary neighbor relationships
  • Scalability: Advertise networks without forming adjacencies

Passive Interface Configuration

Cisco IOS
# Make specific interface passive
router ospf 1
 passive-interface gigabitethernet0/0

# Make all interfaces passive by default
router ospf 1
 passive-interface default
 no passive-interface gigabitethernet0/1
 no passive-interface serial0/0

# Interface-specific passive
interface gigabitethernet0/0
 ip ospf passive-interface
Juniper JunOS
# Make specific interface passive
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 passive

# Make all interfaces passive by default
set protocols ospf area 0.0.0.0 interface all passive
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 passive disable
set protocols ospf area 0.0.0.0 interface t1-0/0/0.0 passive disable

# Passive with metric
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ospf area 0.0.0.0 interface lo0.0 metric 1

Configuration Verification

Proper verification ensures OSPF is configured correctly and functioning as expected. This section covers essential commands and troubleshooting techniques.

Essential Verification Commands

Key commands to verify OSPF configuration and operation:

Cisco IOS Commands
  • show ip ospf
  • show ip ospf interface
  • show ip ospf neighbor
  • show ip ospf database
  • show ip route ospf
Juniper JunOS Commands
  • show ospf overview
  • show ospf interface
  • show ospf neighbor
  • show ospf database
  • show route protocol ospf

Process and General Information

Start verification by checking the OSPF process status:

Cisco IOS - Show IP OSPF

Command Output Analysis
Router# show ip ospf
 Routing Process "ospf 1" with ID 1.1.1.1
 Start time: 00:00:12.345, Time elapsed: 02:34:56.789
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Supports Link-local Signaling (LLS)
 Supports area transit capability
 Supports NSSA (compatible with RFC 3101)
 Event-log enabled, Maximum number of events: 1000, Mode: cyclic
 Router is not originating router-LSAs with maximum metric
 Initial SPF schedule delay 5000 msecs
 Minimum hold time between two consecutive SPFs 10000 msecs
 Maximum wait time between two consecutive SPFs 10000 msecs
 Incremental-SPF disabled
 Minimum LSA interval 5 secs
 Minimum LSA arrival 1000 msecs
 LSA group pacing timer 240 secs
 Interface flood pacing timer 33 msecs
 Retransmission pacing timer 66 msecs
 Number of external LSA 0. Checksum Sum 0x000000
 Number of opaque AS LSA 0. Checksum Sum 0x000000
 Number of DCbitless external and opaque AS LSA 0
 Number of DoNotAge external and opaque AS LSA 0
 Number of areas in this router is 1. 1 normal 0 stub 0 nssa
 Number of areas transit capable is 0
 External flood list length 0
 IETF NSF helper support enabled
 Cisco NSF helper support enabled
 Reference bandwidth unit is 100 mbps
    Area BACKBONE(0)
        Number of interfaces in this area is 1
        Area has no authentication
        SPF algorithm last executed 00:34:56.789 ago
        SPF algorithm executed 3 times
        Area ranges are
        Number of LSA 4. Checksum Sum 0x029FDB
        Number of opaque link LSA 0. Checksum Sum 0x000000
        Number of DCbitless LSA 0
        Number of indication LSA 0
        Number of DoNotAge LSA 0
        Flood list length 0

Neighbor Verification

Check OSPF neighbor relationships and adjacency status:

Cisco IOS - Show IP OSPF Neighbor

Neighbor Status Output
Router# show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/DR         00:00:34     192.168.1.2     GigabitEthernet0/0
3.3.3.3           1   FULL/BDR        00:00:37     192.168.1.3     GigabitEthernet0/0
4.4.4.4           1   FULL/DROTHER    00:00:31     192.168.1.4     GigabitEthernet0/0
5.5.5.5           0   FULL/  -        00:00:36     10.1.1.2        Serial0/0

Routing Table Verification

Verify OSPF routes are installed in the routing table:

Cisco IOS - Show IP Route OSPF

OSPF Routes
Router# show ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
O        10.1.1.0/24 [110/2] via 192.168.1.2, 00:05:23, GigabitEthernet0/0
O IA     10.2.2.0/24 [110/3] via 192.168.1.2, 00:03:45, GigabitEthernet0/0
O E2     10.3.3.0/24 [110/20] via 192.168.1.2, 00:02:12, GigabitEthernet0/0
      172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
O        172.16.1.0/24 [110/2] via 192.168.1.3, 00:04:56, GigabitEthernet0/0

Common Configuration Issues

Troubleshooting Checklist
  • No Neighbors: Check interface status, timers, authentication
  • Stuck in Init: Check for unidirectional connectivity
  • No Routes: Verify network statements and areas
  • Wrong DR/BDR: Check priorities and router IDs
  • Frequent SPF: Look for flapping interfaces

Verification Checklist

Step-by-Step Verification Process
  1. Process Status: Verify OSPF process is running
  2. Router ID: Check for unique, stable router ID
  3. Areas: Confirm correct area assignments
  4. Interfaces: Verify interface participation and timers
  5. Neighbors: Check for proper adjacency formation
  6. Database: Ensure consistent LSDB across area
  7. Routes: Verify route installation in routing table
  8. Reachability: Test end-to-end connectivity