Classless InterDomain Routing (CIDR)

This topic is to discuss the following lesson:

Rene,

Hello, the command “ip classless” is something I have always seen on Cisco routers but never understood what it does. Can you explain this command?

Thanks,

Chris

Hi Chris,

Good question, nowadays we don’t really have to think about it but there’s a difference between classful and classless routing. I just created an example for it:

https://networklessons.com/ip-routing/cisco-ip-classless-command/

Rene

Hi Rene,

Question- does the subnet mask dictate the class of the network or the value of the octets? It seems here in this example that the subnet mask would dictate whether it was class A, B or C. However I was recently advised that it is not the subnet mask for example it has been recently stated to me:

The class of a network is not determined by its subnet mask. The default subnet mask is determined by the class of a network. The class of a network is determined by the first octet of the IP.

0-127 is considered “class A”.
128-191 is considered “class B”.
192-223 is considered “class C”.
224-239 is considered “class D”.
240-255 is considered “class E”.

So, referring back to my previous example, 171.15.85.0/24 is a “class B” address. The network mask which is used doesn’t matter. What matters is the first octet of the IP. In this case, since we are using a /24 mask, we have “subnetted” the class B address.

I am looking for your insight on this. Thank you for your thoughts.

James,
Only the first four bits (3 really, since E class isn’t used) in the first octet determine class (as shown in the table below). You are correct in your example about 171.15.85.0/24.

Keep in mind, however, that “class” doesn’t really mean anything anymore. This is an outdated term that nobody really uses now. Even Cisco has stopped bothering to test on it!

Binary (first 4 bits) Class
0000                   A
1000                   B
1100                   C
1110                   D
1111                   E

Hi Rene,

What do you mean by CIDR & VLSM ? The both are same or what is the difference between them.

Br
Zaman

Zaman,
These can be easily confused–in fact I had to review them myself to make sure I am giving you accurate information.

VLSM is aptly named, because it means using a subnet mask of variable lengths throughout your organization with the same network block. For example, suppose your ISP has given you 10.10.10.0/24 as an IP range. Without VLSM, you would have to pick a certain subnet mask, say, 255.255.255.240 (/28) and stick with that. So if you wanted to use this block throughout your company, you would always have to use /28. This becomes wasteful in the case where you have a subnet with just two hosts, or it becomes inadequate where you have a subnet with 50 hosts. With VSLM, you have the freedom to change your subnet mask as needed, so in the case of a subnet with two hosts, you could use 10.10.10.248/30, for example, and with a subnet having 50 hosts, you could use 10.10.10.0/26, for example.

CIDR is basically “supernetting.” This is where you can aggregate networks together into larger networks beyond their natural network boundary. For example, suppose I have 192.168.0.0/24 and 192.168.1.0/24. These networks have a natural /24 boundary (because they are class C addresses), but I can using CIDR aggregate them via 192.168.0.0/23

Thanks Andrew…,

Here my summary:

• 255.0.0.0 /8 (8 bits Network, 24 bits Hosts = 2^24 = 256256256 = 16.777.216-2)
• 255.128.0.0 /9 (8+1 = 9 bits Network, 23 bits Hosts = 2^23 = 128256256 = 8.388.608-2)
• 255.192.0.0 /10 (8+2 = 10 bits Network, 22 bits Hosts = 2^22 = 64256256 = 2.097.152-2)
• 255.224.0.0 /11 (8+3 = 11 bits Network, 21 bits Hosts = 2^21 = 32256256 = 2.097.152-2)
• 255.240.0.0 /12 (8+4 = 12 bits Network, 20 bits Hosts = 2^20 = 16256256 = 1.048.576-2)
• 255.248.0.0 /13 (8+5 = 13 bits Network, 19 bits Hosts = 2^19 = 8256256 = 524.288-2)
• 255.252.0.0 /14 (8+6 = 14 bits Network, 18 bits Hosts = 2^18 = 4256256 = 262.144-2)
• 255.254.0.0 /15 (8+7 = 15 bits Network, 17 bits Hosts = 2^17 = 2256256 = 131.072-2)
• 255.255.0.0 /16 (8+8 = 16 bits Network, 16 bits Hosts = 2^16 = 1256256 = 65.536-2)
• 255.255.128.0 /17 (8+8+1 = 17 bits Network, 15 bits Hots = 2^15 = 128256 = 32768-2)
• 255.255.192.0 /18 (8+8+2 = 18 bits Network, 14 bits Hots = 2^14 = 64
256 = 16384-2)
• 255.255.224.0 /19 (8+8+3 = 19 bits Network, 13 bits Hots = 2^13 = 32256 = 8192-2)
• 225.225.240.0 /20 (8+8+4 = 20 bits Network, 12 bits Hots = 2^12 = 16
256 = 4096-2)
• 255.255.248.0 /21 (8+8+5 = 21 bits Network, 11 bits Hots = 2^11 = 8256 = 2048-2)
• 255.255.252.0 /22 (8+8+6 = 22 bits Network, 10 bits Hots = 2^10 = 4
256 = 1024-2)
• 255.255.254.0 /23 (8+8+7 = 23 bits Network, 9 bits Hots = 2^9 = 2256 = 512-2)
• 255.255.255.0 /24 (8+8+8 = 24 bits Network , 8 bits Hots = 2^8 = 1
256 = 256-2)
• 255.255.255.128 /25 (8+8+8+1= 25 bits Network , 7 bits Hots = 2^7 = 128 = 128-2)
• 255.255.255.192 /26 (8+8+8+2= 26 bits Network , 6 bits Hots = 2^6 = 64 = 64-2)
• 255.255.255.224 /27 (8+8+8+3= 27 bits Network , 5 bits Hots = 2^5 = 32 = 32-2)
• 255.255.255.240 /28 (8+8+8+4= 28 bits Network , 4 bits Hots = 2^4 = 16 = 16-2)
• 255.255.255.248 /29 (8+8+8+5= 29 bits Network , 3 bits Hots = 2^3= 8 = 8-2)
• 255.255.255.252 /30 (8+8+8+6= 30 bits Network , 2 bits Hots = 2^2= 4 = 4-2)

Hi Rene and team,

Can you please explain the real time use case of /31. where it is used, how will it work. in which scenarios can we use /31. please explain with simple diagram.

Hello Rahul

This is an excellent question. As you know, a /31 address space provides only two addresses. However, since all subnets need a network address and a broadcast address, such a network seems unusable, since the only two addresses available must be used for network and broadcast. There are no available host addresses. However, vendors including Cisco have supported the use of /31 addresses for a while now. Because they are used only for point to point links, the two available addresses can be assigned to hosts. For example, if you have 192.168.1.2/31, then you can assign 192.168.1.2 to one end of a link and 192.168.1.3 to the other. There is no need for a network or broadcast address. If you try it on both serial or ethernet ports on a Cisco device, it should work (assuming the IOS or the emulator (GNS3, PacketTracer) supports it). Indeed, if you assign such an address, you may even see an ominous warning message like so:

Router(config)# interface f0/0
Router(config-if)# ip address 10.0.0.0 255.255.255.254
% Warning: use /31 mask on non point-to-point interface cautiously

But it will work. This has been done to avoid the unnecessary wastage of IP addresses in the event that you have many point to point links and you’re using public addresses.

I hope this has been helpful!

Laz

Excellent answer Laz. Really nice explanation

1 Like