cisco 4900 layer 3 routing priority

I have a peculiar secnario with a set of routes on a cisco 4948 layer 3 switch (core switch(

examples are:

172.16.x.x is my main network

I have a static route:

ip route to an upstream route
Iip route to another router

the problem is that traffic is constantly routing to the router due to it matching the first ip route, however i want specific traffic for to route to another route, I cannot remove or change the existing /17 route, is there any way to set route priority so that traffic will first hit the route instead of the first route or am I stuck?

Who is Participating?
I am quite sure there is something wrong ...
u r static routes are perfect ..

p route to an upstream route
Iip route to another router

Ideally when a packet from comes it should always go to as in route selection
process longest match of subnet mask wins.

please paste  sh ip route ..
 r u running HSRP ?
You need to set up route-maps for your scenario:

1. create access-list to match the traffic you want to set the route for

2. create route maps and apply that access-list:

route-map <NAME> permit
match ip <access-list name>
set ip next-hop <gateway>

pathixAuthor Commented:
SO would route maps take precedence over the routing table itself? would i create a route map for just,

or create a route map with the entire routing table in it and remove all static routes? how does this affect directly connected routes?
I agree with @sanjeevloke in that when a route for a destination IP is determined from the routing table the longest prefix length matching subnet will be used.  So any traffic with a destintation of 172.16.2.x should always use as the next hop.  Are you using any routing protocols and is the default AD of 1 assigned to these static routes ?
I agree, the more specific route has the precedence, please post the sh ip route to solve the mystery
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.