Latest update Android YouTube

IP Addressing Basics | Computer Networks: From Scratch to Mastery

aster IP addressing with this comprehensive guide: learn IPv4, IPv6, subnetting, supernetting, CIDR, ARP, private vs public IPs, and practical config.
Estimated read time: 51 min

Chapter 4: IP Addressing Basics

Understanding IPv4, IPv6, subnetting, and address resolution

 IP Addressing Basics | Computer Networks: From Scratch to Mastery  | IndinTechnoEra

Introduction

IP addressing is the foundation of network communication, enabling devices to identify and locate each other. This chapter explores both IPv4 and IPv6 addressing schemes, subnetting techniques, and how devices resolve IP addresses to physical MAC addresses.

By the end of this chapter, you will be able to:

  • Compare IPv4 and IPv6 address structures
  • Perform subnetting and supernetting calculations
  • Differentiate between private and public IP addresses
  • Explain CIDR notation and its benefits
  • Describe the ARP process and its role in networking

IPv4 vs IPv6: Structure and Evolution

IPv4 (Internet Protocol version 4)

192.168.1.1
  • Address Size: 32 bits (4.3 billion addresses)
  • Format: Four 8-bit octets (0-255) in dotted decimal
  • Limitations: Address exhaustion, NAT dependency
  • Header: 20+ bytes with options, checksum
  • Example: 192.168.1.1 with subnet mask 255.255.255.0

IPv6 (Internet Protocol version 6)

2001:0db8:85a3:0000:0000:8a2e:0370:7334
  • Address Size: 128 bits (340 undecillion addresses)
  • Format: Eight 16-bit segments in hexadecimal
  • Advantages: No NAT needed, built-in security
  • Header: Fixed 40 bytes, no checksum
  • Example: 2001:db8::1 (compressed format)

Figure 1: Structural comparison of IPv4 and IPv6 addresses

IPv6 Transition Mechanisms

Dual Stack

Devices run both IPv4 and IPv6 simultaneously

Tunneling

Encapsulate IPv6 packets in IPv4 for traversal

Translation

NAT64/DNS64 convert between protocols

Common Pitfall

When configuring IPv6, remember that interface identifiers (last 64 bits) can be derived from MAC addresses (EUI-64 format), potentially exposing device information. Use privacy extensions when needed.

Subnetting: Dividing Networks

Subnetting breaks large networks into smaller, manageable subnets for improved performance and security. Let's subnet 192.168.1.0/24 into 4 subnets:

Step 1: Determine Subnet Requirements

  • Original network: 192.168.1.0/24 (256 addresses)
  • Required subnets: 4
  • Hosts per subnet: ~60 (62 usable)

Step 2: Calculate New Subnet Mask

  • Borrow 2 bits (2²=4 subnets)
  • New prefix: /26 (255.255.255.192)
  • Host bits: 6 (2⁶-2=62 hosts per subnet)

Step 3: Subnet Ranges

Subnet Network Address First Host Last Host Broadcast
1 192.168.1.0/26 192.168.1.1 192.168.1.62 192.168.1.63
2 192.168.1.64/26 192.168.1.65 192.168.1.126 192.168.1.127
3 192.168.1.128/26 192.168.1.129 192.168.1.190 192.168.1.191
4 192.168.1.192/26 192.168.1.193 192.168.1.254 192.168.1.255
192.168.1.0/24
192.168.1.0/26
Host: 192.168.1.1
Host: 192.168.1.2
192.168.1.64/26
Host: 192.168.1.65
Host: 192.168.1.66
192.168.1.128/26
Host: 192.168.1.129
Host: 192.168.1.130
192.168.1.192/26
Host: 192.168.1.193
Host: 192.168.1.194

Figure 2: Visualization of a /24 network divided into four /26 subnets

Subnetting Cheat Sheet

Prefix Mask Subnets Hosts Block Size
/24 255.255.255.0 1 254 256
/25 255.255.255.128 2 126 128
/26 255.255.255.192 4 62 64
/27 255.255.255.224 8 30 32
/28 255.255.255.240 16 14 16

Supernetting: Aggregating Routes

Supernetting combines contiguous networks into larger blocks to reduce routing table size. Consider these four /24 networks:

192.168.0.0/24
192.168.1.0/24
192.168.2.0/24
192.168.3.0/24

Step 1: Check Contiguity

All networks are contiguous in the third octet (0-3).

Step 2: Find Common Bits


192.168.0.0: 11000000.10101000.00000000.00000000
192.168.1.0: 11000000.10101000.00000001.00000000
192.168.2.0: 11000000.10101000.00000010.00000000
192.168.3.0: 11000000.10101000.00000011.00000000
                    

First 22 bits are identical → /22 supernet

Resulting Supernet

192.168.0.0/22 (1022 usable addresses)

Troubleshooting Tip

When supernetting, ensure all networks are truly contiguous. Gaps (like missing 192.168.1.0/24) would require multiple routing entries.

IP Address Classes and Private vs. Public IPs

IPv4 Address Classes (Historical)

Class Range Network/Host Purpose
A 1.0.0.0 - 126.255.255.255 N.H.H.H Large networks
B 128.0.0.0 - 191.255.255.255 N.N.H.H Medium networks
C 192.0.0.0 - 223.255.255.255 N.N.N.H Small networks
D 224.0.0.0 - 239.255.255.255 - Multicast
E 240.0.0.0 - 255.255.255.255 - Experimental

Private vs. Public IP Addresses

Private IP Ranges (RFC 1918)

  • 10.0.0.0/8 (16.7 million addresses)
  • 172.16.0.0/12 (1 million addresses)
  • 192.168.0.0/16 (65,536 addresses)
  • Not routable on public Internet
  • Used with NAT for Internet access

Public IP Ranges

  • All other IPv4 addresses
  • Globally routable on Internet
  • Assigned by IANA to RIRs
  • Must be unique worldwide
  • Example: Your web server's IP

CIDR: Modern IP Allocation

Classless Inter-Domain Routing (CIDR) replaced classful addressing with flexible network sizes:

CIDR Notation

192.168.1.0/26
  • Slash notation (/24, /26, etc.)
  • Prefix indicates network bits
  • More efficient than fixed classes

Benefits

  • Reduced routing table size
  • Flexible network sizes
  • Better address space utilization
  • Supports VLSM (Variable Length Subnet Masking)

CIDR Allocation Example

An ISP might receive 203.0.113.0/24 from their RIR, then allocate:

  • 203.0.113.0/26 to Customer A (62 hosts)
  • 203.0.113.64/27 to Customer B (30 hosts)
  • 203.0.113.96/28 to Customer C (14 hosts)
  • 203.0.113.112/28 reserved for future use

Address Resolution Protocol (ARP)

ARP maps IP addresses to MAC addresses on local networks:

R
192.168.1.1
00:1A:2B:3C:4D:5E
💻
192.168.1.2
00:1A:2B:3C:4D:6F
💻
192.168.1.3
00:1A:2B:3C:4D:7G
🖥️
192.168.1.4
00:1A:2B:3C:4D:8H
ARP Request: Who has 192.168.1.2?
ARP Reply: 192.168.1.2 is at 00:1A:2B:3C:4D:6F

Figure 3: ARP request/reply process between devices on a local network

ARP Process

  1. ARP Request: Broadcast "Who has 192.168.1.2?"
  2. ARP Reply: Unicast "192.168.1.2 is at 00:1A:2B:3C:4D:5E"
  3. Cache Update: Both devices store mapping in ARP table
  4. Communication: Frames sent with correct MAC addresses

Viewing ARP Cache

Windows


arp -a

Interface: 192.168.1.10
  Internet Address      Physical Address      Type
  192.168.1.1          00-1a-2b-3c-4d-5e    dynamic
  192.168.1.255        ff-ff-ff-ff-ff-ff    static
                        

Linux/macOS


arp -an

? (192.168.1.1) at 00:1a:2b:3c:4d:5e [ether] on eth0
                        

Security Consideration

ARP spoofing attacks can redirect traffic. Mitigate with:

  • Static ARP entries for critical devices
  • Port security on switches
  • ARP inspection tools

Practical Example: Configuring IP Addresses in Packet Tracer

Let's configure a router interface and two PCs with IP addresses from our subnetting example:

Step 1: Router Configuration


Router> enable
Router# configure terminal
Router(config)# interface gigabitEthernet 0/0
Router(config-if)# ip address 192.168.1.1 255.255.255.192
Router(config-if)# no shutdown
Router(config-if)# exit
                    

Step 2: PC1 Configuration


IP Address: 192.168.1.2
Subnet Mask: 255.255.255.192
Default Gateway: 192.168.1.1
                    

Step 3: PC2 Configuration


IP Address: 192.168.1.3
Subnet Mask: 255.255.255.192
Default Gateway: 192.168.1.1
                    

Step 4: Verify Connectivity


PC1> ping 192.168.1.3
Pinging 192.168.1.3 with 32 bytes of data:
Reply from 192.168.1.3: bytes=32 time=1ms TTL=128
                    

Visualizing Subnet Communication

Figure 4: Interactive visualization of devices communicating across subnets

How This Visualization Works

The diagram shows:

  • Two subnets (192.168.1.0/26 and 192.168.1.64/26)
  • A router connecting the subnets
  • ARP resolution within each subnet
  • Routing between subnets

Chapter Summary

Key Concepts

  • IPv4 uses 32-bit addresses while IPv6 uses 128-bit hexadecimal addresses
  • Subnetting divides networks; supernetting combines them for routing efficiency
  • Private IP ranges (RFC 1918) are for internal networks only
  • CIDR enables flexible network sizes and efficient address allocation
  • ARP resolves IP addresses to MAC addresses on local networks

Best Practices

  • Plan subnet sizes carefully to allow for growth
  • Use private IPs for internal devices and NAT for Internet access
  • Document your IP allocation scheme thoroughly
  • Monitor ARP tables for suspicious entries
  • Begin IPv6 adoption planning even if primarily using IPv4

Further Reading

Post a Comment

Feel free to ask your query...
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.