Routing
Highlighted
Routing

How to apply local-preference to all routes without a hard reset of EBGP?

‎01-03-2017 05:26 AM

Hello,

 

I'm trying to redirect outgoing traffic to my neighboring AS to an IBGP router via local-preference.

For this reason I'v created a very simple policy and applied it as an export policy:

 

 

# show policy-options policy-statement local-pref-110
term 1 {
    then {
        local-preference 110;
    }
}

 

It works, but apparently only for new announcements, the old ones just stay there and still go through the old router.

5.5.5.5 is the EBGP peer of the old router.

6.6.6.6 ist the IBGP peer where the traffic is supposed to go to.

 

 

 

1.186.121.0/24 *[BGP/170] 21:19:38, MED 0, localpref 100
AS path: 15412 55644 45769 I, validation-state: unverified
> to 5.5.5.5 via ae0.0

1.186.122.0/24 *[BGP/170] 01:17:04, MED 5, localpref 110
AS path: 9498 45769 I, validation-state: unverified
> to 6.6.6.6 via ae1.0
[BGP/170] 01:17:23, MED 0, localpref 100
AS path: 9498 45769 I, validation-state: unverified
> to 5.5.5.5 via ae0.0

 

This is not very useful.

 

I'v tried "clear bgp neighbor xxxxx soft/soft-inbound/soft-minimum-igp" on both routers but to no avail. What can I do to force traffic for all routes through the new router apart from doing a hard reset of the EBGP session on the old router? There has got to be a more elegant way...

5 REPLIES 5
Highlighted
Routing

Re: How to apply local-preference to all routes without a hard reset of EBGP?

‎01-03-2017 08:38 AM

Please confirm that the "new" egress router is advertising the route with the correct next-hop and correct attributes.

show route advertising-protocol bgp X

 

Confirm that the local router effectively receives the route.

show route receive-protocol bgp X
Highlighted
Routing

Re: How to apply local-preference to all routes without a hard reset of EBGP?

‎01-04-2017 01:55 AM

Routing polices do not affect routes that are already in the routing table. hey affect routes as the are leaving of entering the routing table. I don't have the time to set up a test now but you could try this

set protocols bgp group <internal> local-preference 80
set protocols bgp group <exterrnal> local-preference 110

[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: How to apply local-preference to all routes without a hard reset of EBGP?

‎01-04-2017 02:58 AM

Please let me know where are you trying to manipulate the local preference attribute? Is it with the IBGP or the EBGP session?

 

Since, only IBGP peers exchange the values of the local-preference BGP attribute. EBGP peers never see a local preference set on route information sent between AS networks.

 

I could find the local-preference changes immediately in the bgp.l3vpn.0 table with manipulation of  local-preference with an import policy as below. Check the timestamp for reference.

 

lab> show bgp summary

Groups: 3 Peers: 3 Down peers: 1

Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending

Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...

192.168.1.104           100         42         39       0       2       16:31 Establ

  bgp.l3vpn.0: 6/6/6/0

  bgp.l2vpn.0: 0/0/0/0

  bgp.mvpn.0: 0/0/0/0

  vpna.inet.0: 6/6/6/0

 

lab> show configuration policy-options  

policy-statement local-pref-110 {

    term 1 {

        then {

            local-preference 110;

        }

    }

}

policy-statement local-pref-200 {

    term 1 {

        then {

            local-preference 200;

        }

    }

}

 

lab> show route table bgp.l3vpn.0   <<< local-pref-110 is already applied at this point

Jan 04 10:47:17

 

bgp.l3vpn.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)

+ = Active Route, - = Last Active, * = Both

 

100:11111:1.1.56.0/30               

                   *[BGP/170] 00:02:51, localpref 110, from 192.168.1.104

                      AS path: I, validation-state: unverified

                    > to 1.1.12.2 via ge-0/0/2.12, label-switched-path r1-to-r5

100:11111:172.27.0.0/16               

                   *[BGP/170] 00:02:51, localpref 110, from 192.168.1.104

                      AS path: 64512 I, validation-state: unverified

                    > to 1.1.12.2 via ge-0/0/2.12, label-switched-path r1-to-r5

100:11111:172.27.0.0/24               

                   *[BGP/170] 00:02:51, localpref 110, from 192.168.1.104

                      AS path: 64512 I, validation-state: unverified

                    > to 1.1.12.2 via ge-0/0/2.12, label-switched-path r1-to-r5

100:11111:172.27.0.8/30                

                   *[BGP/170] 00:02:51, localpref 110, from 192.168.1.104

                      AS path: 64512 I, validation-state: unverified

                    > to 1.1.12.2 via ge-0/0/2.12, label-switched-path r1-to-r5

100:11111:172.27.0.104/30                

                   *[BGP/170] 00:02:51, localpref 110, from 192.168.1.104

                      AS path: 64512 I, validation-state: unverified

                    > to 1.1.12.2 via ge-0/0/2.12, label-switched-path r1-to-r5

100:11111:192.168.1.106/32               

                   *[BGP/170] 00:02:51, localpref 110, from 192.168.1.104

                      AS path: 64512 I, validation-state: unverified

                    > to 1.1.12.2 via ge-0/0/2.12, label-switched-path r1-to-r5

 

lab> edit

Jan 04 10:47:24

Entering configuration mode

 

[edit]

lab# edit protocols bgp group ibgp-to-rr                                                    

Jan 04 10:47:30

 

[edit protocols bgp group ibgp-to-rr]

lab# show

Jan 04 10:47:31

type internal;

local-address 192.168.1.101;

import local-pref-110;

family inet-vpn {

    unicast;

}

family l2vpn {

    signaling;

}

family inet-mvpn {

    signaling;

}

neighbor 192.168.1.104;

 

[edit protocols bgp group ibgp-to-rr]

lab# set import local-pref-200                                                               

Jan 04 10:48:06

 

[edit protocols bgp group ibgp-to-rr]

lab# commit and-quit

Jan 04 10:48:11

commit complete

Exiting configuration mode

 

lab> show route table bgp.l3vpn.0        

Jan 04 10:48:34

 

bgp.l3vpn.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)

+ = Active Route, - = Last Active, * = Both

 

100:11111:1.1.56.0/30               

                   *[BGP/170] 00:00:06, localpref 200, from 192.168.1.104

                      AS path: I, validation-state: unverified

                    > to 1.1.12.2 via ge-0/0/2.12, label-switched-path r1-to-r5

100:11111:172.27.0.0/16               

                   *[BGP/170] 00:00:06, localpref 200, from 192.168.1.104

                      AS path: 64512 I, validation-state: unverified

                    > to 1.1.12.2 via ge-0/0/2.12, label-switched-path r1-to-r5

100:11111:172.27.0.0/24               

                   *[BGP/170] 00:00:06, localpref 200, from 192.168.1.104

                      AS path: 64512 I, validation-state: unverified

                    > to 1.1.12.2 via ge-0/0/2.12, label-switched-path r1-to-r5

100:11111:172.27.0.8/30               

                   *[BGP/170] 00:00:06, localpref 200, from 192.168.1.104

                      AS path: 64512 I, validation-state: unverified

                    > to 1.1.12.2 via ge-0/0/2.12, label-switched-path r1-to-r5

100:11111:172.27.0.104/30               

                   *[BGP/170] 00:00:06, localpref 200, from 192.168.1.104

                      AS path: 64512 I, validation-state: unverified

                    > to 1.1.12.2 via ge-0/0/2.12, label-switched-path r1-to-r5

100:11111:192.168.1.106/32               

                   *[BGP/170] 00:00:06, localpref 200, from 192.168.1.104

                      AS path: 64512 I, validation-state: unverified

                    > to 1.1.12.2 via ge-0/0/2.12, label-switched-path r1-to-r5

 

lab>

 

http://www.juniper.net/techpubs/en_US/junos14.1/topics/topic-map/bgp-local-preference.html

 

-Python

#Please mark my solution as accepted if it helped, Kudos are always appreciated as well.

 

 

 

-Python JNCIE 3X [SP|DC|ENT] JNCIP-SEC JNCDS 3X [ WAN | DC|SEC] JNCIS-Cloud JNCIS-DevOps CCIP ITIL
#Please mark my solution as accepted if it helped, Kudos are appreciated as well.
Highlighted
Routing
Solution
Accepted by topic author ka_ge
‎01-05-2017 01:57 PM

Re: How to apply local-preference to all routes without a hard reset of EBGP?

[ Edited ]
‎01-05-2017 01:57 PM

Solved it. This was my mistake:

For this reason I'v created a very simple policy and applied it as an export policy:

I had applied the policy to IBGP as an export policy and this was wrong in my case.

 

In inet.0 of the new router the local-preference value of the new routes was still 100 and the old router's routes were preferred due to a MED of 0 on the old routes and a MED of 5 on the new routes.

If you apply the policy on the new router to the EBGP session as an import policy then in inet.0 the new routes will have a local-preference of 110 and they will automatically go through IBGP to your IBGP peer and attract his traffic.

 

###############################################

 

 

Since, only IBGP peers exchange the values of the local-preference BGP attribute. 
EBGP peers never see a local preference set on route information sent between AS networks.

I think that you are wrong. Check out the posts from acecanal in this thread:

 

https://forums.juniper.net/t5/Routing/BGP-local-preference-doesn-t-work/td-p/141407

Highlighted
Routing

Re: How to apply local-preference to all routes without a hard reset of EBGP?

‎01-05-2017 08:52 PM

Hi,
Earlier, I have posted the an example with import-policy in this thread.

<snipped>

[edit protocols bgp group ibgp-to-rr]
lab# set import local-pref-200

<snipped>

 

Moreover, the below statement still holds good. The local preference value is communicated over iBGP peers and not to eBGP peers.
-------------------------------------------------------------------------------------------
Only IBGP peers exchange the values of the local-preference BGP attribute.
EBGP peers never see a local preference set on route information sent between AS networks.
-------------------------------------------------------------------------------------------

-Python

-Python JNCIE 3X [SP|DC|ENT] JNCIP-SEC JNCDS 3X [ WAN | DC|SEC] JNCIS-Cloud JNCIS-DevOps CCIP ITIL
#Please mark my solution as accepted if it helped, Kudos are appreciated as well.