Saturday 14 May 2016

OSPF Cost,Auto cost,Bandwidth.



Router1 on the left most side.

Router#show interface s2/0
Serial2/0 is up, line protocol is up (connected)
  Hardware is HD64570
  Internet address is 10.1.1.1/8
  MTU 1500 bytes, BW 128 Kbit, DLY 20000 usec,
     reliability 255/255, txload 1/255, rxload 1/255


Router#show interface g6/0
GigabitEthernet6/0 is up, line protocol is up (connected)
  Hardware is Lance, address is 00d0.ff22.719b (bia 00d0.ff22.719b)
  Internet address is 192.168.4.1/24
  MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec,
     reliability 255/255, txload 1/255, rxload 1/255


Router#show interface f0/0
FastEthernet0/0 is up, line protocol is up (connected)
  Hardware is Lance, address is 0002.168e.09db (bia 0002.168e.09db)
  Internet address is 192.168.1.1/24
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
     reliability 255/255, txload 1/255, rxload 1/255


Cost = 10^8/BW
10^8 = Reference BW can be changed.
BW = Band Width can be changed.

Serial Interface BW 128 Kbit
Gigabit Interface BW 1000000 Kbit
FastEthernet Interface BW 100000 Kbit

Serial Interface Cost = 10^8 / 128000 = 782
FastEthernet Interface Cost = 10^8 / 100000000 = 1
Giganit Interface Cost = 10^8 /1000000000 = .1            

Lowest Value is selected , and packets are sent out the interface
which has the Lowest cost value.

show ip route on Router 1 :

Router#sh ip route 
C    10.0.0.0/8 is directly connected, Serial2/0
O    11.0.0.0/8 [110/66] via 192.168.1.2, 00:33:35, FastEthernet0/0
                [110/66] via 192.168.4.2, 00:33:35, GigabitEthernet6/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
O    192.168.2.0/24 [110/2] via 192.168.1.2, 00:33:35, FastEthernet0/0
C    192.168.4.0/24 is directly connected, GigabitEthernet6/0
O    192.168.5.0/24 [110/2] via 192.168.4.2, 00:33:35, GigabitEthernet6/0
O    192.168.6.0/24 [110/3] via 192.168.1.2, 00:33:35, FastEthernet0/0
                    [110/3] via 192.168.4.2, 00:33:35, GigabitEthernet6/0
C    192.168.7.0/24 is directly connected, FastEthernet1/0

Changing interface Bandwidth of connected interfaces and 
directly connected Router interfaces.

First route to 192.168.6.0 is shown via 10.1.1.2
sh ip route
C    10.0.0.0/8 is directly connected, Serial2/0
O    11.0.0.0/8 [110/65] via 10.1.1.2, 00:00:32, Serial2/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
O    192.168.2.0/24 [110/66] via 10.1.1.2, 00:00:32, Serial2/0
C    192.168.4.0/24 is directly connected, GigabitEthernet6/0
O    192.168.5.0/24 [110/66] via 10.1.1.2, 00:00:32, Serial2/0
O    192.168.6.0/24 [110/66] via 10.1.1.2, 00:00:32, Serial2/0
C    192.168.7.0/24 is directly connected, FastEthernet1/0

Second route to 192.168.6.0 is shown via 192.168.1.2 and 
192.168.4.2 as both costs on the return path are lesser.

sh ip route
C    10.0.0.0/8 is directly connected, Serial2/0
O    11.0.0.0/8 [110/65] via 10.1.1.2, 00:00:39, Serial2/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
O    192.168.2.0/24 [110/2] via 192.168.1.2, 00:00:04, FastEthernet0/0
C    192.168.4.0/24 is directly connected, GigabitEthernet6/0
O    192.168.5.0/24 [110/2] via 192.168.4.2, 00:00:04, GigabitEthernet6/0
O    192.168.6.0/24 [110/3] via 192.168.1.2, 00:00:04, FastEthernet0/0
                    [110/3] via 192.168.4.2, 00:00:04, GigabitEthernet6/0
C    192.168.7.0/24 is directly connected, FastEthernet1/0


Finally changing bandwidth on All Router interfaces.
We get three routes to 192.168.6.0/24


C    10.0.0.0/8 is directly connected, Serial2/0
O    11.0.0.0/8 [110/2] via 10.1.1.2, 00:00:36, Serial2/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
O    192.168.2.0/24 [110/2] via 192.168.1.2, 00:01:02, FastEthernet0/0
C    192.168.4.0/24 is directly connected, GigabitEthernet6/0
O    192.168.5.0/24 [110/2] via 192.168.4.2, 00:01:02, GigabitEthernet6/0
O    192.168.6.0/24 [110/3] via 10.1.1.2, 00:00:36, Serial2/0
                    [110/3] via 192.168.1.2, 00:00:36, FastEthernet0/0
                    [110/3] via 192.168.4.2, 00:00:36, GigabitEthernet6/0

C    192.168.7.0/24 is directly connected, FastEthernet1/0

Since cost is the same we have three Routes.
 

Router5 on the right side.
 
O    10.0.0.0/8 [110/2] via 11.1.1.1, 00:03:36, Serial2/0
C    11.0.0.0/8 is directly connected, Serial2/0
O    192.168.1.0/24 [110/2] via 192.168.2.1, 00:04:26, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/0
O    192.168.4.0/24 [110/2] via 192.168.5.1, 00:04:26, GigabitEthernet6/0
C    192.168.5.0/24 is directly connected, GigabitEthernet6/0
C    192.168.6.0/24 is directly connected, FastEthernet1/0
O    192.168.7.0/24 [110/3] via 11.1.1.1, 00:03:36, Serial2/0
                    [110/3] via 192.168.2.1, 00:03:36, FastEthernet0/0
                    [110/3] via 192.168.5.1, 00:03:36, GigabitEthernet6/0


Auto-cost reference-bandwidth :

Cost = 10^8 / BW

10^8 or 100 Mbps is the Reference bandwidth.
To change the reference bandwidth:
R1(config)#router ospf 1
R1(config-router)#auto-cost reference-bandwidth 1000000

Unit is Mbps
1000000 Mbps is 1Tbps

Note : reference bandwidth must be same across all routers.

Why we change the reference bandwidth ?
The default auto cost reference bandwidth is 100 Mbps.
This is depicted in the formula Cost = 10^8 /BW
Here 10^8 or 100 Mbps is the reference BW.
Any link with a speed of 100 Mbps or greater,the cost 
will be the same , 1.For example a Gigabit ethernet link 
which is 10^9 , the cost will be .1, and FastEthernet
which has a BW of 100 Mbps Cost will be 1.This
will default to 1 for both, which is not a good idea
on Modern Networks, read below.

From freeccnaworkbook.com:
This can cause problems such as sub-optimal route selection and load 
balancing which could lead to out of order packets thus causing application 
problems on through out the network.

The default reference bandwidth used to calculate the OSPF metric can be changed 
to reflect today’s modern networks in which case a 100Gbps reference bandwidth 
is a good  estimate or perhaps you wish to future proof your network 
as many corporations do and  use a reference bandwidth of 1Tbps.


Finally ospf cost can be changed on the interface using :
Router(config-if)#ip  ospf cost ?
  <1-65535>  Cost
Router(config-if)#ip  ospf cost

must be done at both ends.And naturally packets/path will be along lowest cost links.
 

No comments:

Post a Comment