Redistribute all static routes into BGP AS group 400.
Set the MED value to 100, prepend our AS number to the aspath 4 times.
If the route belongs to the prefix 192.0.2.0/8, do not redistribute.
Send all BGP routes whose aspath matches the regular expression (100 200+) and set the MED value to 200.
set routemap static-to-bgp id 10 on
set routemap static-to-bgp id 10 restrict
set routemap static-to-bgp id 10 match protocol static
set routemap static-to-bgp id 10 match network 192.0.2.0/8 all
set routemap static-to-bgp id 15 on
set routemap static-to-bgp id 15 match protocol static
set routemap static-to-bgp id 15 action metric 100
set routemap static-to-bgp id 15 action aspath-prepend-count 4
set routemap bgp-out id 10 on
set routemap bgp-out id 10 match aspath-regex "(100 200+)" origin any
set routemap bgp-out id 10 action metric 200
set bgp external remote-as 400 export-routemap bgp-out preference 1 family inet on
set bgp external remote-as 400 export-routemap static-to-bgp preference 2 family inet on
|
Note - There is no need for a match protocol statement for routes belonging to the same protocol. |
|---|
Redistribute all OSPFv3 (internal and external) routes into BGP group 400.
Set the outgoing community string to 'no-export, 200 as 100'.
For BGP IPv6 routes, send them with an empty community string.
For all routes set the nexthop value to 3003::abcd:1012 (the address on the interface connecting to the peers).
|
Note - To exchange IPv6 routes in BGP the multiprotocol capability must be turned ON in BGP Configuration for the peer. |
|
set routemap ospf3-to-bgp id 10 on set routemap ospf3-to-bgp id 10 match protocol ospf3 #OSPF3 INTERNAL ROUTES set routemap ospf3-to-bgp id 10 action community replace on set routemap ospf3-to-bgp id 10 action community no-export on set routemap ospf3-to-bgp id 10 action community 200 as 100 on set routemap ospf3-to-bgp id 10 action nexthop ipv6 3003::abcd:1012
set routemap ospf3-to-bgp id 20 on set routemap ospf3-to-bgp id 20 match protocol ospf3ase #FOR AS EXTERNAL ROUTES set routemap ospf3-to-bgp id 20 action community replace on set routemap ospf3-to-bgp id 20 action community no-export on set routemap ospf3-to-bgp id 20 action community 200 as 100 on set routemap ospf3-to-bgp id 10 action nexthop ipv6 3003::abcd:1012
set routemap bgp-out id 10 on set routemap bgp-out id 10 action community replace on set routemap bgp-out id 10 action community none on set routemap ospf3-to-bgp id 10 action nexthop ipv6 3003::abcd:1012
set bgp external remote-as export-routemap bgp-out preference 1 family inet6 on set bgp external remote-as export-routemap ospf3-to-bgp preference 2 family inet6 on |
||