I am runing some BGP tests through the lab before rolling them out in production (thus, any IP addresses or AS numbers etc used here are done so in a completely fictitious manner).

Something that has always bugged me is the output on Cisco IOS of show ip route. What order are these routes in, it isn't numerical, 1, 2, 58 ,10! They aren't grouped by protocol , or metric either.

br2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set is subnetted, 4 subnets
B [200/0] via, 00:20:24
B [200/0] via, 00:20:24
B [20/0] via, 00:15:03
B [200/0] via, 00:20:24 is subnetted, 4 subnets
B [20/0] via, 07:41:53
B [20/0] via, 07:41:53
B [20/0] via, 07:41:53
B [20/0] via, 07:41:53 is variably subnetted, 3 subnets, 2 masks
B [200/0] via, 00:20:25
S is directly connected, Null0
B [200/0] via, 00:20:26 is variably subnetted, 15 subnets, 3 masks
i L2 [115/10] via, FastEthernet0/0
C is directly connected, Loopback0
i L2 [115/30] via, FastEthernet0/0
i L2 [115/20] via, FastEthernet0/0
C is directly connected, FastEthernet1/0
i L2 [115/20] via, FastEthernet0/0
i L2 [115/20] via, FastEthernet0/0
i L2 [115/20] via, FastEthernet0/0
i L2 [115/20] via, FastEthernet0/0
B [200/0] via, 00:20:26
B [200/0] via, 00:20:26
C is directly connected, FastEthernet0/0
C is directly connected, FastEthernet2/0.100
C is directly connected, FastEthernet2/0.200
B [20/0] via, 07:41:57 is subnetted, 1 subnets
B [200/0] via, 00:20:27

Even within the class-full boundaries or integer boundaries of prefix groups for example, comes after

  • show ip cef shows forwarding entries in numerical order – jwbensley Aug 7 '13 at 13:33

They are in order of specificity; The most specific (longest network mask) is first, and the least specific (shortest netmask) is last. If the network is variably subnetted, then they are grouped with the least-specific of the various netmasks, and ordered most-specific-first in each of the groupings.


It seems the output of show ip route is in the order of the internal tree structure, rather than an explicitly ordered (in the sense of route selection order) listing.

For example, here's an old post from the Cisco forums; https://supportforums.cisco.com/thread/344940 regarding IOS 12.

(If anyone can write a more authoritative answer, please leave me a comment and I'll delete my answer.)

  • 1
    This isn't making sense to me; The output starts with eight /32's then onto 58/8, so we have gone from /32s down to /8's. Within this 58/8 range the routes are ordered /32, /30, /32 in that order!? Coming out of 58/8 we go on to 10/8 (should this come before 58/8?), then onto Within 10/8 for example, the order is (work down the above output) /30, /32, /32, /32, /30....Can you show me what you mean? – jwbensley Aug 7 '13 at 9:42
  • Turns out the ordering is more complicated -- or rather, less meaningful -- than I had believed. Answer edited above. – Craig Constantine Aug 7 '13 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.