Does the order of entries in the routing table matter?
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Over Ancient Waters Looping
--
Chapters
00:00 Does The Order Of Entries In The Routing Table Matter?
00:56 Accepted Answer Score 36
01:23 Answer 2 Score 7
01:52 Thank you
--
Full question
https://superuser.com/questions/622750/d...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#router #ip #routing #arp
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Over Ancient Waters Looping
--
Chapters
00:00 Does The Order Of Entries In The Routing Table Matter?
00:56 Accepted Answer Score 36
01:23 Answer 2 Score 7
01:52 Thank you
--
Full question
https://superuser.com/questions/622750/d...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#router #ip #routing #arp
#avk47
ACCEPTED ANSWER
Score 36
The order in the table doesn't matter; routes with a longer prefix always take priority. If you stop clinging to netmasks and consider the prefix lengths instead (which ip route
shows), you have 123.x.x.128/27
and 123.x.x.151/32
, and the latter – more specific – route will take priority over the former (more generic one).
ANSWER 2
Score 7
Order only matters if you have duplicate routes. Don't do that.
For example, if two interfaces have the same destination, netmask, and gateway of 0.0.0.0, the first one will grab all the traffic for that network.
What's more, I've found some systems will randomly reorder on boot which one comes first. If only one works, or only one has a router gateway set, this can result in losing access to that network on reboot.