02-17-2012 02:36 AM - edited 03-04-2019 03:18 PM
Hi Netpro
whicj of the below line the router process first?pls a bit explanation
ip route 1.2.3.4 255.255.255.255 4.4.4.4
ip route 1.2.3.0 255.255.255.0 4.4.4.4.4
thanks
02-17-2012 03:03 AM
Jamil,
Router/Switch/FW or any layer 3 device will always try to match using the longest prefix first and then check the other less specific or summary routes.
for an eg. if you have the routes as below:
ip route 1.2.3.4 255.255.255.255 3.3.3.3
ip route 1.2.3.0 255.255.255.0 4.4.4.4
Any traffic going towards 1.2.3.4 will go towards 3.3.3.3 and any other traffic destined towards
1.2.3.0/24 except for the host 1.2.3.4, it will use the other link towards 4.4.4.4
this way you can utilize multiple outgoing links, if required
Neeraj
02-17-2012 03:09 AM
hi Neeraj
i made a mistake in question,must be like below:
ip route 1.2.3.4 255.255.255.255 3.3.3.3
ip route 1.2.3.0 255.255.255.0 3.3.3.3
02-17-2012 03:17 AM
still the answer would be the same
it will look for the longest prefix match and if you are sending traffic towards 1.2.3.4, then it will chose the first route in your config as it matches it perfectly
but if you send the traffic towards 1.2.3.5 or 1.2.3.6 and so on...it will chose the second route because the first route is not an exact match
02-17-2012 03:17 AM
Hi,
what's the use if they both point to the same next-hop ?
Regards.
Alain
02-17-2012 04:01 AM
Hi Alain
its just a scenario, to see which of these process first?
02-17-2012 04:05 AM
Hi,
it's not a question of which is gonna be processed first but which of these 2 entries will be used to forward a packet to a certain destination and as these are 2 different prefixes( prefix-length) then the longest match will get used.
Regards.
Alain
02-17-2012 10:11 AM
Hi
so
ip route 1.2.3.4 255.255.255.255 3.3.3.3 ----->>>>Wins because of the longest match /32 am i right???
ip route 1.2.3.0 255.255.255.0 3.3.3.3
02-17-2012 10:25 AM
Hi,
if the destination IP is 1.2.3.4 then yes otherwise the router will use the second static route
Regards.
Alain
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide