cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
564
Views
4
Helpful
8
Replies

router process

Ibrahim Jamil
Level 6
Level 6

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

8 Replies 8

Neeraj Arora
Level 3
Level 3

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

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

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

Hi,

what's the use if they both point to the same next-hop ?

Regards.

Alain

Don't forget to rate helpful posts.

Hi Alain

its just a scenario, to see which of these process first?

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

Don't forget to rate helpful posts.

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

Hi,

if the destination IP is 1.2.3.4  then yes otherwise the router will use the second static route

Regards.

Alain

Don't forget to rate helpful posts.
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card