Routing
Highlighted
Routing

Local-preference on route-targets in VRF

‎09-23-2020 05:43 PM

Hi

 

We have two ISP's who sends us default route on BGP. I want to get both default routes to our PE routers in a VRF and I want to be able to set the local preference in each PE to decide which ISP link that should be used. Local preference on the BGP sessions towards the ISP's themselves should be the same though.

 

I have tried to set local preference in a vrf-import policy on the PE but it seems it doesn't affect which route the PE selects. I have local-preference 140 on the vrf-import policy at the PE for the "Edge 1" RT and local-preference 120 on the PE for the "Edge 2" RT. Please see topology in the picture attached.

 

It does change the local preference in the PE accordingly but it still randomly picks one of the two default routes. Sometimes it uses the default route with local preference 120 instead of the one with 140. How can I configure this in a proper way to be able to decide which default route the PE should prefer? I suspect it uses the local-preference that is coming from the bgp.l3vpn.0 table and not what is in the table for the actual VRF. In the bgp.l3vpn.0 table the local-preference is obviously the same for both default routes since the local preference on the ISP links are the same.

 

 

Configuration:

********** PE **********
routing-instances {
INTERNET {
instance-type vrf;
interface ge-1/1/0.0;
route-distinguisher 65520:100111111;
vrf-import imp_edge_pri;
vrf-export exp_PE;
vrf-table-label;
}
}

 

policy-statement exp_PE {
term 1 {
from protocol [ bgp direct ];
then {
community add PE_community;
accept;
}
}
term last {
then reject;
}
}
policy-statement imp_edge_pri {
term 1 {
from {
protocol bgp;
community edge1_community;
}
then {
local-preference 140;
accept;
}
}
term 2 {
from {
protocol bgp;
community edge2_community;
}
then {
local-preference 120;
accept;
}
}
term last {
then reject;
}
}
community edge1_community members target:65520:5000;
community edge2_community; members target:65520:6000;
community PE_community members target:65520:500;

 

 

 

 

************* Edge 1 ************* 

routing-instances {
INTERNET {
instance-type vrf;
interface lo0.1000;
interface ge-2/0/0.0;
route-distinguisher 65520:100111111;
vrf-import imp_PE_target;
vrf-export exp_edge1_target;
vrf-table-label;
protocols {
bgp {
group ISP_1 {
remove-private;
peer-as 123456;
neighbor 2.3.4.5 {
local-address 2.3.4.6;
}


policy-statement imp_PE_target {
term 1 {
from {
protocol bgp;
community PE_community;
}
then accept;
}
term last {
then reject;
}
}
policy-statement exp_edge1_target {
term 1 {
from protocol bgp;
then {
community add exp_edge1_community;
accept;
}
}
term last {
then reject;
}
}
community exp_edge1_community members target:65520:5000;
community PE_community members target:65520:500;




************* Edge 2 ************* 
routing-instances {
INTERNET {
instance-type vrf;
interface lo0.1000;
interface ge-2/0/0.0;
route-distinguisher 65520:100111111;
vrf-import imp_PE_target;
vrf-export exp_edge1_target;
vrf-table-label;
protocols {
bgp {
group ISP_2 {
remove-private;
peer-as 234567;
neighbor 4.5.6.7 {
local-address 4.5.6.8;
}


policy-statement imp_PE_target {
term 1 {
from {
protocol bgp;
community PE_community;
}
then accept;
}
term last {
then reject;
}
}
policy-statement exp_edge2_target {
term 1 {
from protocol bgp;
then {
community add exp_edge2_community;
accept;
}
}
term last {
then reject;
}
}
community exp_edge2_community members target:65520:6000;
community PE_community members target:65520:500;

 

 

 

 

default_route_VRF_local_preference.jpg

 

Feedback