Routing is normally performed based on the packet destination and the lowest route metric.
Policy routing makes routing decisions based on the actions of a route map.
Policy routing is applied to an interface and processes inbound packets.
Packets can be tested for packet size or a matching condition from a standard or extended IP access list.
Packets can then be directed to a specific next -hop router or an outbound interface.
Define a route map to use for matching and directing packets:
(global) route map map-tag [ permit deny ] [ sequence-num ]
The route map named map-tag either permits or denies a certain action. If more than one action is to be defined, the sequence number must be used. Route maps with the same name are processed in sequential order. For policy routing, a matching permit action routes according to the route map, and a matching deny action routes normally.
(Optional) Define a matching condition for the route map. If no matching condition is defined, every packet is matched successfully.
Match against the packet size:
(route-map) match length min max
IP packets that are between min and max bytes in size are matched.
-OR-
Match against a standard or extended IP access list:
(route-map) match ip address { access-list-num name } [ access-list-num name ]
IP packets are tested against one or more numbered or named access lists. A successful match results if all specified access lists permit the packet.
(Optional) Set the action(s) to be taken by policy routing.
Set the IP precedence value in the packet header:
(route-map) set ip precedence value
The IP precedence value can be set at the edge of the network, for further downstream Quality of Service processing. Valid values are a number or a name, as listed in Table 8-2.
-OR-
Specify the next-hop router where the packet will be forwarded:
(route-map) set ip next-hop ip-address [... ip-address ]
Matching packets are forwarded to the first available router in the list. The next-hop router must be an adjacent neighbor. If it isn't adjacent, or if the next-hop router is unreachable, the packet is routed normally instead.
-OR-
Specify the outbound router interface:
(route-map) set interface type num [... type num ]
Matching packets are forwarded out the first available interface in the list.
-OR-
Specify the default destination to be used for the packet if no specific route for that packet exists:
(route-map) set ip default next-hop ip-address [... ip-address ] (route-map) set default interface type num [... type num ]
default next-hop is the IP address of the next neighboring router; default interface is the outbound interface from which a packet is forwarded.
Number | Name |
---|---|
Routine | |
1 | Priority |
2 | Immediate |
3 | Flash |
4 | Flash-override |
5 | Critical |
6 | Internet |
7 | Network |
(Optional) Define more route maps using the same name, with greater sequence numbers .
Apply the route map to an inbound interface for policy routing:
(interface) ip policy route-map map-tag
Incoming packets on the interface are processed according to the route map named map-tag.
For packets entering interface serial 0, route all POP3 and SMTP traffic out interface serial 3:
route-map mailtraffic permit 10 match ip address 101 set interface serial 3 interface serial 0 ip policy route-map mailtraffic access-list 101 permit tcp any any eq pop3 access-list 101 permit tcp any any eq smtp