Print Download PDF Send Feedback

Previous

Next

Example 3

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.

Example 4

To redistribute OSPFv2 routes from one instance to a different instance:

# This routemap (Intranet) matches all OSPF routes from OSPF instance

# default in prefix-list Intranet

# (ONLY WHEN USED IN OSPF BECAUSE OF MISSING MATCH STATEMENT)

# Match all static routes in prefix-list Intranet

# Match all direct routes in prefix-list Intranet

# Match all aggregate routes in prefix-list Intranet

# Match all kernel routes in prefix-list Intranet

# exporting to OSPF - no need to match proto OSPF for one of the IDs, it will assume it

# Do not match proto ospf2 or ospf2ase, they are both matched implicitly for this ID

set routemap Intranet id 1 on

set routemap Intranet id 1 allow

set routemap Intranet id 1 match ospf-instance default on

set routemap Intranet id 1 match prefix-list Intranet preference 1 on

set routemap Intranet id 11 on

set routemap Intranet id 11 match prefix-list Intranet preference 1 on

set routemap Intranet id 11 match protocol static

set routemap Intranet id 12 on

set routemap Intranet id 12 match prefix-list Intranet preference 1 on

set routemap Intranet id 12 match protocol direct

set routemap Intranet id 13 on

set routemap Intranet id 13 match prefix-list Intranet preference 1 on

set routemap Intranet id 13 match protocol aggregate

set routemap Intranet id 14 on

set routemap Intranet id 14 match prefix-list Intranet preference 1 on

set routemap Intranet id 14 match protocol kernel

Example 5

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

Example 6

To redistribute routes from an OSPFv2 Instance to BGP:

set routemap OSPF-to-BGP id 10 on

set routemap OSPF-to-BGP id 10 allow

set routemap OSPF-to-BGP id 10 match ospf-instance 222 on

set routemap OSPF-to-BGP id 10 match protocol ospf2

Example 7

To redistribute routes from an OSPFv3 Instance to BGP:

set routemap OSPF-to-BGP id 10 on

set routemap OSPF-to-BGP id 10 allow

set routemap OSPF-to-BGP id 10 match ospf-instance 222 on

set routemap OSPF-to-BGP id 10 match protocol ospf3