Metric (EIGRP) = Cost (OSPF) = MED Attribute (BGP)

Change metric of an EIGRP route Link to heading

eigrp-formula

  1. Change the bandwidth of the interface (not recommended).
# Change the bandwidth to 1000 Kbits
R1(config-if)# bandwidth 1000
  1. Change the delay of the interface.
# Change the delay to 1000 usec
R1(config-if)# delay 1000
  1. Change the default value of metric weights (K-values) (not recommended).
R1(config-router)# metric weights 0 1 2 3 4 5
  1. Use offset-list to add value to the metric of either inbound or outbound interface.
R1(config)# access-list 1 permit 192.168.1.0 0.0.0.255

# Add 5 to the metric of route matching access-list and going in f0/0
R1(config-router)# offset-list 1 in 5 f0/0

# Add 10 to the mectric of route matching access-list and going out s1/1
R1(config-router)# offset-list 1 out 10 s1/1

Change cost of an OSPF route Link to heading

ospf-formula

  1. Change the bandwidth of the interface.
# Change the bandwidth to 1000 Mbits
R1(config-if)# bandwidth 1000
  1. Set the OSPF cost of the interface to override the calculated cost.
R1(config-if)# ip ospf cost 1234
  1. Set the cost per neighbor (valid only in point-to-multipoint non-broadcast or NBMA network because of static configured neighbor).
R1(config-router)# neighbor 2.2.2.2 cost 1234