BGP Communities

SeefateSeefate Member Posts: 9 ■□□□□□□□□□
Hello,

I was wondering if someone could explain this to me since Google seems to have let me down. For BGP communities you can set a 32 bit value for the community value. However the "ip bgp-community new-format" command was introduced that essentially just broke the values down into two 16 bit halves. My problem is I don't understand how to convert from one to the other. It seems simple enough but for some reason I can't wrap my mind around it.

For example according to my Boson test the Hex community value 640100 turns into 64 and 100 which then turns into 100:256.

I am at a total loss here, can someone please shed some light here?

Thanks,
-C

Comments

  • mkomonmkomon Member Posts: 37 ■■□□□□□□□□
    Hi,

    the original way Cisco displayed BGP community in IOS was in nn:AA form. The "ip bgp-community new-format" command changes the display format of to AA:nn, to comply with RFC 1997.

    As for your example, 640100 broken into halves is 64 and 100 (both hex), in decimal that is 100 and 256. According to the RFC mentioned above, that would be recognized as 100:256 in AA:nn format.
  • SeefateSeefate Member Posts: 9 ■□□□□□□□□□
    I think where I am getting caught up at is where to do the split. My first impression would be to split it 640 | 100 but that doesn't allow 16 bits on each side. So from what I can tell is there are 2 zeros next to the 64 that I need to account for (00640100). Then I can do the split 0064 | 0100. From there you get 0000 0000 0110 0100 | 0000 0001 0000 0000. When converted back into decimal you get 100:256.

    So would I be correct if I had community 50 to add the zeros (00000050), split it 0000 | 0050, and come up with 0:80?
  • mkomonmkomon Member Posts: 37 ■■□□□□□□□□
    A hex digit represents four bits. To split a 32-bit number in halves, count rightmost four hex digits and split there. 640100 -> 64|0100.

    Exactly, comm. val. of 50 is actually 0:50 (talking hex), converted to decimal 0:80. BTW something makes me think that this community would not be valid as it falls into a reserved range. You may want to check it out. Just a side note.
Sign In or Register to comment.