Thanks for that. That makes complete sense. I guess the question I have is how do you apply it? Is it applied anywhere? I have used route maps like this before:
set routemap bgp-in-65534 id 10 match network 10.0.0.0/8 all
set routemap bgp-in-65534 id 10 match network 172.16.0.0/12 all
set routemap bgp-in-65534 id 10 match network 192.168.0.0/16 all
And then I apply them like this:
set route-redistribution to bgp-as 65534 from bgp-as-number 53XXX network 10.7.0.0/24 action accept
set route-redistribution to bgp-as 65534 from bgp-as-number 53XXX network 10.7.0.0/24 match-type exact on
set route-redistribution to bgp-as 65534 from bgp-as-number 53XXX network 172.16.100.0/24 action accept
set route-redistribution to bgp-as 65534 from bgp-as-number 53XXX network 172.16.100.0/24 match-type exact on
So in the case above as long as my bgp-in-65534 routemap is matched and therefore in the BGP routing table I can then redistribute what I learned from 53XXX into 65534. But in this case I’m learning and announcing routes from AS to AS. My question is how do I advertise routes or redistribute routes to two different peers differently, in the same AS. Does that make sense?
I see in your example below that if peerR1 matches x.x.x.x/y then the AS path should be prepended 10 times and if it matches from peerR2, prepend once. Where in your config do you show who you announce that to? Or do you? I believe what you are doing is determining for yourself which path you should take based on what you learned from which router. But what I'm trying to do is announce what I learned with prepended AS paths. I can see how in your example you may be able to do something like set route-redistribution to bgp-as 11111 from [aggregate bgp-as-number bgp-as-path default-origin interface kernel ospf2 ospf2ase rip static route] but the “TO” part is only options are [bgp ospf rip].
That is where I’m getting stuck. Does my question make sense?