Traffic engineering in the OSPF networks is not that easy and sometimes can be a daunting or even impossible task, due to the fact that OSPF has many path selection rules. In this lab, I would like to discuss a scenario, where you can “hack” the regular OSPF rule, which states that inter-area routes are preferred over inter-area.

Diagram

Diagram

  • Every router has a Loopback0 configured with IP address X.X.X.X/32, i.e R2 (2.2.2.2/32)
  • All links have OSPF cost of 1, except links between R2-R3 and R5-R6 (cost 1000), which are really slow connections.

Requirements

  • Traffic from R3 (3.3.3.3) destined to R2 (2.2.2.2/32) should go the fastest possible route, which in this case R3 → R4 → XR1 → R2.
  • Traffic from R5 (5.5.5.5) destined to R6 (6.6.6.6/32) should also go the fastest possible route, which in this case is R5 → R4 → XR1 → R6.
  • Do not modify bandwidth or OSPF cost of the links.

Solution

The first requirement is successfully fulfilled without doing anything. R3 has 2 intra-area routes to get to R2:

  • R3 → R4 → XR1 → R2 (preferred route, lowest cost = 4)
  • R3 → R2 (slower, cost 1001)
R3#show ip route 2.2.2.2     
  Routing entry for 2.2.2.2/32
  Known via "ospf 1", distance 110, metric 4, type intra area
  Last update from 10.3.4.4 on FastEthernet1/0.34, 00:07:03 ago
  Routing Descriptor Blocks:
  * 10.3.4.4, from 2.2.2.2, 00:07:03 ago, via FastEthernet1/0.34
    Route metric is 4, traffic share count is 1
    
 R3#traceroute 2.2.2.2 source Loopback0   
 Type escape sequence to abort.
 Tracing the route to 2.2.2.2
 VRF info: (vrf in name/id, vrf out name/id)
   1 10.3.4.4 32 msec 52 msec 56 msec
   2 10.1.4.1 48 msec 60 msec 52 msec
   3 10.1.2.2 76 msec *  52 msec

There is a problem with the second requirement. Traffic from R5 prefers direct connection to R6.

Routing entry for 6.6.6.6/32
  Known via "ospf 1", distance 110, metric 1001, type intra area
  Last update from 10.5.6.6 on FastEthernet1/0.56, 00:16:49 ago
  Routing Descriptor Blocks:
  * 10.5.6.6, from 6.6.6.6, 00:16:49 ago, via FastEthernet1/0.56
    Route metric is 1001, traffic share count is 1
 
 R5#traceroute 6.6.6.6 source Loopback0
 Type escape sequence to abort.
 Tracing the route to 6.6.6.6
 VRF info: (vrf in name/id, vrf out name/id)
  1 10.5.6.6 60 msec *  48 msec

R5 has 2 routes to get to the R6.

  • R5 → R6 (Intra-area, slow, cost 1001)
  • R5 → R4 → XR1 → R6 (Inter-area, cost 4)

In this case cost is irrelevant. OSPF Router will always prefer INTRA-AREA route over INTER-AREA.

How to solve this problem? Well, we can put XR1 - R4 link in the area 1 instead of area 0. Now, R5 will prefer fastest route, but our first requirement is now broken. R3 will prefer a direct link to R2, which is really slow.

So in order to fulfill all requirements there are at least 2 possible solutions.

First, put the link between XR1 and R4 in area 1 (omitted in config snippet) and configure virtual link between them.

R4
router ospf 1
 area 1 virtual-link 1.1.1.1

XR1
router ospf 1 
  area 1 
    virtual-link 4.4.4.4

Let’s verify.

R3#show ip route 2.2.2.2
Routing entry for 2.2.2.2/32
  Known via "ospf 1", distance 110, metric 4, type intra area
  Last update from 10.3.4.4 on FastEthernet1/0.34, 00:02:30 ago
  Routing Descriptor Blocks:
  * 10.3.4.4, from 2.2.2.2, 00:02:30 ago, via FastEthernet1/0.34
    Route metric is 4, traffic share count is 1

R3#traceroute 2.2.2.2 source Loopback0
Type escape sequence to abort.
Tracing the route to 2.2.2.2
VRF info: (vrf in name/id, vrf out name/id)
  1 10.3.4.4 64 msec 52 msec 56 msec
  2 10.1.4.1 56 msec 52 msec 52 msec
  3 10.1.2.2 52 msec *  32 msec
R5#show ip route 6.6.6.6
Routing entry for 6.6.6.6/32
  Known via "ospf 1", distance 110, metric 4, type intra area
  Last update from 10.4.5.4 on FastEthernet1/0.45, 00:03:23 ago
  Routing Descriptor Blocks:
  * 10.4.5.4, from 6.6.6.6, 00:03:23 ago, via FastEthernet1/0.45
    Route metric is 4, traffic share count is 1

R5#traceroute 6.6.6.6 source Loopback0
Type escape sequence to abort.
Tracing the route to 6.6.6.6
VRF info: (vrf in name/id, vrf out name/id)
  1 10.4.5.4 56 msec 32 msec 56 msec
  2 10.1.4.1 28 msec 56 msec 52 msec
  3 10.1.6.6 52 msec *  52 msec 

In both cases, our traffic takes desired paths. Moving physical link (XR1 - R4) to another area (in our example from area 0 to area 1 may not be possible in some specific cases. Luckily there is another solution for this problem known as multi-area adjacency (RFC 5185), which basically allows link to be a member of multiple areas at the same time. There is an important caveat with this: interfaces on this link MUST be configured as point-to-point OSPF network.

R4
interface G1.14
  ip ospf network point-to-point 
  ip ospf multi-area 1

XR1 
router ospf 1 
 area 0 
   interface g0/0/0/0.14
    network point-to-point 
 area 1 
   multi-area-interface g0/0/0/0.14 

Let’s verify.

R4#show ip ospf int brief
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Lo0          1     0               4.4.4.4/32         1     LOOP  0/0
Gi1.14       1     0               10.1.4.4/24        1     P2P   1/1
Gi1.34       1     0               10.3.4.4/24        1     BDR   1/1
MA0          1     1               Unnumbered Gi1.14  1     P2P   1/1
Gi1.45       1     1               10.4.5.4/24        1     BDR   1/1

RP/0/0/CPU0:XR1#show ospf int brief
Wed Sep 16 18:37:52.723 UTC

* Indicates MADJ interface, (P) Indicates fast detect hold down state%%

Interfaces for OSPF 1

Interface          PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Lo0                1     0               1.1.1.1/32         1     LOOP  0/0
Gi0/0/0/0.12       1     0               10.1.2.1/24        1     BDR   1/1
Gi0/0/0/0.14       1     0               10.1.4.1/24        1     P2P   1/1
Gi0/0/0/0.14*      1     1               10.1.4.1/24        1     P2P   1/1
Gi0/0/0/0.16       1     1               10.1.6.1/24        1     BDR   1/1

Link between XR1 - R4 is at the same time in area 0 and 1.There is also another OSPF adjacency formed across this link.

Final verification

R5#traceroute 6.6.6.6 source Loopback0
Type escape sequence to abort.
Tracing the route to 6.6.6.6
VRF info: (vrf in name/id, vrf out name/id)
  1 10.4.5.4 56 msec 52 msec 28 msec
  2 10.1.4.1 52 msec 52 msec 52 msec
  3 10.1.6.6 56 msec *  36 msec

R3#traceroute 2.2.2.2 source Loopback0
Type escape sequence to abort.
Tracing the route to 2.2.2.2
VRF info: (vrf in name/id, vrf out name/id)
  1 10.3.4.4 28 msec 52 msec 56 msec
  2 10.1.4.1 56 msec 56 msec 44 msec
  3 10.1.2.2 52 msec *  48 msec