Social Icons

Friday, August 9, 2013

CCNP ROUTE: 12.OSPF Metric tuning

Engineers have a couple of commands available that allow them to tune the values of the OSPF interface cost, thereby influencing the choice of best OSPF route.

Adding a FastEthernet link (192.168.0.24/30) directly between R1 and R2 and including that link into OSPF will create a redundancy path:

Having equal cost paths (FastEthernet) to R2 and networks in area 1 and the default maximum path value of 4, R1 installs 2 routes in the routing table:
R1#show ip route
...
     192.168.168.0/30 is subnetted, 1 subnets
O IA    192.168.168.0 [110/20] via 192.168.0.26, 00:00:17, FastEthernet0/1
                      [110/20] via 192.168.0.2, 00:00:17, FastEthernet0/0
     192.168.169.0/32 is subnetted, 1 subnets
O IA    192.168.169.170 [110/21] via 192.168.0.26, 00:00:17, FastEthernet0/1
                        [110/21] via 192.168.0.2, 00:00:17, FastEthernet0/0

Metric tuning - method 1: Changing the Reference bandwidth (default = 100)

OSPF calculates the default OSPF cost for an interface based on the following formula: Reference-brandwidth[Mbps] / interface-bandwidth[Mbps]

Note: OSPF always rounds down when the calculation results in a fraction.
Note: With a default of 100 Mbps, the cost of FastEthernet interfaces calculates to cost 1.
 However, the minimum OSPF cost is 1, so Gigabit Ethernet and 10 Gigabit interfaces also then default to OSPF cost 1.
 By setting the OSPF reference bandwidth so that there is some difference in cost between the higher speed links, OSPF can then choose routes that use those higher speed interfaces.
Note: Although Cisco recommends that all routers use the same reference bandwidth, the setting is local to each router.

R1#show ip protocols 
Routing Protocol is "ospf 1"
 ...
 Reference bandwidth unit is 100 mbps

Having both FastEthernet0/0 and FastEthernet0/1 with a bandwitdh of 10 Mbps and the default reference bandwidth of 100, the cost is 10 on each:

R1#show ip ospf interface fastEthernet 0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 192.168.0.1/29, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10

R1#show ip ospf interface fastEthernet 0/1
FastEthernet0/1 is up, line protocol is up
  Internet Address 192.168.0.25/30, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10

After setting the reference bandwidth to 1000, both costs change to 100:

R1(config)#router ospf 1
R1(config-router)#auto-cost reference-bandwidth ?
  <1-4294967>  The reference bandwidth in terms of Mbits per second
R1(config-router)#auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
        Please ensure reference bandwidth is consistent across all routers.

R1#show ip ospf interface fastEthernet 0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 192.168.0.1/29, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 100

R1#show ip ospf interface fastEthernet 0/1
FastEthernet0/1 is up, line protocol is up
  Internet Address 192.168.0.25/30, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 100

After changing the reference bandwidth on both R1 and R2, the route metric changes accordingly:
R1#show ip route
...
     192.168.168.0/30 is subnetted, 1 subnets
O IA    192.168.168.0 [110/200] via 192.168.0.26, 00:04:57, FastEthernet0/1
                      [110/200] via 192.168.0.2, 00:04:57, FastEthernet0/0
     192.168.169.0/32 is subnetted, 1 subnets
O IA    192.168.169.170 [110/201] via 192.168.0.26, 00:04:57, FastEthernet0/1
                        [110/201] via 192.168.0.2, 00:04:57, FastEthernet0/0

Metric tuning - method 2: Setting bandwidth

On Ethernet interfaces,if not configured with the bandwidth command, the interface bandwidth matches the actual speed.
For example, on an interface that supports autonegotiation for 10/100, the bandwidth is either 100,000 (kbps, or 100 Mbps) or 10,000 (Kbps, or 10 Mbps) depending on whether the link currently runs at 100 or 10 Mbps.

On serial interfaces (or their subinterfaces) the bandwidth defaults to 1544 Kbps.

Consider that R1's FastEthernet0/1 should be preferred when routing traffic to area 1.
Having default bandwidths (10 Mbps) and reference bandwidths (100 Mbps) on both FastEthernet0/0 and FastEthernet0/1, R1 installs both routes in the routing table:

R1#show ip ospf interface fastEthernet 0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 192.168.0.1/29, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10

R1#show ip ospf interface fastEthernet 0/1
FastEthernet0/1 is up, line protocol is up
  Internet Address 192.168.0.25/30, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10

R1#show ip route
...
     192.168.168.0/30 is subnetted, 1 subnets
O IA    192.168.168.0 [110/20] via 192.168.0.26, 00:01:18, FastEthernet0/1
                      [110/20] via 192.168.0.2, 00:01:18, FastEthernet0/0
     192.168.169.0/32 is subnetted, 1 subnets
O IA    192.168.169.170 [110/21] via 192.168.0.26, 00:01:18, FastEthernet0/1
                        [110/21] via 192.168.0.2, 00:01:18, FastEthernet0/0

We have to influence the cost on FastEthernet0/1, so it will be chosen as outgoing interface for traffic destined for area 1, using the same cost formula:
Reference-brandwidth[Mbps] / interface-bandwidth[Mbps]

R1(config)#interface fastEthernet 0/1
R1(config-if)#bandwidth ?
  <1-10000000>  Bandwidth in kilobits
R1(config-if)#bandwidth 100000

So now, FastEthernet0/0 should remain at the cost of 10 and FastEthernet0/1 should change to a cost of 1:
R1#show ip ospf interface fastEthernet 0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 192.168.0.1/29, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10

R1#show ip ospf interface fastEthernet 0/1
FastEthernet0/1 is up, line protocol is up
  Internet Address 192.168.0.25/30, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1

R1#show ip route
...
     192.168.168.0/30 is subnetted, 1 subnets
O IA    192.168.168.0 [110/11] via 192.168.0.26, 00:11:22, FastEthernet0/1
     192.168.169.0/32 is subnetted, 1 subnets
O IA    192.168.169.170 [110/12] via 192.168.0.26, 00:11:22, FastEthernet0/1

Metric tuning - method 3: Setting cost

We have to influence the cost on FastEthernet0/1, so it will be chosen as outgoing interface for traffic destined for area 1.

R1#show ip ospf interface fastEthernet 0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 192.168.0.1/29, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10

R1#show ip ospf interface fastEthernet 0/1
FastEthernet0/1 is up, line protocol is up
  Internet Address 192.168.0.25/30, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10

R1#show ip route
...
     192.168.168.0/30 is subnetted, 1 subnets
O IA    192.168.168.0 [110/20] via 192.168.0.26, 00:01:18, FastEthernet0/1
                      [110/20] via 192.168.0.2, 00:01:18, FastEthernet0/0
     192.168.169.0/32 is subnetted, 1 subnets
O IA    192.168.169.170 [110/21] via 192.168.0.26, 00:01:18, FastEthernet0/1
                        [110/21] via 192.168.0.2, 00:01:18, FastEthernet0/0

R1(config)#interface fastEthernet 0/1
R1(config-if)#ip ospf cost 2
R1#show ip ospf interface fastEthernet 0/1
FastEthernet0/1 is up, line protocol is up
  Internet Address 192.168.0.25/30, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 2

R1#show ip route 
...
     192.168.168.0/30 is subnetted, 1 subnets
O IA    192.168.168.0 [110/12] via 192.168.0.26, 00:00:44, FastEthernet0/1
     192.168.169.0/32 is subnetted, 1 subnets
O IA    192.168.169.170 [110/13] via 192.168.0.26, 00:00:44, FastEthernet0/1

No comments:

Post a Comment