Sunday, October 14, 2012

Classful routing with RIPv1.


Classful routing protocols such as RIPv1 don't send a subnet mask in their updates. All assumings based on the first bits of network and default classful network masks.
There are some rules for subnetted networks.
Rule #1: If a router (R1) sends an update about a subnetted classful network (10.10.0.0/24) to a router (R2), which is in the same classful major network (10.20.0.0/24), it sends subnetted network (10.10.0.0, not 10.0.0.0), and receiving router (R2) will apply the subnet mask of the interface on which it received an update (e0/0 - /24).
R2#sh ip route
     10.0.0.0/24 is subnetted, 2 subnets
R       10.10.0.0 [120/1] via 10.20.0.1, 00:00:13, Ethernet0/0
C       10.20.0.0 is directly connected, Ethernet0/0

Ok, it works. But what will happen if instead of 10.10.0.0/24 we will use 10.10.0.0/16?
Based on the first rule, we may assume that R2 will receive update to this subnet and apply its subnet mask to it. But reality is different:
R2#sh ip route
     10.0.0.0/24 is subnetted, 1 subnets
C       10.20.0.0 is directly connected, Ethernet0/0

There is no more subnet 10.10.0.0 at all.
R1#debug ip rip
RIP protocol debugging is on
R1#cle ip route *
R1#
*Mar  1 00:21:35.131: RIP: sending v1 flash update to 255.255.255.255 via Ethernet0/0 (10.20.0.1)
*Mar  1 00:21:35.131: RIP: build flash update entries - suppressing null update

This output means that there are no updates. R1 won't announce subnet 10.10.0.0/16.
Let's slightly change addressing:
The situation is the same again:
R2#sh ip route
     10.0.0.0/16 is subnetted, 1 subnets
C       10.20.0.0 is directly connected, Ethernet0/0

R2 doesn't receive this update because R1 doesn't announce it:
R1#debug ip rip
RIP protocol debugging is on
R1#cle ip route *
*Mar  1 00:24:54.595: RIP: sending v1 flash update to 255.255.255.255 via Ethernet0/0 (10.20.0.1)
*Mar  1 00:24:54.595: RIP: build flash update entries - suppressing null update

The reason for this behavior is not only because RIPv1 is a classful routing protocol, but it also doesn't support VLSM. It means that in a network where some classful network is divided in subnets with different subnet masks RIPv1 won't work properly.
Rule #2: If a router (R2) sends an update about a subnetted classful network (10.10.0.0/24, 10.20.0.0/24) to a router (R3), which is in other classful major network (192.168.0.0/24), is sends classful network update (10.0.0.0) receiving router (R3) will apply default classful mask to received update (10.0.0.0 has default classful mask 255.0.0.0). It is called summarisation on a network boundary.
R3#sh ip route
R    10.0.0.0/8 [120/1] via 192.168.0.1, 00:00:01, Ethernet0/1
C    192.168.0.0/24 is directly connected, Ethernet0/1
R1#sh ip route
     10.0.0.0/24 is subnetted, 2 subnets
C       10.10.0.0 is directly connected, Loopback0
C       10.20.0.0 is directly connected, Ethernet0/0
R    192.168.0.0/24 [120/1] via 10.20.0.2, 00:00:19, Ethernet0/0

Ok, let's consider this topology:
You may assume that R2 should install network 10.0.0.0 from R3 into its routing table. But it doesn't happen:
R2#sh ip route
     10.0.0.0/24 is subnetted, 2 subnets
R       10.10.0.0 [120/1] via 10.20.0.1, 00:00:12, Ethernet0/0
C       10.20.0.0 is directly connected, Ethernet0/0
C    192.168.0.0/24 is directly connected, Ethernet0/1

There is no such network, whereas R2 actually receives this update from R3:
R2#debug ip rip
RIP protocol debugging is on
*Mar  1 01:12:46.219: RIP: received v1 update from 192.168.0.2 on Ethernet0/1
*Mar  1 01:12:46.223:      10.0.0.0 in 1 hops

The reason is explained in this article (thanks to CLN):
 http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080093fd6.shtml
Long story short - R2 won't add 10.0.0.0/8 in its routing table from R3 because it already has subnets of this supernet from R1.
Interestingly enough that in Huawei's realisation of RIPv1 R2 will add 10.0.0.0/8 in the routing table. Output below is from Huawei NSP:

[Quidway]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 8        Routes : 8       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.0.0.0/8   RIP     100  1           D   192.168.0.2     Vlanif20
      10.10.0.0/24  RIP     100  1           D   10.20.0.1       Vlanif10
      10.20.0.0/24  Direct  0    0           D   10.20.0.2       Vlanif10
      10.20.0.2/32  Direct  0    0           D   127.0.0.1       Vlanif10
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.0.0/24  Direct  0    0           D   192.168.0.1     Vlanif20
    192.168.0.1/32  Direct  0    0           D   127.0.0.1       Vlanif20

No comments:

Post a Comment