Cryptheory: Crypto and Internet

cryptocurrency, internet and AI meaning, guides, learning

IP Subnetting Tutorial (Classless) – With Interactive Examples and Simulation 5

3 min read

Q1. What is classless IP address?

Answer: Classless is also called IP subnetting. It divides classful network addresses into smaller networks (subnet). The rules are simple: – In classful addressing scheme, a 32 bit address is divided into Network ID and Host ID in 8-bIt boundary:

Class Network_ID Host_ID Examples……………..Leftmost_byte_range(a.b.c.d)

A……….8 bit……. 24 bit…..,…………0~127

B………16 bit…… 16 bit……,…..128~191

C……. 24 bit……… 8 bit……,…192~223

– Classless IP allows more left bits for network ID (and fewer bits for host ID). The number of bits used by

network ID is called network mask. For example, a.b.c.d/m says “network ID is the leftmost m bit.” – Examples of classful and classless addresses:

IP address Mask Class? Network address Network ID Host ID Number of hosts in this network /8 class A 100 4.5.6 16,777,216 /16 classless 100.4 5.6 65,536 /24 classless 100.4.5 6 256 /25 classless 6 128

Q2. Why classless?

Answer: Using fixed boundary to allocate bits for network ID and hosts ID results side effects: IP address starvation. Consider this example: A network has 100 computers to be connected to Internet. They are using a class C network Then the network grows to 500 computers. It needs a class B network, say However, covers 65,536 class B IP addresses. This network only uses 500 of them. 65,036 IP addresses are wasted. This causes the shortage of IP address due classful addressing scheme’s fixed networ/host boundary. This problem can be solved by classless addressing. For example, allows 512 host ID. It covers addresses

Q3. How to subnetting and creates network ID crossing byte boundary?

Answer: Subnetting uses network mask to allocate leftmost bits for network ID. The rules are simple: – Start with a classful address (class A, B, or C). – Add more bits to the classful network ID bits. Class B uses leftmost 16 bits for network ID. Its mask is /16. With classless addressing, the network mask for class B derived network can be /16~.31. – For example, is a class B network address. Its default mask is /16. It covers 65,536 addresses. is a classless subnet derived from class B network. Its mask is /24 and contains 256 addresses. is a classless subnet derived from a class B network. Its mask is /25 and has 128 addresses. The table below presents classful and classless addresses in binary form:

Network ID/Mask Binary form (32 bits) Network ID/class Number of host ID and range

– is a class B address, network ID 150.1 (16 bit), contains 65,356 hosts, (, Its binary presentation is 10010110. 00000001.00000000.00000000

– is classless derived from class B, network ID 150.1.2 (24 bits), contains 256 host addresses ( ). Its binary form is 10010110. 00000001.00000010.00000000.

– is classless derived from class B, network ID is (25 bit), contains 128 host addresses ( its binary form is 10010110. 00000001.00000010.10000000

Q4. Can we subnetting to create Answer: No. Subnetting starts with classful address scheme. is a class B address (150 is within class B range: 128~191). Class B network mask is /16. Subnetting a class B network address can only use masks to reduce the size of network, or increase the mask. /16~/21 are allowed. /1~/15 are not allowed.

Q5. How does a router lookup a classless IP address?

Answer: Let’s use examples to explain router’s operations: 1) When R1 receives ping sent by Jack, it compares ping’s destination IP address ( with destination networks listed in routing table.

–’s left most 8 bit is 150, not 100. Not a match.

–’s left most 16 bit is 150.1. It’s a match. R1 forwards ping to 2) When R2 receives ping, it compares ping’s destination IP address ( with routing table’s destination networks. -’s left most 24 bit is 150.1. 2, not 150.1.0. Not a match.

-’s left most 24 bit is 150.1. 2, not 150.1.1. Not a match.

-’s left most 24 bit is 150.1. 2. It’s a match. R2 forward ping to network 3) When R3 receives ping, it compares ping’s destination IP address ( with routing table. -’s left most 25 bit is 2, not, Not a match.

–’s left most 25 bit is A match. R3 forwards ping to Rose.

Note: This example is more clear if read together with topology from the companion simulation.

This article is the FAQ of an interactive simulation. You may get more clear concepts by playing the simulation with visualized topology, packets, table. It is located under External links.

Ishun Chang

All content in this article is for informational purposes only and in no way serves as investment advice. Investing in cryptocurrencies, commodities and stocks is very risky and can lead to capital losses.

Leave a Reply

Your email address will not be published. Required fields are marked *