9 Replies Latest reply: May 6, 2012 7:49 AM by chris_lei RSS

    longer-prefixes

    Catalyst52

      From:

      http://www.cisco.com/en/US/docs/ios/12_2/iproute/command/reference/1rfindp2.html#wp1022511



      The following is sample output using the longer-prefixes keyword. When the longer-prefixes keyword is included, the address and mask pair becomes the prefix, and any address that matches that prefix is displayed. Therefore, multiple addresses are displayed.

      In the following example, the logical AND operation is performed on the source address 128.0.0.0 and the mask 128.0.0.0, resulting in 128.0.0.0. Each destination in the routing table is also logically ANDed with the mask and compared to that result of 128.0.0.0. Any destinations that fall into that range are displayed in the output.

      Router# show ip route 128.0.0.0 128.0.0.0 longer-prefixes 

      Codes: I - IGRP derived, R - RIP derived, O - OSPF derived,

             C - connected, S - static, E - EGP derived, B - BGP derived,

             * - candidate default route, IA - OSPF inter area route,

             i - IS-IS derived, ia - IS-IS, U - per-user static route, 

             o - on-demand routing, M - mobile, P - periodic downloaded static route,

             D - EIGRP, EX - EIGRP external, E1 - OSPF external type 1 route, 

             E2 - OSPF external type 2 route, N1 - OSPF NSSA external type 1 route, 

             N2 - OSPF NSSA external type 2 route

      Gateway of last resort is not set

      S    10.134.0.0 is directly connected, Ethernet0

      S    10.10.0.0 is directly connected, Ethernet0

      S    10.129.0.0 is directly connected, Ethernet0

      S    172.30.0.0 is directly connected, Ethernet0

      S    172.40.246.0 is directly connected, Ethernet0

      S    172.20.97.0 is directly connected, Ethernet0

      S    172.50.88.0 is directly connected, Ethernet0

      S    172.19.141.0 is directly connected, Ethernet0

      S    172.60.138.0 is directly connected, Ethernet0

      S    192.44.237.0 is directly connected, Ethernet0

      S    192.168.222.0 is directly connected, Ethernet0

      S    172.90.209.0 is directly connected, Ethernet0

      S    10.145.0.0 is directly connected, Ethernet0

      S    10.141.0.0 is directly connected, Ethernet0

      S    10.138.0.0 is directly connected, Ethernet0

      S    10.128.0.0 is directly connected, Ethernet0

           172.19.0.0 255.255.255.0 is subnetted, 1 subnets

      C       172.19.64.0 is directly connected, Ethernet0

           172.110.0.0 is variably subnetted, 2 subnets, 2 masks

      C       172.110.232.32 255.255.255.240 is directly connected, Ethernet0

      S       172.110.0.0 255.255.0.0 is directly connected, Ethernet0

      Router#

      My problem:

       

      I don't see how it's possible to get that output.

      Let's read this again:

       

      In the following example, the logical AND operation is performed on the source address 128.0.0.0 and the mask 128.0.0.0, resulting in 128.0.0.0. Each destination in the routing table is also logically ANDed with the mask and compared to that result of 128.0.0.0. Any destinations that fall into that range are displayed in the output.

       

      For the subnets that start with 10 (decimal, not binary):

      The first octet in binary is 00001010. When you logically AND 00001010 with 1000000 (128), you get 00000000. The last 3 octets will all be zeros.

      So addresses that start with 10 (decimal, not binary), do NOT logically AND to 128.0.0.0, since, quite simply the 128s column in the first octet has a 0 for 10 (decimal, not binary). They logically AND to 0.0.0.0, and therefore should not be returned in the output, according to this explanation.

       

      Please advise.

       

      Catalyst52