Using Policy-Based Routing to Route Based on Application Type
Problem
You want different applications to use different network links.
Solution
This example is similar to the previous one, except that instead of looking at the source address of the incoming IP packet, it looks at other protocol information such as TCP or UDP port number. The example redirects HTTP traffic (TCP port 80) for certain source addresses.
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#access-list
101
deny tcp
10.15.25.0 0.0.0.255
any eq
Router(config)#
www
access-list
101
permit tcp any any eq
Router(config)#
www
interface
Router(config-if)#
Ethernet0
ip address
Router(config-if)#
10.15.22.7 255.255.255.0
ip policy route-map
Router(config-if)#
Websurfers
ip route-cache policy
Router(config-if)#exit
Router(config)#route-map
Websurfers
permit
Router(config-route-map)#
10
match ip address
Router(config-route-map)#
101
set ip next-hop
Router(config-route-map)#
10.15.27.1
exit
Router(config)#route-map
Websurfers
permit
Router(config-route-map)#
20
set ip default next-hop
Router(config-route-map)#
10.15.26.1
end
Router#
This second example looks instead at the IP TOS field:
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#access-list
102
permit ip any any tos
Router(config)#
4
interface
Router(config-if)#
Serial0
ip address
Router(config-if)#
10.15.23.6 255.255.255.252
ip policy route-map
Router(config-if)# ...
High-priority
Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.