How to configure route policy to redistribute connected route to bgp?

  • 0
  • 2
  • Question
  • Updated 4 months ago
  • Answered
Hi guys,

I want to redistribute direct (connected) routes to bgp basically.
But I also want to specify community for particular prefixes as well.

For example, a Router-A has vlan A (10.1.1.0/24) and vlan B (10.2.2.0/24), vlan C (10.3.3.0/24) locally.

And Router-A wants to redistribute direct route to BGP but also want to specify 10.1.1.0/24 prefix with community 7777:100.

So I tried to configure above as below:

enable bgp export direct address-family ipv4-unicast export-policy CONN_TO_BGP

Policy: CONN_TO_BGPentry 10 { 
if match any { 
    nlri 10.1.1.0/24 ;
}
then {
    community set "7777:100" ;
    permit  ;
}
}

However, when I checked the routes from Router-B, it only receives 10.1.1.0/24 with community 7777:100 but no other direct routes.

Please help me.
Photo of David

David

  • 100 Points 100 badge 2x thumb

Posted 4 months ago

  • 0
  • 2
Photo of Parthiban V

Parthiban V, Employee

  • 618 Points 500 badge 2x thumb
Hi David,

Try this 

CONN_TO_BGPentry 10 { 
if match any { 
    nlri 10.1.1.0/24 ;
}
then {
    community set "7777:100" ;
    permit  ;
}
}
entry two {
if match any {
   nlri 0.0.0.0/0;
} then {
   permit;
}
}
Photo of David

David

  • 100 Points 100 badge 2x thumb
Hi Parthiban,

Does entry two mean “all connected routes”?
Photo of David

David

  • 100 Points 100 badge 2x thumb
Let me ask one more question.

With Parthiban’s anwer above, let say this router A has 3 bgp neighnors, router-b, router-c and router-d. I want to redistribute direct routes to all three neighbors basically. But I want to filter prefix 10.1.1.0/24 with community 7777:100 to router-c and also want to filter 10.2.2.0/24 with community 8888:100 to router-d.

In orther words, router-b will receive all direct routes from router-a, router-c will receive all direct routes except 10.1.1.0/24 and router-d will receive all direct routes except 10.2.2.0/24.
For this scenario, how should I configure route policies?

Br
David