کد:
http://blog.ioshints.info/2006/10/cef-load-sharing-details.html
I had to investigate the details of CEF load sharing for one of my upcoming article and found (yet again) that the details are rather undocumented in official documentation. So, this is how it works (in case you ever need to know):


  • For every CEF entry (IP route) where there are multiple paths to the destination, the router creates a 16-row hash table, populating the entries with pointers to individual paths. The hash table can be inspected with the show ip cef prefix internal command.
  • The load balancing ratio is approxiated by number of entries in the hash table belonging to each path. If you have unequal-cost load balancing (EIGRP based on composite metrics and MPLS TE tunnels based on requested bandwidth), individual paths will be associated with different number of rows.
  • If you configure per-destination load balancing, the source and destination IP address in the incoming IP packet are hashed into a 4-bit value that selects the outgoing path in the CEF has table.

If this sounds confusing, here are two examples to make it easier: if you have two equal-cost paths to the same destination, each path will have eight entries in the hash table.
کد:
a1#show ip route 192.168.0.0
Routing entry for 192.168.0.0 255.255.255.0
  Known via "ospf 1", distance 110, metric 51, type intra area
  Last update from 172.16.0.21 on Serial0/0/0.100, 00:00:05 ago
  Routing Descriptor Blocks:
  * 172.16.0.21, from 172.16.0.22, 00:00:05 ago, via Serial0/0/0.100
      Route metric is 51, traffic share count is 1
    172.16.0.21, from 172.16.0.22, 00:00:05 ago, via Serial0/0/0.200
      Route metric is 51, traffic share count is 1
کد:
a1#show ip cef 192.168.0.0 internal
192.168.0.0/24, version 33, epoch 0, per-destination sharing
0 packets, 0 bytes
  via 172.16.0.21, Serial0/0/0.100, 0 dependencies
    traffic share 1
    next hop 172.16.0.21, Serial0/0/0.100
    valid adjacency
  via 172.16.0.21, Serial0/0/0.200, 0 dependencies
    traffic share 1
    next hop 172.16.0.21, Serial0/0/0.200
    valid adjacency

  0 packets, 0 bytes switched through the prefix
  tmstats: external 0 packets, 0 bytes
           internal 0 packets, 0 bytes
  Load distribution: 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 (refcount 1)

  Hash  OK  Interface                 Address         Packets
  1     Y   Serial0/0/0.100           point2point           0
  2     Y   Serial0/0/0.200           point2point           0
  3     Y   Serial0/0/0.100           point2point           0
  4     Y   Serial0/0/0.200           point2point           0
  5     Y   Serial0/0/0.100           point2point           0
  6     Y   Serial0/0/0.200           point2point           0
  7     Y   Serial0/0/0.100           point2point           0
  8     Y   Serial0/0/0.200           point2point           0
  9     Y   Serial0/0/0.100           point2point           0
  10    Y   Serial0/0/0.200           point2point           0
  11    Y   Serial0/0/0.100           point2point           0
  12    Y   Serial0/0/0.200           point2point           0
  13    Y   Serial0/0/0.100           point2point           0
  14    Y   Serial0/0/0.200           point2point           0
  15    Y   Serial0/0/0.100           point2point           0
  16    Y   Serial0/0/0.200           point2point           0
However, if you have three equal-cost paths to the destination, each path will have only five entries and the hash table will have 15 rows instead of 16.
کد:
a1#show ip route 192.168.0.0
Routing entry for 192.168.0.0 255.255.255.0
  Known via "ospf 1", distance 110, metric 51, type intra area
  Last update from 10.0.0.6 on FastEthernet0/0, 00:00:02 ago
  Routing Descriptor Blocks:
  * 172.16.0.21, from 172.16.0.22, 00:00:02 ago, via Serial0/0/0.100
      Route metric is 51, traffic share count is 1
    172.16.0.21, from 172.16.0.22, 00:00:02 ago, via Serial0/0/0.200
      Route metric is 51, traffic share count is 1
    10.0.0.6, from 172.16.0.22, 00:00:02 ago, via FastEthernet0/0
      Route metric is 51, traffic share count is 1
کد:
a1#show ip cef 192.168.0.0 internal
192.168.0.0/24, version 44, epoch 0, per-destination sharing
0 packets, 0 bytes
  via 172.16.0.21, Serial0/0/0.100, 0 dependencies
    traffic share 1
    next hop 172.16.0.21, Serial0/0/0.100
    valid adjacency
  via 172.16.0.21, Serial0/0/0.200, 0 dependencies
    traffic share 1
    next hop 172.16.0.21, Serial0/0/0.200
    valid adjacency
  via 10.0.0.6, FastEthernet0/0, 0 dependencies
    traffic share 1
    next hop 10.0.0.6, FastEthernet0/0
    valid adjacency

  0 packets, 0 bytes switched through the prefix
  tmstats: external 0 packets, 0 bytes
           internal 0 packets, 0 bytes
  Load distribution: 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 (refcount 1)

  Hash  OK  Interface                 Address         Packets
  1     Y   Serial0/0/0.100           point2point           0
  2     Y   Serial0/0/0.200           point2point           0
  3     Y   FastEthernet0/0           10.0.0.6              0
  4     Y   Serial0/0/0.100           point2point           0
  5     Y   Serial0/0/0.200           point2point           0
  6     Y   FastEthernet0/0           10.0.0.6              0
  7     Y   Serial0/0/0.100           point2point           0
  8     Y   Serial0/0/0.200           point2point           0
  9     Y   FastEthernet0/0           10.0.0.6              0
  10    Y   Serial0/0/0.100           point2point           0
  11    Y   Serial0/0/0.200           point2point           0
  12    Y   FastEthernet0/0           10.0.0.6              0
  13    Y   Serial0/0/0.100           point2point           0
  14    Y   Serial0/0/0.200           point2point           0
  15    Y   FastEthernet0/0           10.0.0.6              0




موضوعات مشابه: