Routing Policy Commands

Use these commands to configure route maps and prefix lists.

ip policy route-map

M4250

M4350

Use this command to identify a route map to use for policy-based routing on an interface specified by route-map-name. Policy-based routing is configured on the interface that receives the packets, not on the interface from which the packets are sent.

When a route-map applied on the interface is changed, that is, if new statements are added to route-map or match/set terms are added/removed from route-map statement, and also if route-map that is applied on an interface is removed, route-map needs to be removed from interface and added back again in order to have changed route-map configuration to be effective.

Note: Route-map and Diffserv cannot work on the same interface.
Format ip policy route-map route-map-name
Mode Interface Config
CODE
(NETGEAR Switch) (Config)#interface 1/0/1
(NETGEAR Switch) (Interface 1/0/1)#
(NETGEAR Switch) (Interface 1/0/1)#ip policy route-map equal-access

no ip policy route-map

Use this command to disable policy-based routing on an interface.

Format no ip policy route-map route-map-name
Mode Interface Config

route-map

M4250

M4350

To create a route map and enter Route Map Configuration mode, use the route-map command in Global Configuration mode. One use of a route map is to limit the redistribution of routes to a specified range of route prefixes. The redistribution command specifies a route map which refers to a prefix list. The prefix list identifies the prefixes that may be redistributed. The switch accepts up to 64 route maps.

Default No route maps are configured by default. If no permit or deny tag is specified, permit is the default.
Format route-map map-tag [permit | deny] [sequence-number]
Mode Global Configuration
Parameter Description
map-tag Text name of the route map. Route maps with the same name are grouped together in order of their sequence numbers. A route map name may be up to 32 characters long.
permit (Optional) Permit routes that match all of the match conditions in the route map.
deny (Optional) Deny routes that match all of the match conditions in the route map.
sequence-number (Optional) An integer used to order the set of route maps with the same name. Route maps are ordered from lowest to greatest sequence number, with lower sequence numbers being considered first. If no sequence number is specified, the system assigns a value ten greater than the last statement in the route map. The range is 0 to 65,535.

Command example:

The following example configures BGP to redistribute all prefixes within 172.20.0.0 and reject all others:

CODE
(NETGEAR Switch)(config)# ip prefix-list redist-pl permit 172.20.0.0/16 le 32
(NETGEAR Switch)(config)# route-map redist-rm permit
(NETGEAR Switch)(config-route-map)# match ip address prefix-list redist-pl
(NETGEAR Switch)(config-route-map)# exit

no route-map

To delete a route map or one of its statements, use the no route-map command.

Format no route-map map-tag [permit | deny] [sequence-number]
Mode Global Configuration

match ip address {access-list-number | access-list-name}

M4250

M4350

Use this command to configure a route map in order to match based on the match criteria configured in an IP access-list. Note that an IP ACL must be configured before it is linked to a route-map. Actions present in an IP ACL configuration are applied with other actions involved in route-map. If an IP ACL referenced by a route-map is removed or rules are added or deleted from that ACL, the configuration is rejected.

If there are a list of IP access-lists specified in this command and the packet matches at least one of these access-list match criteria, the corresponding set of actions in route-map are applied to packet.

If there are duplicate IP access-list numbers/names in this command, the duplicate configuration is ignored.

Default No match criteria are defined by default.
Format match ip address {access-list-number | access-list-name} [...access-list-number | access-list-name]
Mode Route Map Configuration
Parameter Description
access-list-number The access-list number that identifies an access-list configured through access-list CLI configuration commands. This number is 1 to 99 for standard access list number. This number is 100 to 199 for extended access list number.
access-list-name The access-list name that identifies named IP ACLs. Access-list name can be up to 31 characters in length. A maximum of 16 ACLs can be specified in this match clause.

Command example:

The following example creates a route-map with a match clause on ACL number and applies that route-map on an interface:

CODE
(NETGEAR Switch) (config)#access-list 1 permit ip 10.1.0.0 0.0.255.255
(NETGEAR Switch) (config)#access-list 2 permit ip 10.2.0.0 0.0.255.255
(NETGEAR Switch) (config)#route-map equal-access permit 10
(NETGEAR Switch) (config-route-map)#match ip address 1
(NETGEAR Switch) (config-route-map)#set ip default next-hop 192.168.6.6
(NETGEAR Switch) (config-route-map)#route-map equal-access permit 20
(NETGEAR Switch) (config-route-map)#match ip address 2
(NETGEAR Switch) (config-route-map)#set ip default next-hop 172.16.7.7
(NETGEAR Switch) (config)#interface 1/0/1
(NETGEAR Switch) (Interface 1/0/1)#ip address 10.1.1.1 255.255.255.0
(NETGEAR Switch) (Interface 1/0/1)#ip policy route-map equal-access
(NETGEAR Switch) (config)#interface 1/0/2
(NETGEAR Switch) (Interface 1/0/2)#ip address 192.168.6.5 255.255.255.0
(NETGEAR Switch) (config)#interface 1/0/3
(NETGEAR Switch) (Interface 1/0/3)#ip address 172.16.7.6 255.255.255.0

The ip policy route-map equal-access command is applied to interface 1/0/1. All packets coming inside 1/0/1 are policy-routed.

Sequence number 10 in route map equal-access is used to match all packets sourced from any host in subnet 10.1.0.0. If there is a match, and if the switch has no explicit route for the packet’s destination, it is sent to next-hop address 192.168.6.6.

Sequence number 20 in route map equal-access is used to match all packets sourced from any host in subnet 10.2.0.0. If there is a match, and if the switch has no explicit route for the packet’s destination, it is sent to next-hop address 172.16.7.7.

All other packets are forwarded as per normal L3 destination-based routing.

Command example:

The following example shows a scenario in which an IP ACL that is referenced by a route-map is removed or rules are added or deleted from that ACL:

CODE
(NETGEAR Switch) #show ip access-lists

Current number of ACLs: 9  Maximum number of ACLs: 100
ACL ID/Name                      Rules  Direction  Interface(s)      VLAN(s)
-------------------------------  -----  ---------  ----------------  ----------
1                                1
2                                1
3                                1
4                                1
5                                1
madan                            1
(NETGEAR Switch) #show mac access-lists

Current number of all ACLs: 9  Maximum number of all ACLs: 100
MAC ACL Name                     Rules  Direction  Interface(s)       VLAN(s)
-------------------------------  -----  ---------  ----------------  ----------
madan                            1
mohan                            1
goud                             1

(NETGEAR Switch) #
(NETGEAR Switch) #configure
(NETGEAR Switch) (Config)#route-map madan
(NETGEAR Switch) (route-map)#match ip address 1 2 3 4 5 madan
(NETGEAR Switch) (route-map)#match mac-list madan mohan goud
(NETGEAR Switch) (route-map)#exit
(NETGEAR Switch) (Config)#exit
(NETGEAR Switch) #show route-map
route-map madan permit 10
     Match clauses:
       ip address (access-lists) : 1 2 3 4 5 madan
       mac-list (access-lists) : madan mohan goud
     Set clauses:

(NETGEAR Switch) (Config)#access-list 2 permit every
Request denied. Another application using this ACL restricts the number of rules allowed.
(NETGEAR Switch) (Config)#ip access-list madan
(NETGEAR Switch) (Config-ipv4-acl)#permit udp any any
Request denied. Another application using this ACL restricts the number of rules allowed.

no match ip address (for an access list)

To delete a match statement for an access list from a route map, use the no match ip address command.

Format no match ip address [access-list-number | access-list-name]
Mode Route Map Configuration

match length

M4250

M4350

Use this command to configure a route map to match based on the Layer 3 packet length between specified minimum and maximum values. min specifies the packet’s minimum Layer 3 length, inclusive, allowed for a match. max specifies the packet’s maximum Layer 3 length, inclusive, allowed for a match. Each route-map statement can contain one ‘match’ statement on packet length range.

Default No match criteria are defined by default.
Format match length min max
Mode Route Map Configuration

Command example:

CODE
(NETGEAR Switch) (config-route-map)# match length 64 1500

no match length

Use this command to delete a match statement from a route map.

Format no match length
Mode Route Map Configuration

match mac-list

M4250

M4350

Use this command to configure a route map in order to match based on the match criteria configured in a MAC access-list.

A MAC ACL is configured before it is linked to a route-map. Actions present in the MAC ACL configuration are applied with other actions involved in the route map. When a MAC ACL referenced by a route map is removed, the route map rule is also removed and the corresponding rule is not effective. When a MAC ACL referenced by a route map is removed or rules are added or deleted from that ACL, the configuration is rejected.

You can add up to 16 MAC ACLs.

Default No match criteria are defined by default.
Format match mac-list mac-list-name [mac-list-name]
Mode Route Map Configuration
Parameter Description
mac-list-name The mac-list name that identifies MAC ACLs. MAC access list name can be up to 31 characters in length.

Command example:

PYTHON
(NETGEAR Switch) (config-route-map)# match mac-list MacList1

Example 2:
This example illustrates the scenario where MAC ACL referenced by a route-map is removed
or rules are added or deleted from that ACL, this is how configuration is rejected:

(NETGEAR Switch) #show mac access-lists

Current number of all ACLs: 9  Maximum number of all ACLs: 100

MAC ACL Name                     Rules  Direction  Interface(s)       VLAN(s)
-------------------------------  -----  ---------  ----------------  ----------
madan                            1
mohan                            1
goud                             1

(NETGEAR Switch) #
(NETGEAR Switch) #configure
(NETGEAR Switch) (Config)#route-map madan
(NETGEAR Switch) (route-map)#match mac-list madan mohan goud
(NETGEAR Switch) (route-map)#exit
(NETGEAR Switch) (Config)#exit
(NETGEAR Switch) #show route-map

route-map madan permit 10
     Match clauses:
       mac-list (access-lists) : madan mohan goud
     Set clauses:

(NETGEAR Switch) (Config)#mac access-list extended madan
(NETGEAR Switch) (Config-mac-access-list)#permit 00:00:00:00:00:01 ff:ff:ff:ff:ff:ff any
Request denied. Another application using this ACL restricts the number of rules allowed.

no match mac-list

To delete a match statement from a route map, use the no match mac-list command.

Format no match mac-list […mac-list-name]
Mode Route Map Configuration

match metric

M4250

M4350

This command configures a route-metric match attribute for OSPF traffic. The value argument is a value from 0 to 4,294,967,295.

Default No match criteria are defined by default.
Format match metric value
Mode Route Map Configuration

no match metric

Use this command to remove a route-metric match attribute for OSPF traffic.

Format no match metric value
Mode Route Map Configuration

match metric-type

M4250

M4350

This command configures a route-metric type match attribute for OSPF traffic. The value argument can be 1 or 2, which specifies external LSA metric type 1 or type 2 in OSPF.

Default No match criteria are defined by default.
Format match metric-type value
Mode Route Map Configuration

no match metric-type

Use this command to remove a route-metric type match attribute (LSA metric type 1 or type 2) for OSPF traffic.

Format no match metric-type value
Mode Route Map Configuration

match tag

M4250

M4350

This command configures a route tag value match attribute for an external LSA route in OSPF traffic. The value argument can be from 0 to 4,294,967,295.

Default No match criteria are defined by default.
Format match tag value
Mode Route Map Configuration

no match tag

Use this command to remove a route tag value match attribute for OSPF traffic.

Format no match tag value
Mode Route Map Configuration

set interface

M4250

M4350

If you do not want to revert to normal forwarding but instead want to drop a packet that does not match the specified criteria, a set statement must be configured to route the packets to interface null 0 as the last entry in the route-map. A set interface null0 command must be configured in a separate statement. It must not be added along with any other statement that has other match or set terms.

A route map statement that is used for policy-based routing (PBR) is configured as permit or deny. If the statement is marked as deny, traditional destination-based routing is performed on the packet meeting the match criteria. If the statement is marked as permit, and if the packet meets all the match criteria, then set commands in the route-map statement are applied. If no match is found in the route map, the packet is not dropped, instead the packet is forwarded using the routing decision taken by performing destination-based routing.

Format set interface null0
Mode Route Map Configuration

no set interface

Use this command to remove interface null 0 as the last entry in the route map.

Format no set interface null0
Mode Route Map Configuration

set ip next-hop

M4250

M4350

Use this command to specify the adjacent next-hop router in the path toward the destination to which the packets should be forwarded. If more than one IP address is specified, the first IP address associated with a currently up-connected interface is used to route the packets.

This command affects all incoming packet types and is always used if configured. If configured next-hop is not present in the routing table, an ARP request is sent from the switch.

In a route-map statement, the set ip next-hop and set ip default next-hop commands are mutually exclusive. However, the set ip default next-hop command can be configured in a separate route map statement.

You can specify a maximum of 16 next-hop IP addresses.

Format set ip next-hop ip-address [...ip-address]
Mode Route Map Configuration
Parameter Description
ip-address The IP address of the next hop to which packets are output. It must be the address of an adjacent router.

no set ip next-hop

Use this command to remove a set command from a route map.

Format no set ip next-hop ip-address [...ip-address]
Mode Route Map Configuration

set ip default next-hop

M4250

M4350

Use this command to set a list of default next-hop IP addresses. If more than one IP address is specified, the first next hop specified that appears to be adjacent to the switch is used. The optional specified IP addresses are tried in turn.

A packet is routed to the next hop specified by this command only if there is no active route for the packet’s destination address in the routing table. A default route in the routing table is not considered an active route for an unknown destination address for policy-based routing (PBR).

In a route-map statement, the set ip next-hop and set ip default next-hop commands are mutually exclusive. However, the set ip default next-hop command can be configured in a separate route-map statement.

You can specify a maximum of 16 next-hop IP addresses.

Format set ip default next-hop ip-address [...ip-address]
Mode Route Map Configuration
Parameter Description
ip-address The IP address of the next hop to which packets are output. It must be the address of an adjacent router.

no set ip default next-hop

Use this command to remove a set command from a route map.

Format no set ip default next-hop ip-address [...ip-address]
Mode Route Map Configuration

set ip precedence

M4250

M4350

Use this command to set the three IP precedence bits in the IP packet header. With three bits, you have eight possible values for the IP precedence; value can be a number from 0 through 7. This command is used when implementing QoS and can be used by other QoS services, such as weighted fair queuing (WFQ) and weighted random early detection (WRED).

Default No precedence set
Format set ip precedence value
Mode Route Map Configuration
Parameter Description
0 Sets the routine precedence
1 Sets the priority precedence
2 Sets the immediate precedence
3 Sets the Flash precedence
4 Sets the Flash override precedence
5 Sets the critical precedence
6 Sets the internetwork control precedence
7 Sets the network control precedence

no set ip precedence

Use this command to reset the three IP precedence bits in the IP packet header to the default.

Format no set ip precedence
Mode Route Map Configuration

show ip policy

M4250

M4350

This command lists the route map associated with each interface.

Format show ip policy
Mode Privileged EXEC
Term Definition
Interface The interface.
Route-map The route map.

show route-map

M4250

M4350

To display a route map, use the show route-map command in Privileged EXEC mode.

Format show route-map [map-name]
Mode Privileged EXEC
Parameter Description
map-name (Optional) Name of a specific route map.

Command example:

CODE
(NETGEAR Switch) # show route-map test
route-map test, permit, sequence 10
     Match clauses:
       ip address prefix-lists: orange
     Set clauses:
       set metric 50