In this example we will use OSPF Costs to allow us to load balance between links.
We have 2 paths to router 2. The fist is directly connected the second is via R1.
Lets first trace to R2 and see what path we are using
R3#traceroute 2.2.2.2 Type escape sequence to abort. Tracing the route to 2.2.2.2 1 10.1.23.2 44 msec * 20 msec
We can see that we are using our direct link to R2 to get to the loop-back on R2.
R3#show ip route 2.2.2.2 Routing entry for 2.0.0.0/8 Known via "ospf 1", distance 110, metric 11, type intra area Redistributing via bgp 200 Advertised by bgp 200 Last update from 10.1.23.2 on FastEthernet1/0, 00:36:18 ago Routing Descriptor Blocks: * 10.1.23.2, from 2.2.2.2, 00:36:18 ago, via FastEthernet1/0 Route metric is 11, traffic share count is 1
Lets now have a look at the cost for this interface.
R3#show ip ospf interface fa1/0 FastEthernet1/0 is up, line protocol is up Internet Address 10.1.23.3/24, Area 0 Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 10 Topology-MTID Cost Disabled Shutdown Topology Name 0 10 no no Base Transmit Delay is 1 sec, State BDR, Priority 1 Designated Router (ID) 2.2.2.2, Interface address 10.1.23.2 Backup Designated router (ID) 3.3.3.3, Interface address 10.1.23.3 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Supports Link-local Signaling (LLS) Cisco NSF helper support enabled IETF NSF helper support enabled Hello due in 00:00:05 Index 2/2, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 4 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 2.2.2.2 (Designated Router) Suppress hello for 0 neighbor(s)
We can see this interface has a cost of 10. lets look at the cost of the interface that faces R1.
R3#show ip ospf interface gi0/0 GigabitEthernet0/0 is up, line protocol is up Internet Address 10.1.13.3/24, Area 0 Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 10 Topology-MTID Cost Disabled Shutdown Topology Name 0 10 no no Base Transmit Delay is 1 sec, State BDR, Priority 1 Designated Router (ID) 1.1.1.1, Interface address 10.1.13.1 Backup Designated router (ID) 3.3.3.3, Interface address 10.1.13.3 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Supports Link-local Signaling (LLS) Cisco NSF helper support enabled IETF NSF helper support enabled Hello due in 00:00:05 Index 1/1, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 4 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 1.1.1.1 (Designated Router) Suppress hello for 0 neighbor(s)
We can see this also has a cost of 10. We now need to look at the cost of the interface on R1 that faces R2.
R1#sh ip ospf interface gi1/0 GigabitEthernet1/0 is up, line protocol is up Internet Address 10.1.12.1/24, Area 0, Attached via Network Statement Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1 Topology-MTID Cost Disabled Shutdown Topology Name 0 1 no no Base Transmit Delay is 1 sec, State BDR, Priority 1 Designated Router (ID) 2.2.2.2, Interface address 10.1.12.2 Backup Designated router (ID) 1.1.1.1, Interface address 10.1.12.1 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:03 Supports Link-local Signaling (LLS) Cisco NSF helper support enabled IETF NSF helper support enabled Index 2/2, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 4 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 2.2.2.2 (Designated Router) Suppress hello for 0 neighbor(s)
We can see this interface has a cost of 1. Lets now look at the network digram with the cost on it.
We can see the cost to R2 via R1 is 11 and the cost to R2 directly is 10. We now need to change the cost on the interface facing R2 to make it 11.
R3(config)#int fa1/0 R3(config-if)#ip ospf cost 11 R3(config-if)#end
If we now look at the interface we will see the cost is 11.
R3#sh ip ospf int fa1/0 FastEthernet1/0 is up, line protocol is up Internet Address 10.1.23.3/24, Area 0 Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 11 Topology-MTID Cost Disabled Shutdown Topology Name 0 11 no no Base Transmit Delay is 1 sec, State BDR, Priority 1 Designated Router (ID) 2.2.2.2, Interface address 10.1.23.2 Backup Designated router (ID) 3.3.3.3, Interface address 10.1.23.3 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Supports Link-local Signaling (LLS) Cisco NSF helper support enabled IETF NSF helper support enabled Hello due in 00:00:09 Index 2/2, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 4 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 2.2.2.2 (Designated Router) Suppress hello for 0 neighbor(s)
Now if we do a traceroute we will see it will now load balance the traffic.
R3#traceroute 2.2.2.2 Type escape sequence to abort. Tracing the route to 2.2.2.2 1 10.1.13.1 48 msec 10.1.23.2 60 msec 10.1.13.1 60 msec
We have now used ospf interface cost to miniplate our traffic.