MPLS on 2600XM Series Routers

I had difficulty finding an IOS version that would run MPLS on my 2611XM routers with 96MB RAM and 32MB flash, so thought I’d post the version that I’ve had success with.

The image that worked successfully was c2600-jk9o3s-mz.123-24.bin.

The routers are connected together on Fa0/1 on each router. Fa0/0 goes up to an ESXI box running two IOS XRv PE routers. It’s interesting to watch modern MPLS applications run over these old routers.

Due to the age of the IOS image, the default is Cisco’s TDP as opposed to LDP. Here’s the basic config I used to test MPLS:

R1

mpls label protocol ldp

interface Loopback0
  ip address 172.16.0.3 255.255.255.255

interface FastEthernet0/0
  ip address 10.0.0.9 255.255.255.252
  tag-switching ip

interface FastEthernet0/1
  ip address 10.0.0.6 255.255.255.252
  tag-switching ip

router ospf 1
  network 0.0.0.0 255.255.255.255 area 0

R2

mpls label protocol ldp

interface Loopback0
  ip address 172.16.0.2 255.255.255.255

interface FastEthernet0/0
  ip address 10.0.0.1 255.255.255.252
  tag-switching ip

interface FastEthernet0/1
  ip address 10.0.0.5 255.255.255.252
  tag-switching ip

router ospf 1
  network 0.0.0.0 255.255.255.255 area 0

BSR Hash Calculation

I couldn’t find much information on how the Bootstrap Router hash function is calculated. Most sources teach that the mask dictates how much of the group IP address is used in the hash calculation and that the RP IP address that returns the highest value from the BSR hash algorithm becomes the chosen RP for that group, but don’t give detail on how the BSR hash is calculated.

I found the following algorithm in RFC 4601:

Value(G,M,C(i))=(1103515245 * ((1103515245 * (G&M)+12345) XOR C(i)) + 12345) mod 2^31

Mushing together various python examples from the Internet gave me the following script:

mask=int('11111111111111111111111111111110', 2)
group='239.1.1.1'
rpip='150.1.8.8'

groupbin=''.join(format(int(x), '08b') for x in group.split('.'))
groupdec=int(groupbin, 2)

rpipbin=''.join(format(int(x), '08b') for x in rpip.split('.'))
rpipdec=int(rpipbin, 2)

bsrhash=(1103515245*((1103515245*(groupdec & mask)+12345)^rpipdec)+12345)%(2**31)

print bsrhash

The output generated by the script when amending the ‘mask’, ‘group’ and ‘rpip’ variables matches the hash generated by the ‘show ip pim rp-hash‘ command on IOS.