Routing
Highlighted
Routing

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

‎07-06-2017 05:38 PM

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"

3 REPLIES 3
Highlighted
Routing
Solution
Accepted by topic author shani
‎07-10-2017 01:41 PM

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

‎07-06-2017 09:07 PM

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!
--------------------------------------------------------------------------------------------------------

Highlighted
Routing

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

‎07-09-2017 04:53 AM

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-...

 

170 = Default BGP Protocol Preference

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

[KUDOS PLEASE! If you think I earned it!
If this solution worked for you please flag my post as an "Accepted Solution" so others can benefit..]
Highlighted
Routing

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

[ Edited ]
‎08-15-2017 03:33 PM

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 ?