Cryptheory – Just Crypto

Cryptocurrencies are our life! Get an Overview of Market News

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

3 min read

[ad_1]

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…..1.1.1.1, 100.4.5.6…………0~127

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

C……. 24 bit……… 8 bit…… 192.1.1.1, 222.1.2.3…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 100.4.5.6/8 /8 class A 100.0.0.0/8 100 4.5.6 16,777,216 100.4.5.6/16 /16 classless 100.4.0.0/16 100.4 5.6 65,536 100.4.5.6/24 /24 classless 100.4.5.0/24 100.4.5 6 256 100.4.5.6/25 /25 classless 100.4.5.0/25 100.4.5.0 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 200.1.2.0/24. Then the network grows to 500 computers. It needs a class B network, say 150.1.0.0/16. However, 150.1.0.0/16 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, 150.1.0.0/23 allows 512 host ID. It covers addresses 150.1.0.0~150.1.1.255).

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,

150.1.0.0 is a class B network address. Its default mask is /16. It covers 65,536 addresses.

150.1.2.0/24 is a classless subnet derived from class B network. Its mask is /24 and contains 256 addresses.

150.1.2.128/25 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

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

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

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

Q4. Can we subnetting to create 150.1.2.3/14? Answer: No. Subnetting starts with classful address scheme. 150.1.2.3 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 (150.1.2.3/25) with destination networks listed in routing table.

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

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

-150.1.1.0/24: 150.1.2.3/25’s left most 24 bit is 150.1. 2, not 150.1.1. Not a match.

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

– 150.1.2.0/25: 150.1.2.3/25’s left most 25 bit is 150.1.2.0. 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 *