TCP/IP Concepts   «Prev  Next»

Lesson 7 IP address Conventions
Objective What is the Structure of an IP Address?

Structure of an IP Address

IP Addressing and Netmasks (IPv4 | IPv6)

This lesson modernizes IP addressing concepts for today’s Linux and hybrid cloud environments. We replace legacy classful rules with CIDR (Classless Inter-Domain Routing), clarify how prefix lengths (e.g., /24, /64) actually work, and align examples with current best practices (e.g., private ranges, link-local, loopback, and IPv6 conventions).

IPv4 vs IPv6: Structure | Notation

CIDR: Network and Host (Modern Replacement for Class A/B/C)

Instead of fixed classes, CIDR uses a prefix length to define how many leading bits compose the network. The remainder belong to hosts (or subnets if you further partition). For example, 10.20.30.40/23 means the first 23 bits are the network; the last 9 bits vary per host.


# Convert between dotted masks and prefix lengths
# 255.255.255.0  → /24
# 255.255.254.0  → /23
# 255.255.252.0  → /22

# Linux quick checks
ip addr show         # list IPv4/IPv6 addresses, prefixes, MACs
ip route show        # view routes and connected prefixes

Key IPv4 Conventions (Updated)

Essential IPv6 Conventions

Subnetting with CIDR (IPv4)

Subnetting divides a larger prefix into smaller ones. With 192.168.50.0/24, splitting into four equal subnets yields /26 blocks:


192.168.50.0/26    → usable hosts .1–.62,  broadcast .63
192.168.50.64/26   → usable hosts .65–.126, broadcast .127
192.168.50.128/26  → usable hosts .129–.190, broadcast .191
192.168.50.192/26  → usable hosts .193–.254, broadcast .255

IPv6 Interface IDs and SLAAC

Most IPv6 LANs use /64. Hosts typically auto-configure their Interface ID (the last 64 bits) using SLAAC. Routers advertise the network prefix with RA (Router Advertisements); hosts generate addresses like 2001:db8:1234:abcd::a1b2.


# Linux IPv6 examples
ip -6 addr add 2001:db8:1234:abcd::10/64 dev eth0
ip -6 route add default via fe80::1 dev eth0

Masks, Prefixes, and VLSM

A netmask (IPv4) or prefix length (IPv4/IPv6) specifies how many leading bits identify the network. VLSM (Variable Length Subnet Masking) lets you allocate different-sized subnets from the same aggregate, improving address efficiency.


# Quick mask ↔ prefix references
/30 = 255.255.255.252   (2 usable IPv4 hosts; point-to-point)
/29 = 255.255.255.248   (6 usable)
/28 = 255.255.255.240   (14 usable)
/24 = 255.255.255.0     (254 usable)

Common Tasks on Linux


# Show all interfaces with addresses (IPv4/IPv6)
ip addr show

# Add a temporary IPv4 address to an interface
sudo ip addr add 10.0.5.10/23 dev eth0

# Add a static route
sudo ip route add 10.42.0.0/16 via 10.0.5.1 dev eth0

# Verify connectivity and path
ping -c 4 8.8.8.8
traceroute 8.8.8.8     # or: tracepath 8.8.8.8

# Display routing tables
ip route show
ip -6 route show

Security and Legacy Notes


What Changed from the Legacy Text?


IP Address Quiz

Click the Quiz link below to take a short multiple-choice quiz on IP addresses.
IP Address - Quiz
[1]Netmask: A 32-bit bit mask which shows how an Internet address is to be divided into network, subnet and host parts.

SEMrush Software 7 SEMrush Banner 7