Routing

Expand all | Collapse all

Need to understand bgp output " Preference: 170/-101"

Jump to Best Answer
  • 1.  Need to understand bgp output " Preference: 170/-101"

    Posted 07-06-2017 17:39

    Hello All,

    Request you to please help me understanding what's the meaning of 

     

    Preference: 170/-101 in the output of show route x.x.x.x/x extensive in BGP table

     

    for reference sample output

     

    root@XYZ> show route 10.245.X.X/24 extensive

    XYZ.inet.0: 128 destinations, 300 routes (128 active, 0 holddown, 0 hidden)
    10.245.X.X/24  (2 entries, 1 announced)
    TSI:
    KRT in-kernel 10.245.72.64/32 -> {composite(1447)}
    *BGP Preference: 170/-101>>>>>>>>>>>>>>>>>>>>>>>>>Need to understand the meaning of "170/-101"



  • 2.  RE: Need to understand bgp output " Preference: 170/-101"
    Best Answer

    Posted 07-06-2017 21:08

    It's the Preference2 value.
    JUNOS stores the 1's complement of the LocalPref value in the Preference2 field. For example, if the Local Preference value for Route 1 is 100, the Preference2 value is -101. If the LocalPref value for Route 2 is 155, the Preference value is -156. Route 2 is preferred because it has a higher LocalPref value and simultaneously a lower Preference2 value.

     

    Hope this helps
    --------------------------------------------------------------------------------------------------------
    If this post was helpful, please mark this post as an "Accepted Solution".
    Kudos are always appreciated!
    --------------------------------------------------------------------------------------------------------



  • 3.  RE: Need to understand bgp output " Preference: 170/-101"

    Posted 07-09-2017 04:54

    Just an addition to  , take a look at this article:

    https://www.juniper.net/documentation/en_US/junos/topics/task/verification/bgp-routes-and-selection-introduction.html

     

    170 = Default BGP Protocol Preference

    101 is the LocalPreference = higher is better. In this case the default localpref on 100 is in use



  • 4.  RE: Need to understand bgp output " Preference: 170/-101"

    Posted 08-15-2017 15:34

    Hi All,

     

    I have the same question. But how come decimal value 100  ( 0110 0100) one's complement becomes -101 ( 0110 0101 ==> implies 1001 1010) ?? 

     

    AFAIK one's compliment is inverting bits and this applicable usually negative numbers but not positive numbers. 

     

    Lets keep this fundamental aside for second and lets explore on this 

     

    100 (base10)  0110 0100 (base2) Ones compliment   ==> 1001 1011 

     

    -101 (base 10) 0110 0101 (base2) On'es compliment ==> 1001 1010 ==> Twos compliment by adding 1 ==> 1001 1011 

     

    So its  ones compliment of 100 matching to two's compliment of -101 .. 

     

     

    Correct me if this right assumption ?