Subscribe Subscribe | Subscribe Comments RSS
Subscribe in Bloglines

Add to netvibes
Add to Google Reader or Homepage

Cisco routers running Cisco IOS supports pased based IP Routing which can route packets based on a set IP Policy exiting an Interface.

Policy based routing in Cisco ROuters can be performed by using "route-map" and then applying as a policy to the interface of the IP Packets.

The route-map  has a list of "match" and "set" commands where match defines the criteria under which the policy routing is performed (say, match a destination IP or a standard or Extended ACL) and set defines the actions to perform when match criteris met (say, set next hop).

In this example, I change the routing to a particular network only from a particular subnet which is defined in a standard ACL. This ACL is then matched in a route-map and applied as an IP policy for routing change for the change in routing behaviour.

IP Route-Map

Create Standard ACL

From the global configuration mode, create an ACL to permit source network

ciscorouter# conf term

ciscorouter(config)# access-list 10 permit

That creates a new ACL "10" with a permit for network.

Create Route-Map

Define a route-map with "match" conditions and "set" actions.

ciscorouter(config)# route-map SetNextHop permit 10

ciscorouter(config-route-map)# match ip address 10

ciscorouter(config-route-map)# set ip next-hop

ciscorouter(config-route-map)# exit

That creates a route-map called "SetNextHop" and matches the ACL 10 where the source network for which the route-map should be actioned. I've set the action to be taken when the source network matches to set the next hop router as

Apply Policy Route-map to interface

This route-map is now applied to the interface (fa0/0)

ciscorouter(config)# interface fa0/0

ciscorouter(config-if)# ip policy route-map SetNextHop

Test for yourself. For source network, the nexthop IP is set as (Router B) where every other source networks are router as specified by the static/dynamic routes (in our example through Router A)

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

9 Comments so far »

  1. by mehul, on January 7 2009 @ 9:25 am


    nice document site for refer

  2. by joel, on April 22 2009 @ 10:03 pm


    int fa0/0?

    just wanna say thx..

  3. by n. tomar, on May 14 2009 @ 1:17 am


    really nice document.

  4. by Achilleas, on September 17 2009 @ 2:19 am


    I have a question.

    What is the inside IP address for router A and router B
    which is the gateway for the PCs to LAN (

    Achilleas from Greece

  5. by aptgetmoo, on December 22 2009 @ 7:58 pm



    I would like to know, can I reroute based on source IP address instead of source network address?

    Thanks in advance.

  6. by sunny, on June 2 2010 @ 12:04 am


    what is th difference when you say set ip next-hop compare to set interface ?

    I have found issue in traffic getting droped with set ip next-hop in reoute-map but worked with set interface command.

    Appreciate your input.


  7. by Faisal Memon, on July 14 2010 @ 5:59 am


    Nice Share. Much Appreciated.

  8. by Powerchino, on September 21 2010 @ 12:55 pm


    Thanks for sharing, your document is right on target and please keep up the good work, Thank you!

  9. by m3kw, on August 23 2011 @ 2:22 pm


    Didn’t you forgot the “no switchport” command?

Comment RSS · TrackBack URI

Leave a comment

Name: (Required)

eMail: (Required)