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 172.16.0.0/17 to an upstream route 172.16.1.1
Iip route 172.16.2.0/24 to another router 172.16.2.1

the problem is that traffic is constantly routing to the 172.16.1.1 router due to it matching the first ip route, however i want specific traffic for 172.16.2.0/24 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 172.16.2.0/24 route instead of the first 172.16.0.0/17 route or am I stuck?


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

p route 172.16.0.0/17 to an upstream route 172.16.1.1
Iip route 172.16.2.0/24 to another router 172.16.2.1

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

please paste  sh ip route 172.16.2.0 ..
 r u running HSRP ?
0
 
ddiazpCommented:
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>

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

or create a route map with the entire routing table in it and remove all static routes? how does this affect directly connected routes?
0
 
ipajonesCommented:
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 172.16.2.1 as the next hop.  Are you using any routing protocols and is the default AD of 1 assigned to these static routes ?
--IJ
0
 
domenicosillettiCommented:
I agree, the more specific route has the precedence, please post the sh ip route 172.16.2.0 to solve the mystery
0
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.