Link to home
Start Free TrialLog in
Avatar of pathix
pathixFlag for Canada

asked on

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?


Avatar of ddiazp
ddiazp
Flag of Canada image

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
Avatar of pathix

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of Sanjeevloke
Sanjeevloke

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
I agree, the more specific route has the precedence, please post the sh ip route 172.16.2.0 to solve the mystery