cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2561
Views
5
Helpful
7
Replies

BGP Redistribute/Prefix list

Anukalp S
Level 1
Level 1

Hi..

Need to your help to understand here that which will prefer if i have configured redistribution connected and prefix-list out under bgp.. which route will advertised.

 

router bgp 64559

redistribute connected

neighbour x.x.2.2 prefix-list LOCAL out

 

ip prefix-list LOCAL

seq 5 permit 10.125.200.0/24

seq 10 permit 10.125.201.0/24

 

Can you please confirm which route will be advertise to x.x.2.2.. will it be connected subnets or 10.125.200.0/24 & 10.125.201.0/24 under prefix list

7 Replies 7

pman
Spotlight
Spotlight

routes will be advertise to x.x.2.2 will it be the subnets under prefix-list.

 

I have a few questions:
1. Why not use the Network command instead of the "redistribute connected" command so you can gain more control over the routings you advertise?
2. Have you considered using a redistribute connected with route-map?

Hi Pman/Georg..

Actually subnets under prefix list are being learned through its connected routerA and we have vlans in the switch where this bgp config is setup, also x.x.2.2 connectes to another routerB. This BGP config is present there but i see routerB receives subnets under prefix list.. so i wanted to know which will be prefer first, also FYI.. redistribute command take first place and prefix list comes below the redistribute command.

neighbor x.x.x.x prefix-list is the determinant.
If you clear bgp for that neighbor it should only get the routes from the prefix-list that you sent to him

 

I would suggest using the "network" command (giving you more control over what you advertise) and not the "redistribute connected" command, of course unless you have a real reason to do so

Hello @Anukalp S ,

>> Actually subnets under prefix list are being learned through its connected routerA

Does this mean the local device has two BGP neighbors ?

 

In any case, in route filtering the most specific command wins : so  BGP neighbor x.x.2.2 will receive only the prefixes allowed in the prefix-list named LOCAL, regardless of how many connected subnets exist on the local node.

 

The question on what happens first between redistribute connected and a neigh x.x.2.2 prefix-list LOCAL out is not so important.

Redistribute connected is a way to locally inject prefixes in the local BGP table.

Only best paths can be advertised so the local BGP table or RIB is prepared first.

Then for each BGP peer that share the same outbound policy an update group is created ( a sort of implicit peer-group) and the set of NLRIs to be sent is prepared by processing all the available prefixes via the route filters applied to the specific neighbor(s). This creates the outbound RIB for that update group / neighbor.

 

I agree with @pman that using the network command can provide more control and a better origin code ( i instead of ?).

 

Hope to help

Giuseppe

 

Thanks Giuseppe / All for your advice here, yes local router has 2 bgp neighbourship

Hello,

 

out of curiosity, I lab tested this in order to find out what the order of preference is, that is, what is applied first, the prefix list, or the 'redistribute connected'. I could not really find that documented anywhere; unfortunately the debugs for both are exactly the same, so maybe somebody can explain what is applied first...

 

Debug with prefix list  AND 'redistribute connected' applied:

 

*Aug 17 12:08:47.102: BGP: topo global:IPv4 Unicast:base Scanning routing tables
*Aug 17 12:08:47.105: BGP: Applying map to find origin for 10.125.200.0/24
*Aug 17 12:08:47.111: BGP: Applying map to find origin for 10.125.201.0/24
*Aug 17 12:08:47.113: BGP: Applying map to find origin for 192.168.1.0/30
*Aug 17 12:08:47.114: BGP: Applying map to find origin for 1.1.1.1/32
*Aug 17 12:08:47.115: BGP: topo global:IPv4 Multicast:base Scanning routing tables
*Aug 17 12:08:47.116: BGP: topo global:L2VPN E-VPN:base Scanning routing tables
*Aug 17 12:08:47.117: BGP: topo global:MVPNv4 Unicast:base Scanning routing tables

 

Debug WITHOUT  prefix list and just 'redistribute connected':

 

*Aug 17 12:10:47.144: BGP: topo global:IPv4 Unicast:base Scanning routing tables
*Aug 17 12:10:47.147: BGP: Applying map to find origin for 10.125.200.0/24
*Aug 17 12:10:47.149: BGP: Applying map to find origin for 10.125.201.0/24
*Aug 17 12:10:47.150: BGP: Applying map to find origin for 192.168.1.0/30
*Aug 17 12:10:47.151: BGP: Applying map to find origin for 1.1.1.1/32
*Aug 17 12:10:47.152: BGP: topo global:IPv4 Multicast:base Scanning routing tables
*Aug 17 12:10:47.153: BGP: topo global:L2VPN E-VPN:base Scanning routing tables
*Aug 17 12:10:47.155: BGP: topo global:MVPNv4 Unicast:base Scanning routing tables

BGP
redistribute connect will done first and it will inject all connect to BGP
then 
prefix-list OUT will filter that this prefix will send to this neighbor and that prefix will send to that neighbor. 

DO show ip bgp <- you will see all prefix connect to this peer 
DO show ip bgp in neighbor <- you will see only prefix-list permit prefix 

Review Cisco Networking products for a $25 gift card