You can use route
maps in policy-based routing to assign routing policies to the inbound
interface.
Cisco NX-OS routes
the packet as soon as it finds a next hop and an interface.
This example shows
how to add a route map to an interface:
switch# configure terminal
switch(config)# interface ethernet 1/2
switch(config-if)# ip policy route-map Testmap
switch(config)# exit
switch(config)# copy running-config startup-config
You can
configure the following optional match parameters for route maps in route-map
configuration mode:
Command
|
Purpose
|
match ip address
access-list-name
name [name...]
Example:
switch(config-route-map)#
match ip address access-list-name ACL1
|
Matches
an IPv4 address against one or more IP access control lists (ACLs). This
command is used for policy-based routing and is ignored by route filtering or
redistribution.
|
match ipv6 address
access-list-name
name
[name...]
Example:
switch(config-route-map)# match
ipv6 address access-list-name ACLv6
|
Matches
an IPv6 address against one or more IPv6 ACLs. This command is used for
policy-based routing and is ignored by route filtering or redistribution.
|
match length
min
max
Example:
switch(config-route-map)# match length 64 1500
|
Matches
against the length of the packet. This command is used for policy-based
routing.
|
match mac-list
maclist [...maclist]
|
Matches
against a list of MAC addresses. This command is used for policy-based routing.
|
match metric
metric-value [+- deviation-number] [...metric-value [+-
deviation-number]] [+- deviation-number] [... metric-value
+-
deviation-number]]
Example:
switch(config-route-map)# match metric 10
|
Matches
against the routing protocol metric. This command is used for policy-based
routing.
|
match vlan
vlan-range
switch(config-route-map)# match vlan 64
|
Matches
against the VLAN ID of the packet. This command is used for policy-based
routing.
|
You can
configure the following optional set parameters for route maps in route-map
configuration mode:
Command
|
Purpose
|
set ip next-hop
address2
[address2...] [load-share |
peer-address |
unchanged |
verify-availability]
Example:
switch(config-route-map)#
set ip next-hop 192.0.2.1
|
Sets the
IPv4 next-hop address for policy-based routing. This command uses the first
valid next-hop address if multiple addresses are configured. This can done with
next-hop tracking only.
-
Use
the optional
load-share keyword to load balance traffic across a maximum
of 16 next-hop addresses.
-
Use
the optional
peer-address keyword to the next hop to be the Border
Gateway Protocol (BGP) peering address.
-
Use
the optional
unchanged keyword to specifiy that the next-hop attribute in
the BGP update to the eBGP peer is unmodified.
-
Use
the optional
verify-availability keyword to verify the reachability of
the tracked object.
|
set ip default
next-hop
address2
[address2...] [load-share |
verify-availability]
Example:
switch(config-route-map)#
set ip default next-hop 192.0.2.2
|
Sets the
IPv4 next-hop address for policy-based routing when there is no explicit route
to a destination. This command uses the first valid next-hop address if
multiple addresses are configured. This can done with next-hop tracking only.
Note
|
For
software-forwarded traffic, the route that is present in the unicast routing
table (of the VRF in which packet was received) for packet-specified
destination takes preference over what is specified in
set
ip default next-hop command, when there is condition match. Even if there
is a default route present in the VRF, that default route overrides what is set
in the command. This applies to software-forwarded traffic only.
|
|
set ipv6 next-hop
address2
[address2...] [load-share |
peer-address |
unchanged |
verify-availability]
Example:
switch(config-route-map)#
set ipv6 next-hop 2001:0DB8::1
|
Sets the
IPv6 next-hop address for policy-based routing. This command uses the first
valid next-hop address if multiple addresses are configured. This can done with
next-hop tracking only.
-
Use
the optional
load-share keyword to load balance traffic across a maximum
of 16 next-hop addresses.
-
Use
the optional
peer-address keyword to the next hop to be the Border
Gateway Protocol (BGP) peering address.
-
Use
the optional
unchanged keyword to specifiy that the next-hop attribute in
the BGP update to the eBGP peer is unmodified.
-
Use
the optional
verify-availability keyword to verify the reachability of
the tracked object.
|
set ipv6 default
next-hop
address2
[address2...] [load-share |
verify-availability]
Example:
switch(config-route-map)#
set ipv6 default next-hop 2001:0DB8::2
|
Sets the
IPv6 next-hop address for policy-based routing when there is no explicit route
to a destination. This command uses the first valid next-hop address if
multiple addresses are configured. This can done with next-hop tracking only.
|
set ip precedence
precedence-value
Example:
switch(config-route-map)#
set ip precedence highv4
|
Sets the
precedence value in the IPv4 packet header.
|
set ipv6 precedence
precedence-value
Example:
switch(config-route-map)#
set ipv6 precedence highv6
|
Sets the
precedence value in the IPv6 packet header.
|
set ipv6 precedence address
prefix-list
prefix-list-name
Example:
switch(config-route-map)#
set ipv6 precedence address prefix-list acl1
|
Sets the
IPv6 map routes to be injected.
|
set interface {null10 |
tunnel-te}
Example:
switch(config-route-map)#
set interface null0
|
Sets the
interface used for routing. Use the
null0 interface to drop packets. Use the
tunnel-te interface to forward packets on the MPLS TE
tunnel.
|
set vrf
vrf-name
Example:
switch(config-route-map)#
set vrf MainVRF
|
Sets the
VRF for next-hop resolution.
|