It takes a little while using route-maps to understand how they work, as they’re used flexibly in a variety of scenarios.
For this one, it looks like you’re nearly there. You’re setting up an export route-map for a specific upstream neighbour.
First thing, a prefix-list is an separate config element, not an address embedded in the route-map, for eg:
set policy prefix-list6 PL-PREPENDED-NETS description "Prefixes we want to prepend upstream"
set policy prefix-list6 PL-PREPENDED-NETS rule 10 action permit
set policy prefix-list6 PL-PREPENDED-NETS rule 10 prefix 2605:4e40::/32
set policy prefix-list6 PL-ANNOUNCED-NETS description "Prefixes we want to announce upstream"
set policy prefix-list6 PL-ANNOUNCED-NETS rule 10 action permit
set policy prefix-list6 PL-ANNOUNCED-NETS rule 10 prefix 2605:4e40::/32
set policy prefix-list6 PL-ANNOUNCED-NETS rule 20 action permit
set policy prefix-list6 PL-ANNOUNCED-NETS rule 20 prefix 2605:6340::/32
Then you just need a route-map setup appropriately:
set policy route-map UPSTREAM-AS20055-OUT rule 100 description "Announce with prepending"
set policy route-map UPSTREAM-AS20055-OUT rule 100 action permit
set policy route-map UPSTREAM-AS20055-OUT rule 100 match ipv6 address prefix-list PL-PREPENDED-NETS
set policy route-map UPSTREAM-AS20055-OUT rule 100 set as-path prepend-last-as 4
set policy route-map UPSTREAM-AS20055-OUT rule 200 description "Announce all valid"
set policy route-map UPSTREAM-AS20055-OUT rule 200 action permit
set policy route-map UPSTREAM-AS20055-OUT rule 200 match ipv6 address prefix-list PL-ANNOUNCED-NETS
Finally set it as the export RM for that neighbour or peer-group:
set protocols bgp neighbor 2605:21c0:1000:26::1 address-family ipv6-unicast route-map export UPSTREAM-AS20055-OUT
Commit & confirm expected operation from op-mode (or use run from config-mode):
show bgp ipv6 neighbors 2605:21c0:1000:26::1 advertised-routes
And it doesn’t hurt to check an external looking glass.
If that doesn’t work, then prepend-last-as may not apply to local announcements. I’ve not used it yet, I still use the older style set as-path prepend "40033 40033 40033"
.
You can use other matching criteria for more complex networks, not just prefix-lists. For eg, if you had some central peers announcing your internal prefixes and several border routers speaking to external peers, the announcing routers can set community tags and other attributes on the prefixes for the borders to match when they’re deciding what to announce and how. The border can set attributes so interior routers know where external prefixes entered the network for filtering and preferencing. Route-maps are also capable of some simple logic with the “on-match”, “continue” and “call” parameters - but it’s a good idea to keep it as simple as possible.
I find it’s best to have a “default-deny” mindset with external BGP - if a prefix isn’t needed, don’t announce it. In my example above, that means the only prefixes we can announce are the ones we want to - we aren’t pumping out accidental private management ranges or locally connected interfaces that managed to sneak into internal BGP, or reflecting any upstream misconfiguration out to another carrier. IBGP is a bit different but in larger networks does need similar constraints.
Finally, keep in mind that external peers have their own policies and may manipulate your presented path as they see fit. For eg, some providers will strip too many prepends down to a maximum number if they receive them, for others it may not match their path filters.