Objectives

This challenge involves the creation of policy-based routing. The objectives of this challenge are to:

Commands

# config t
(config)# access-list 5 permit 192.168.0.0 0.0.0.255
(config)# access-list 10 permit 172.16.0.0 0.0.0.255
(config)# route-map R1 permit 10
(config-route-map)# match ip address 5
(config-route-map)# set interface s0
(config-route-map)# exit
(config)# route-map R2 permit 10
(config-route-map)# match ip address 10
(config-route-map)# set interface s1
(config-route-map)# exit
(config)# int e0
(config-if)# ip policy route-map R1
(config-if)# exit
(config)# int e1
(config-if)# ip policy route-map R2
(config-if)# exit

Example

# config t
(config)# access-list 5 permit 192.168.0.0 0.0.0.255
(config)# access-list 10 permit 172.16.0.0 0.0.0.255
(config)# route-map ?
  WORD  Route map tag

(config)# route-map R1 ?
  <0-65535>  Sequence to insert to/delete from existing route-map entry
  deny       Route map denies set operations
  permit     Route map permits set operations
  

(config)# route-map R1 permit ?
  <0-65535>  Sequence to insert to/delete from existing route-map entry
  
(config)# route-map R1 permit 10
(config-route-map)# ?
Route Map configuration commands:
  default      Set a command to its defaults
  description  Route-map comment
  exit         Exit from route-map configuration mode
  help         Description of the interactive help system
  match        Match values from routing table
  no           Negate a command or set its defaults
  set          Set values in destination routing protocol
(config-route-map)# match ip address 5
(config-route-map)# set interface s0
(config-route-map)# exit
(config)# route-map R2 permit 10
(config-route-map)# match ip address 10
(config-route-map)# set interface s1
(config-route-map)# exit
(config)# int e0
(config-if)# ip pol ?
  route-map  Policy route map
(config-if)# ip pol r ?
  WORD  Route map name
(config-if)# ip pol r R1 ?
  
(config-if)# ip policy route-map R1
(config-if)# exit
(config)# int e1
(config-if)# ip policy route-map R2
(config-if)# exit

Explanation

The policy-based routing allows traffic to flow from one port to another based on its details. For example:

(config)# access-list 5 permit 192.168.0.0 0.0.0.255
(config)# access-list 10 permit 172.16.0.0 0.0.0.255
(config)# route-map R1 permit 10
(config-route-map)# match ip address 5
(config-route-map)# set interface s0
(config-route-map)# exit
(config)# route-map R2 permit 10
(config-route-map)# match ip address 10
(config-route-map)# set interface s1
(config-route-map)# exit

and:

(config)# int e0
(config-if)# ip policy route-map R1
(config-if)# exit
(config)# int e1
(config-if)# ip policy route-map R2
(config-if)# exit

defines that traffic that matches 192.168.0.0 on S0 is routed through E0, and traffic that matches 172.16.0.0 is routed through E1.