OSPF Path Manipulation

OSPF prefers the lowest cost path to determine the best route. While OSPF doesn’t use administrative distance directly for path control like other protocols (e.g., EIGRP or BGP), there are several effective methods to manipulate OSPF routes.


1. OSPF Cost Manipulation (Recommended Method)

The most common method to influence OSPF path selection is by adjusting the interface cost.

πŸ”Ή Cost Calculation Formula

Cost=Reference BandwidthInterface Bandwidth\text{Cost} = \frac{\text{Reference Bandwidth}}{\text{Interface Bandwidth}}Cost=Interface BandwidthReference Bandwidth​

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

(Recommended for networks with gigabit or higher-speed links)

πŸ”Ή Cost Adjustment Command

To modify the OSPF cost directly on an interface:

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

βœ… Higher Cost = Less Preferred Path
βœ… Lower Cost = More Preferred Path

Example Topology

R1 ----- 100 Mbps ----- R2
R1 ----- 10 Mbps ------ R3 ----- 1 Gbps ------ R2

2. OSPF Metric Manipulation Using Bandwidth

Since OSPF calculates cost based on bandwidth by default, modifying the bandwidth also manipulates the path.

πŸ”Ή Bandwidth Command

Router(config-if)# bandwidth <value in kbps>

❗ Note: The bandwidth command only influences OSPF cost calculations β€” it does not change the actual interface speed.


3. Route Summarization (On ABRs/ASBRs)

Summarization helps reduce the LSDB size and can influence path selection by controlling route advertisements.

πŸ”Ή ABR Summarization (Inter-Area)

Router(config-router)# area <area-id> range <network> <mask>

πŸ”Ή ASBR Summarization (External Routes)

Router(config-router)# summary-address <network> <mask>

βœ… Summarized routes are preferred over more specific routes with the same cost.
βœ… Helps control the size of the routing table in large networks.


4. OSPF Route Filtering

OSPF supports filtering routes using:

πŸ”Ή distribute-list (Inbound Filtering)

Router(config-router)# distribute-list <ACL> in <interface>

πŸ”Ή area <area-id> filter-list (Inter-Area Filtering)

Router(config-router)# area 1 filter-list prefix <prefix-list> in

πŸ”Ή route-map with redistribute (Advanced Control)

Router(config-router)# route-map FILTER permit 10
Router(config-route-map)# match ip address 10
Router(config-router)# redistribute static subnets route-map FILTER

5. OSPF Priority (DR/BDR Election Control)

In multi-access networks (like Ethernet), OSPF priority determines which router becomes the DR/BDR.

πŸ”Ή Command to Modify OSPF Priority

Router(config-if)# ip ospf priority <value>

βœ… Higher Priority = Preferred DR
βœ… Priority 0 = Never a DR/BDR


6. OSPF Administrative Distance (Rarely Used)

The default OSPF administrative distance is:

Though modifying the AD isn’t ideal for OSPF manipulation, it can be done:

πŸ”Ή Command to Change OSPF AD

Router(config-router)# distance <value> <source-ip> <wildcard-mask>

7. Floating Static Routes (Backup Path)

To create a backup route in case the OSPF path fails, use a floating static route with a higher AD:

Router(config)# ip route <destination> <mask> <next-hop> <higher AD>

8. Path Preference Example Scenario

Scenario

Objective: Prefer the backup link.

Solution

  1. Use ip ospf cost to assign a higher cost to the primary link.
R1(config-if)# interface gig0/1
R1(config-if)# ip ospf cost 50
  1. Alternatively, modify bandwidth:
R1(config-if)# interface gig0/1
R1(config-if)# bandwidth 10000

9. Best Practices for OSPF Path Manipulation

βœ… Prefer ip ospf cost for precise control.
βœ… Use bandwidth adjustments cautiously, as it may affect QoS and other protocols.
βœ… Summarize routes to reduce LSDB size in large networks.
βœ… Implement route filtering for fine-tuned path control.
βœ… Maintain Area 0 as the backbone to ensure stable OSPF behavior.

renjithbs Avatar

Posted by

Leave a comment