cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6658
Views
35
Helpful
12
Replies

Difference Between Classful and Classless Routing

turbo_engine26
Level 4
Level 4

Hi There,

I have a hard time understanding the difference between classful and classless routing. I understand that classful routing protocols don't carry subnet mask information in their updates which in turn don't support VLSM. This means (as i understood so far) that these protocols understands only classfull subnets such as A,B and C classes. However, one of the CCIE books specifically in the RIP v1 section, mentioned a diagram with different subnet masks and RIP v1 just worked fine. This is strange because RIP v1 is a classful protocol , so how come it can route between different subnet masks? ... Maybe my question is wrong depending on how much i understand so please forgive my confusion.

Also, i uploaded the diagram's picutre for you. This picture was taken from the GNS3 network simulator.

As you see, /27 and /24 subnet masks are used in the diagram and RIP v1 is routing between them.

My humble understanding to Classfull routing assumes that all the networks in this diagram should be only 1 subnet mask to be used.

Please advise.

Thanks for your patience and support.

3 Accepted Solutions

Accepted Solutions

Hello,

All right, let's have a look at your diagram.

RTA and RTB have all their interfaces inside the major network 192.168.2.0/24:

RTA: 192.168.2.96/27, 192.168.2.192/27

RTB: 192.168.2.64/27, 192.168.2.192/27

For example, when RTA advertises the network 192.168.2.96/27, it sends it out the interface in the network 192.168.2.192/27. Because both the advertised network and the interface through which the advertisement is sent are in the same major network (192.168.2.0/24), the network 192.168.2.96 will be advertised as is, i.e. no modification to the address will be done. Note that the netmask will not be actually advertised because neither RIPv1 nor IGRP advertise netmasks along with networks.

RTB and RTC will receive this advertisement, and because - again - this advertisement comes through an interface which is in the same major network (192.168.2.0/24) as the network 192.168.2.96 in this advertisement, this network will be added to RTB's and RTC's routing table with the subnet mask borrowed from the incoming interface, which is obviously /27.

So RTC will know networks 192.168.2.64/27, 192.168.2.96/27, 192.168.2.192/27, and it will try to advertise them to RTD. However, the link between RTC and RTD is in the network 192.168.3.0/24 - a different major network than the aforementioned subnets. Therefore, RTC will not advertise the three individual networks to RTD, rather, it will simply replace them by the major network under which they belong - 192.168.2.0. Again, note that there is no netmask advertised.

RTD will learn about the network 192.168.2.0 from RTC. However, this network comes through an interface in the major network 192.168.3.0/24 - a different major network than the advertised network. So RTD will assume a classful mask to the received network which is obviously /24, as 192.168.2.0 is a C-class network.

RTE and RTF have a difficult position. They both have a local subnet allocated from the major network 192.168.5.0/24 but the network that interconnects RTE and RTF is in a different major network: 192.168.4.0/24. Both RTE and RTF will therefore advertise the entire major network 192.168.5.0 to each other.

Now, an additional sanity check comes in: If a router learns about a classful network through an interface in a different major network, and it already knows some subnets of the received network learned from other interfaces, it drops the update. Why? Because as I said, in a classful world, the owner of a classful network can be only a single subject, and the networks are hence located "in one place" - in a single company. It would be illogical to learn about our own networks from a foreign world. This is considered a misconfiguration in the classful world, and therefore such update is dropped.

So in practical means, RTF receives a network 192.168.5.0 via its interface in 192.168.4.0/24. However, RTF already knows about the subnet 192.168.5.96/27, and it wonders: "How is it possible that the outside world advertises my own network to me? That can't be - I am supposed to be the only owner of the entire range 192.168.5.0/24, and if I do not know about some subnet then it does not exist at all!" And because of this sanity check, RTF (and vice versa RTE) drops this advertisement. Hence, neither RTE nor RTF will learn about the network 192.168.5.0/24 from each other, and therefore they cannot reach themselves.

You may find the following Cisco document also enlightening on this subject:

http://www.cisco.com/en/US/tech/tk364/technologies_tech_note09186a0080093fd8.shtml

Please feel welcome to ask further!

Best regards,

Peter

View solution in original post

At the risk of butting in again !, yes you are right. 192.168.2.0 shows as subnets because the interconnecting link between RTA/RTB/RTC is also using a 192.168.2.x/27 network. So you have used the same subnet mask ie. 255.255.255.224 on all the 192.168.2.x networks and there is no other major network separating any of these 192.168.2.x/27 networks.

Compare this to RTD/RTE/RTF where you have 192.168.5.x/27 networks separated by a 192.168.4.0/24 network.

Jon

View solution in original post

Hello,

No need to apologize. And Jon absolutely deserves all the credit!

Regarding the classless routing protocols - well, they are actually very easy because they do not have any of those cranky assumptions about major networks and constant subnetting mask and guessing the netmask of an advertised network...

Simply and plainly, classless routing protocols always advertise both network and its netmask. They do not assume that you get an entire major network when you ask for an IP address space. They do not assume that you are subnetting the assigned range with a constant mask. They do not assume that the address classes are used at all. In other words, they assume nothing, and they advertise all the details. By this approach, they completely eliminate all ambiguosities because instead of guessing or inferring a netmask, the netmask is always explicitly stated within the routing protocol update.

There is only a single remainder of the classful protocol in the classless protocol: something we call automatic summarization. It is actually something what we have already spoken about: if a router is going to advertise a network from major network X out an interface connected to major network Y (X is different from Y), then the router will advertise only the major network X instead of the original subnet. This was done also in classful protocols. The main difference in classless protocols is twofold: even if automatically summarized network is advertised, the update will contain the network's netmask, and second, this automatic summarization can be deactivated. In classful protocols, this was not possible.

So if I got back to your diagram, if we used any classless routing protocol with auto-summarization turned off, things would be extremely simple. Each and every router would advertise all directly connected and learned networks exactly as they are - no mangling with addresses/netmasks, no summarization, no hidden modification, no sanity checks and optional refusals to accept an update. Indeed, very simple - do not try to find any gotcha here.

If we used a classless routing protocol with active auto-summary, RTC would summarize the subnets from the RTA and RTB into 192.168.2.0/24 when sending them to RTD. RTE and RTF would still both advertise 192.168.5.0/24 which would be an unpleasant thing:

  • RTD would see two paths to 192.168.5.0/24, one via RTE, second via RTF. This could potentially cause reachability issues.
  • RTE and RTF would both have its local 192.168.5.?/? subnet in the routing table along with 192.168.5.0/24 advertised from the other router (in contrast to classful protocols, there is no refusal to accept a routing update in classless protocols). As a result, they would be able to talk to each other in this particular topology. But if there were more routers similar to RTE and RTF, they would again be confused in a way similar to RTD.

In retrospect, classful routing protocols are much less clear, very opinionated and very specific in how they advertise networks and derive netmasks. Classless protocols do not have any of those mannerisms - they simply advertise what they know, and perhaps auto-summarize it along the way, nothing more.

Best regards,

Peter

View solution in original post

12 Replies 12

Peter Paluch
Cisco Employee
Cisco Employee

Hello,

What you are asking about is the difference between classful and classless routing protocols. Classful/classless routing (or sometimes more precisely called routing behavior is something related but different).

Classful routing protocols work according to a set of assumptions:

  • In those times when classful routing protocols were used, if you asked an authority for a network, you got the entire network from a particular class, say, 87.0.0.0/8, 158.193.0.0/16 or 213.81.187.0/24. You were never assigned only a part of this network - if you got it, you got it in its entirety, and you were its sole owner. We call this a major network - an undivided, unsubnetted network with the mask according to its class.
  • If you subnetted this major network inside your company, you always used the same subnet mask, in effect creating equally-sized subnets. Subnetting a major network into differently sized subnets was simply not the practice used back then. It meant in consequence that all interfaces addressed from the same major network used the same netmask, both on routers and on end devices.
  • If a classful routing protocol wanted to advertise a network through an interface, it made a following decision process: Is the advertised network in the same major network as the interface through which it is going to be advertised?
    • If yes, advertise the network as is.
    • If it is not, advertise just the major network instead of the network-to-be-advertised. This logic follows the idea that if an interface is in a different major network than the network being advertised, then it means that the update is crossing a boundary between your company and the outside world. In that case, it does not make sense to advertise your individual subnets. It is completely sufficient to advertise your entire major network. You are, after all, its sole owner.
  • If a classful routing protocol received an update through an interface, it again made a decision process: Is the received network in the same major network as the interface that received the update?
    • If yes, assume the mask of the receiving interface as the subnet mask of the received route. You can safely do this because you are following the principle that all subnets of the same major net are using the same netmask.
    • If not, then it means that the network describes someone else's network, in which case - see the previous step - the network has already been summarized to the major network. In that case, simply assign the netmask according to the class of the received network.

Note that the classful routing protocol was in effect guessing the netmasks - if you were in the same major network, it used your interfaces' netmasks, and if the update crossed a major network boundary, then the classful mask was assumed.

Let me at this point stop the explanation, and let me simply let you digest it and wait till you have further questions or believe you understand the point behind this. Then I will be able to explain why your topology will have slight reachability issues between RTE and RTF while other routes should be reachable.

Best regards,

Peter

Thanks Peter for the valuable and expert explanation.

I can't say that i fully digested the previous explanation since it is all thoery. I appreciate if you can explain this practically in my diagram better. By this way, i beleive i can understand it quickly.

By the way, i solved the reachability issue between RTE and RTF by using secondary ip addresses on their existing links. However, i'll be glad if you can explain to me the issue from your point of view and why the 192.168.5.0 networks are discontiguous.

Thanks a lot for your help.

Hello,

All right, let's have a look at your diagram.

RTA and RTB have all their interfaces inside the major network 192.168.2.0/24:

RTA: 192.168.2.96/27, 192.168.2.192/27

RTB: 192.168.2.64/27, 192.168.2.192/27

For example, when RTA advertises the network 192.168.2.96/27, it sends it out the interface in the network 192.168.2.192/27. Because both the advertised network and the interface through which the advertisement is sent are in the same major network (192.168.2.0/24), the network 192.168.2.96 will be advertised as is, i.e. no modification to the address will be done. Note that the netmask will not be actually advertised because neither RIPv1 nor IGRP advertise netmasks along with networks.

RTB and RTC will receive this advertisement, and because - again - this advertisement comes through an interface which is in the same major network (192.168.2.0/24) as the network 192.168.2.96 in this advertisement, this network will be added to RTB's and RTC's routing table with the subnet mask borrowed from the incoming interface, which is obviously /27.

So RTC will know networks 192.168.2.64/27, 192.168.2.96/27, 192.168.2.192/27, and it will try to advertise them to RTD. However, the link between RTC and RTD is in the network 192.168.3.0/24 - a different major network than the aforementioned subnets. Therefore, RTC will not advertise the three individual networks to RTD, rather, it will simply replace them by the major network under which they belong - 192.168.2.0. Again, note that there is no netmask advertised.

RTD will learn about the network 192.168.2.0 from RTC. However, this network comes through an interface in the major network 192.168.3.0/24 - a different major network than the advertised network. So RTD will assume a classful mask to the received network which is obviously /24, as 192.168.2.0 is a C-class network.

RTE and RTF have a difficult position. They both have a local subnet allocated from the major network 192.168.5.0/24 but the network that interconnects RTE and RTF is in a different major network: 192.168.4.0/24. Both RTE and RTF will therefore advertise the entire major network 192.168.5.0 to each other.

Now, an additional sanity check comes in: If a router learns about a classful network through an interface in a different major network, and it already knows some subnets of the received network learned from other interfaces, it drops the update. Why? Because as I said, in a classful world, the owner of a classful network can be only a single subject, and the networks are hence located "in one place" - in a single company. It would be illogical to learn about our own networks from a foreign world. This is considered a misconfiguration in the classful world, and therefore such update is dropped.

So in practical means, RTF receives a network 192.168.5.0 via its interface in 192.168.4.0/24. However, RTF already knows about the subnet 192.168.5.96/27, and it wonders: "How is it possible that the outside world advertises my own network to me? That can't be - I am supposed to be the only owner of the entire range 192.168.5.0/24, and if I do not know about some subnet then it does not exist at all!" And because of this sanity check, RTF (and vice versa RTE) drops this advertisement. Hence, neither RTE nor RTF will learn about the network 192.168.5.0/24 from each other, and therefore they cannot reach themselves.

You may find the following Cisco document also enlightening on this subject:

http://www.cisco.com/en/US/tech/tk364/technologies_tech_note09186a0080093fd8.shtml

Please feel welcome to ask further!

Best regards,

Peter

Sorry Peter, thought you might have clocked off for the evening

Hello Jon,

I am still around but mostly awaiting your inputs Your joining in this thread is most welcome and appreciated!

Best regards,

Peter

Peter, you just pulled my "WoW" out of me, Excellent explanation!

Sorry about posting my last post without seeing yours as i need always to refresh my browser to see new replies.

I confirm now that i understood the classful routing.

Now, to digest this topic more, can you explain to me classless routing in the diagram as well? .. I just want to fully understand the difference between them. Sometimes, in order to fully understand something, you need to read about another thing to show you what was the first thing talk about.

Appreciate your help.

Hello,

No need to apologize. And Jon absolutely deserves all the credit!

Regarding the classless routing protocols - well, they are actually very easy because they do not have any of those cranky assumptions about major networks and constant subnetting mask and guessing the netmask of an advertised network...

Simply and plainly, classless routing protocols always advertise both network and its netmask. They do not assume that you get an entire major network when you ask for an IP address space. They do not assume that you are subnetting the assigned range with a constant mask. They do not assume that the address classes are used at all. In other words, they assume nothing, and they advertise all the details. By this approach, they completely eliminate all ambiguosities because instead of guessing or inferring a netmask, the netmask is always explicitly stated within the routing protocol update.

There is only a single remainder of the classful protocol in the classless protocol: something we call automatic summarization. It is actually something what we have already spoken about: if a router is going to advertise a network from major network X out an interface connected to major network Y (X is different from Y), then the router will advertise only the major network X instead of the original subnet. This was done also in classful protocols. The main difference in classless protocols is twofold: even if automatically summarized network is advertised, the update will contain the network's netmask, and second, this automatic summarization can be deactivated. In classful protocols, this was not possible.

So if I got back to your diagram, if we used any classless routing protocol with auto-summarization turned off, things would be extremely simple. Each and every router would advertise all directly connected and learned networks exactly as they are - no mangling with addresses/netmasks, no summarization, no hidden modification, no sanity checks and optional refusals to accept an update. Indeed, very simple - do not try to find any gotcha here.

If we used a classless routing protocol with active auto-summary, RTC would summarize the subnets from the RTA and RTB into 192.168.2.0/24 when sending them to RTD. RTE and RTF would still both advertise 192.168.5.0/24 which would be an unpleasant thing:

  • RTD would see two paths to 192.168.5.0/24, one via RTE, second via RTF. This could potentially cause reachability issues.
  • RTE and RTF would both have its local 192.168.5.?/? subnet in the routing table along with 192.168.5.0/24 advertised from the other router (in contrast to classful protocols, there is no refusal to accept a routing update in classless protocols). As a result, they would be able to talk to each other in this particular topology. But if there were more routers similar to RTE and RTF, they would again be confused in a way similar to RTD.

In retrospect, classful routing protocols are much less clear, very opinionated and very specific in how they advertise networks and derive netmasks. Classless protocols do not have any of those mannerisms - they simply advertise what they know, and perhaps auto-summarize it along the way, nothing more.

Best regards,

Peter

Hello,

Apologies for the late reply as my keyboard had a malfunction so i couldn't post my reply earlier.

Thanks a lot for your help regarding classful and classless routing explanation. I learned a lot from this useful thread.

Have a nice day

It doesn't work without secondary addressing because of this part of Peter's excellent explanation -

If a classful routing protocol wanted to advertise a network through an interface, it made a following decision process: Is the advertised network in the same major network as the interface through which it is going to be advertised?

  • If yes, advertise the network as is.
  • If it is not, advertise just the major network instead of the network-to-be-advertised. This logic follows the idea that if an interface is in a different major network than the network being advertised, then it means that the update is crossing a boundary between your company and the outside world. In that case, it does not make sense to advertise your individual subnets. It is completely sufficient to advertise your entire major network. You are, after all, its sole owner.

ie. RTE advertises 192.168.5.0/24 and so does RTF because for both routers the advertisement is being done out of the 192.168.4.x interface with a /24 mask. So both routers summarise 192.168.5.x to it's major network.

If you did a "sh ip ro" on RTD you should actually see 2 routes to 192.168.5.0/24 via both RTE and RTF which clearly wouldn't work very well as RTC has no way of knowing where to send specific 192.168.5.x traffic to.

Jon

I think i got what you meant when you said the below notes:

"If a classful routing protocol wanted to advertise a network through an  interface, it made a following decision process: Is the advertised  network in the same major network as the interface through which it is  going to be advertised?

  • If yes, advertise the network as is.
  • If  it is not, advertise just the major network instead of the  network-to-be-advertised. This logic follows the idea that if an  interface is in a different major network than the network being  advertised, then it means that the update is crossing a boundary between  your company and the outside world. In that case, it does not make  sense to advertise your individual subnets. It is completely sufficient  to advertise your entire major network. You are, after all, its sole  owner."

After routing table entries inspection, i found that any network which is not in the same major network as the interface being advertised to, shown as classful network not the exact subnet.

For instance, see the below route table in RTA

RTA#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

       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

R    192.168.5.0/24 [120/1] via 192.168.2.194, 00:00:18, FastEthernet0/0

     192.168.2.0/27 is subnetted, 3 subnets

C       192.168.2.96 is directly connected, FastEthernet0/1

R       192.168.2.64 [120/1] via 192.168.2.195, 00:00:25, FastEthernet0/0

C       192.168.2.192 is directly connected, FastEthernet0/0

R    192.168.3.0/24 [120/1] via 192.168.2.194, 00:00:18, FastEthernet0/0

RTA#

Because 192.168.5.0 and 192.168.3.0 are remote networks (not as the major network of RTA), they are shown as C major class addresses with /24 masks. However, because the 192.168.2.0 is in the same major network as RTA, it shows the 192.168.2.64 as a subnetted entry not major.

Am i right? did i understand it in a right way?

Thanks a lot

At the risk of butting in again !, yes you are right. 192.168.2.0 shows as subnets because the interconnecting link between RTA/RTB/RTC is also using a 192.168.2.x/27 network. So you have used the same subnet mask ie. 255.255.255.224 on all the 192.168.2.x networks and there is no other major network separating any of these 192.168.2.x/27 networks.

Compare this to RTD/RTE/RTF where you have 192.168.5.x/27 networks separated by a 192.168.4.0/24 network.

Jon

Many thanks also to Jon who came to share valuable opinions in this thread.

Review Cisco Networking for a $25 gift card