Wednesday, February 2, 2011

OSPF Going Clockwise

OSPF path selection is depends on a router finding the lowest cost path between itself and the destination network.  Path cost is the cumulative cost of interfaces in the path.  Interface cost is generally derived from interface bandwidth.

Okay, nothing new here.  But I skipped a critical detail:  Which interfaces are we talking about exactly?

What happens when neighboring routers disagree about the cost of a transit network?


The different interface types (100Mb/s and 10Mb/s) in this topology are going to cause these routers to disagree about the cost of moving a packet across the 10.0.1.0/31 network.  R1's Fast Ethernet interface cost is 1, while R2's Ethernet interface cost is 10.

In OSPF, all routers have a complete picture of the network topology, so both routers know the other router's idea of the cost:


R1#show ip ospf database router 10.0.0.2

OSPF Router with ID (10.0.0.1) (Process ID 1)

Router Link States (Area 0)

LS age: 1233
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 10.0.0.2
Advertising Router: 10.0.0.2
LS Seq Number: 80000005
Checksum: 0x11A5
Length: 60
Number of Links: 3

Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.0.0.2
(Link Data) Network Mask: 255.255.255.255
Number of TOS metrics: 0
TOS 0 Metrics: 1

Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 10.0.0.1
(Link Data) Router Interface address: 10.0.1.1
Number of TOS metrics: 0
TOS 0 Metrics: 10

Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.0.1.0
(Link Data) Network Mask: 255.255.255.254
Number of TOS metrics: 0
TOS 0 Metrics: 10
R2#show ip ospf database router 10.0.0.1

OSPF Router with ID (10.0.0.2) (Process ID 1)

Router Link States (Area 0)

LS age: 1269
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 10.0.0.1
Advertising Router: 10.0.0.1
LS Seq Number: 80000005
Checksum: 0x8843
Length: 60
Number of Links: 3

Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.0.0.1
(Link Data) Network Mask: 255.255.255.255
Number of TOS metrics: 0
TOS 0 Metrics: 1

Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 10.0.0.2
(Link Data) Router Interface address: 10.0.1.0
Number of TOS metrics: 0
TOS 0 Metrics: 1

Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.0.1.0
(Link Data) Network Mask: 255.255.255.254
Number of TOS metrics: 0
TOS 0 Metrics: 1


So what's the cost of this link?  As it turns out, that's asking the wrong question.  Links don't have costs in OSPF.  OSPF deals in terms of interface transmit cost only, and gives no consideration to the cost associated with receiving a packet on an interface.

Both routers in the topology will agree that an Eastbound packet on this link accrues a cost of 1, while a Westbound packet accrues a cost of 10.



This can lead to some seriously bad decision making on OSPF's part.  Assume that OSPF's auto cost reference bandwidth has been set 1Gb/s here:


R1 will evenly balance northbound traffic across R2 and R3 here, in spite of R3's reduced capacity, because R1's cost to transmit onto this multiaccess network is the same regardless of the next hop router's interface bandwidth.

Now, I'm a staunch supporter of Ethernet autonegotiation (It works!  Use it!  Don't force things!), except in cases where reducing the link speed to 100Mb/s will hurt.  This is one of them.  Issuing 'speed 1000' on either end of this link is enough to cause the R3 link to fail rather than downspeed to 100Mb/s when it has a problem on pin 4, 5, 7 or 8.



Here's another fun example.

Every OSPF route in this network goes clockwise.  The path from R1 to R4's loopback includes 3 hops through 10Mb/s interfaces.  It's clearly preferable for R1 to use 192.168.41.4 as the next hop for R4's loopback, but OSPF doesn't consider it.

R1#show ip route ospf
O 192.168.23.0/24 [110/2] via 192.168.12.2, 00:14:19, FastEthernet0/0
O 192.168.34.0/24 [110/3] via 192.168.12.2, 00:14:19, FastEthernet0/0
192.168.0.0/32 is subnetted, 4 subnets
O 192.168.0.2 [110/2] via 192.168.12.2, 00:14:19, FastEthernet0/0
O 192.168.0.3 [110/3] via 192.168.12.2, 00:14:19, FastEthernet0/0
O 192.168.0.4 [110/4] via 192.168.12.2, 00:14:19, FastEthernet0/0


OSPF considers transmit cost only. 

No comments:

Post a Comment