Most of the books say that Classful routing protocol does not support classless subnets which is not 100% true, as they can send/receive some subnets even without its Mask. I am taking an example of RIPv1. This is a well-known fact that RIPv1 is a classful routing protocol hence MASK information does not travel with routing updates. RIPv1 does not support VLSM, its true. But it can transport classless subnets over the network.
Lets take a very simple example where I am using 2 RIP routers directly connected as shown in the figure:
Here 10.0.0.0/24 is the IP of the link between R1 and R2. All the other IPs mentioned are loopback IPs on respective routers.
I have configured RIP vs 1 on both the routers as shown below:
R1#sh ip int brie
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
GigabitEthernet1/0 10.0.0.1 YES manual up up
Loopback1 10.1.1.1 YES manual up up
Loopback2 10.1.2.1 YES manual up up
router rip
network 10.0.0.0
__________________________________________________________________________________
R2#sh ip int brie
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
GigabitEthernet1/0 10.0.0.2 YES manual up up
Loopback1 10.2.1.1 YES manual up up
Loopback2 10.2.2.2 YES manual up up
router rip
network 10.0.0.0
________________________________________________________________________________
Now lets have a look at routing table of both the routers:
R1#sh 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, E - EGP 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
10.0.0.0/24 is subnetted, 5 subnets
R 10.2.1.0 [120/1] via 10.0.0.2, 00:00:16, GigabitEthernet1/0 <<<<--------
C 10.1.2.0 is directly connected, Loopback2
C 10.1.1.0 is directly connected, Loopback1
C 10.0.0.0 is directly connected, GigabitEthernet1/0
R2#sh 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, E - EGP 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
10.0.0.0/24 is subnetted, 5 subnets
C 10.2.1.0 is directly connected, Loopback1
R 10.1.2.0 [120/1] via 10.0.0.1, 00:00:04, GigabitEthernet1/0 <<<---------
C 10.2.2.2 is directly connected, Loopback2
R 10.1.1.0 [120/1] via 10.0.0.1, 00:00:04, GigabitEthernet1/0 <<<---------
C 10.0.0.0 is directly connected, GigabitEthernet1/0
So it can be easily noticed that R1 and R2 are installing classless routes(marked with arrows) in their routing table.
Reason for this behavior:
When a classful routing protocol sends a routing update it compares the route(which router wants to send) with its outgoing interface IP and if the major network number of the route and outgoing interface is same, It will compare the subnet mask and if that also matches, it will send the route as it is. And if any of the above 2 conditions fail to match, router will summarize the network to its major network number and will send it.
It’s not only the sending router which is responsible for this behavior, receiving router also performs some action to complete this transaction.
Receiving router checks the route received to its incoming interface IP. If Major network number is same, it will install the route in its routing table with subnet mask of the incoming interface and if major network number is different, it will summarize the route to its major network number. No question of matching the MASK as mask is not carried in classful routing protocols.
Example:
In above example, R1 is transmitting 10.1.1.0/24 on the link 10.0.0.0/24. Both major network number and mask matches, hence a subnetted update i.e. 10.1.1.0(with no mask) will be advertised. Receiving router will compare the route 10.1.1.0 to its incoming interface IP 10.0.0.0/24 and since major network number matches, it will install the route as 10.1.1.0/24.
Please note that 10.2.2.2/32 is not observed in routing table of R1 because of subnet mask mismatch.
That’s all the logic behind this behavior of Classful IP routing protocols.
Note: Auto summarization command can be used in RIPv1 but it does not have any impact on routing decisions.