Skip to content

Route Map

Route maps provide a powerful and flexible mechanism for controlling route redistribution, filtering, and attribute manipulation in NX-OS routing policies through ordered sequences of match and set clauses. Each route map entry defines permit or deny actions with match criteria based on prefix lists, AS paths, community values, interfaces, metrics, tags, and route types, combined with set actions for modifying attributes like next-hop, local preference, metric, community, and weight. Route maps are essential for implementing complex routing policies across BGP, OSPF, IS-IS, and static route redistribution scenarios.

Diagram
NameTypeConstraintMandatoryDefault Value
route_mapsList[route_maps]No

NameTypeConstraintMandatoryDefault Value
nameStringYes
pbr_statisticsBooleantrue, falseNo
entriesList[entries]No

entries (nxos.devices.configuration.route_maps)

Section titled “entries (nxos.devices.configuration.route_maps)”
NameTypeConstraintMandatoryDefault Value
orderIntegermin: 0, max: 65535Yes
actionChoicepermit, denyNo
descriptionStringNo
drop_on_fail_v4Booleantrue, falseNo
drop_on_fail_v6Booleantrue, falseNo
force_order_v4Booleantrue, falseNo
force_order_v6Booleantrue, falseNo
load_share_v4Booleantrue, falseNo
load_share_v6Booleantrue, falseNo
set_default_next_hop_v4Booleantrue, falseNo
set_default_next_hop_v6Booleantrue, falseNo
set_vrf_v4Booleantrue, falseNo
set_vrf_v6Booleantrue, falseNo
verify_availability_v4Booleantrue, falseNo
verify_availability_v6Booleantrue, falseNo
match_ip_prefix_listStringNo
match_tagsListInteger[min: 0, max: 4294967295]No
set_communityStringNo
set_community_additiveBooleantrue, falseNofalse
set_community_noneBooleantrue, falseNofalse
set_community_criteriaChoicenone, append, replace, igp, pre-bestpathNonone

Example 1: Simple route map to tag loopback routes redistributed into BGP with a community value

nxos:
devices:
- name: SPINE1
configuration:
route_maps:
- name: RM-LOOPBACKS-OUT
entries:
- order: 10
action: permit
description: "Match loopback prefixes and set community"
match_ip_prefix_list: PL-LOOPBACKS
set_community: "65000:100"

Example 2: Route map with multiple entries for BGP peer policy — permit specific prefixes with different community treatments

nxos:
devices:
- name: LEAF1
configuration:
route_maps:
- name: RM-TENANT-EXPORT
entries:
- order: 10
action: permit
description: "Tag tenant subnet routes with community"
match_ip_prefix_list: PL-TENANT-NETS
set_community: "65000:1010"
set_community_criteria: replace
- order: 20
action: permit
description: "Allow default route with additive community"
match_ip_prefix_list: PL-DEFAULT-ONLY
set_community: "65000:9999"
set_community_additive: true
- order: 30
action: deny
description: "Deny all other prefixes"

Example 3: Multiple route maps on a border leaf for inbound/outbound BGP filtering, tag-based matching, and PBR statistics

nxos:
devices:
- name: BORDER-LEAF1
configuration:
route_maps:
# Inbound policy from external BGP peer
- name: RM-EXTERNAL-IN
entries:
- order: 10
action: permit
description: "Accept external routes and tag with community"
match_ip_prefix_list: PL-EXTERNAL-PREFIXES
set_community: "65000:500"
set_community_criteria: replace
- order: 20
action: deny
description: "Implicit deny all other inbound routes"
# Outbound policy to external BGP peer
- name: RM-EXTERNAL-OUT
entries:
- order: 10
action: permit
description: "Advertise loopbacks to external peer"
match_ip_prefix_list: PL-LOOPBACKS
set_community: "65000:100"
set_community_additive: true
- order: 20
action: permit
description: "Advertise tenant subnets with tag 1000"
match_tags:
- 1000
set_community: "65000:200"
- order: 30
action: deny
description: "Block everything else outbound"
# PBR route map for traffic steering
- name: RM-PBR-STEERING
pbr_statistics: true
entries:
- order: 10
action: permit
description: "Steer matched traffic to firewall"
match_ip_prefix_list: PL-FIREWALL-REDIRECT
set_default_next_hop_v4: true