Fundamentals 14 min read

Master IP Addressing: From Basics to Subnetting and VLSM

Starting from the basics of IPv4 address format, this guide explains class structures, binary‑decimal conversion, subnet masks, step‑by‑step subnet calculations, soft and hard planning rules, and introduces VLSM with a practical example, providing a comprehensive foundation for effective network address design.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master IP Addressing: From Basics to Subnetting and VLSM

1. IP Address Format

IP address is a 32‑bit binary identifier that uniquely marks a device on a network.

Features

Uniqueness : each address identifies one device at a time.

Structure : divided into network and host portions.

2. IP Address Classification

2.1 Components

An IPv4 address consists of four octets (0‑255) split into network and host parts.

Network part : identifies the subnet or network.

Host part : identifies the individual host.

2.2 Classes

IPv4 addresses are grouped into five classes (A‑E). The most common are A, B, and C.

IP class diagram
IP class diagram

Class A, B, C composition

Class A : network 8 bits, host 24 bits, range 1.0.0.0‑126.255.255.255

Class B : network 16 bits, host 16 bits, range 128.0.0.0‑191.255.255.255

Class C : network 24 bits, host 8 bits, range 192.0.0.0‑223.255.255.255

Private IP address ranges

Class A: 10.0.0.0‑10.255.255.255

Class B: 172.16.0.0‑172.31.255.255

Class C: 192.168.0.0‑192.168.255.255

2.3 Subnet Mask

Subnet mask determines the network portion of an address; it is a 32‑bit binary mask.

Network bits : represented by 1s.

Host bits : represented by 0s.

Logical AND between IP address and mask yields the network address.

AND rule: 0 & any = 0, 1 & any = any.

Default masks

Class A: 255.0.0.0

Class B: 255.255.0.0

Class C: 255.255.255.0

3. Binary and Decimal

3.1 Binary

Base‑2, digits 0 and 1, carries at two.

Conversion to decimal: sum of each bit multiplied by 2ⁿ (upper‑index method).

3.2 Decimal

Base‑10, digits 0‑9, carries at ten.

Conversion to binary: repeated division by 2, record remainders (remainder method).

4. IP Address Planning

4.1 Reasons for Subnetting

Meet different network size requirements.

Create hierarchical network structure.

Conserve address space.

4.2 Classful vs Classless Subnetting (CIDR)

Classful : fixed masks per class (A‑/8, B‑/16, C‑/24).

Classless (CIDR) : flexible mask lengths to fit actual needs.

4.3 Subnetting Principles

Example: split 192.168.1.0/24 into four subnets.

Move host bits to subnet bits.

Number of subnets = 2ⁿ (n = subnet bits).

Usable hosts per subnet = 2ᴺ‑2 (N = host bits).

4.4 Calculating Subnet and Broadcast Addresses

Example: 159.64.25.100/25.

Write IP in binary: 159.64.25.100 = 10011111.01000000.00011001.01100100 Subnet mask /25 binary: 11111111.11111111.11111111.10000000 (255.255.255.128)

Network address = IP AND mask → 10011111.01000000.00011001.00000000 → 159.64.25.0

Broadcast address = set host bits to 1 → 159.64.25.127

Subnet and broadcast example
Subnet and broadcast example

4.5 Soft and Hard Rules

Soft rules : guidelines for easier management, e.g., allocate separate /24 subnets per floor.

Hard rules : based on actual host counts and required subnets.

4.6 Planning Principles

Uniqueness : each address must be unique.

Scalability : allow future growth.

Continuity : keep address blocks contiguous.

Meaningfulness : addresses should reflect logical organization.

Important address types

Inter‑router (public) addresses.

Loopback (127.0.0.1).

Gateway address.

4.7 Variable Length Subnet Mask (VLSM)

Introduction

VLSM permits different mask lengths within the same network, improving address utilization and flexibility compared with Fixed Length Subnet Mask (FLSM).

Advantages

Higher address utilization.

Greater flexibility for varied subnet sizes.

More efficient routing tables.

Implementation Steps

Determine subnet requirements (host count per subnet).

Calculate appropriate mask for each subnet.

Divide the original network into subnets using the calculated masks.

Assign IP blocks to each subnet.

Example

Network 192.168.1.0/24 split into four subnets with host requirements 50, 20, 10, 5.

Subnet1 needs 6 host bits → /26 → 192.168.1.0‑63

Subnet2 needs 5 host bits → /27 → 192.168.1.64‑95

Subnet3 needs 4 host bits → /28 → 192.168.1.96‑111

Subnet4 needs 3 host bits → /29 → 192.168.1.112‑119

VLSM vs FLSM

Mask length : VLSM uses varied lengths; FLSM uses a single length.

Address utilization : VLSM high, FLSM low.

Flexibility : VLSM high, FLSM low.

Complexity : VLSM higher.

Suitable scenarios : VLSM for complex, diverse networks; FLSM for simple, uniform networks.

Summary

Understand IP address format and class structure.

Know private address ranges and default subnet masks.

Convert between binary and decimal representations.

Grasp reasons and methods for subnetting, including soft/hard rules.

Apply planning principles and consider VLSM for efficient address use.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

network fundamentalsnetwork planningCIDRSubnettingVLSMbinary conversionIP addressing
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.