IPv4 and IPv6 Addressing
IP fundamentals, subnetting, CIDR, VLSM, and the transition to IPv6.
Introduction
In Module 3, we explored how switches use MAC addresses to deliver frames within a single network. But what happens when you need to communicate with a device on a different network — perhaps on the other side of the world? That question is answered by Layer 3 (IP) addressing. This module covers everything you need to know about IPv4 and IPv6: how addresses are structured, how they are divided into subnets, how routers use them to move traffic across networks, and how to diagnose connectivity problems using standard tools.
graph LR
PC["fa:fa-desktop PC
192.168.1.10"] -->|Ethernet| GW["fa:fa-wifi Router
Gateway"]
GW ==>|WAN| IN(["fa:fa-cloud Internet"])
IN ==>|WAN| SRV["fa:fa-server Server
203.0.113.50"]
style PC fill:#e8f1fb,stroke:#004a88
style GW fill:#e8f1fb,stroke:#004a88
style IN fill:#fff7e0,stroke:#d97706
style SRV fill:#f0fdf4,stroke:#16a34a
Figure 1: End-to-end IP communication — a source PC on a local network connects through a gateway router to the internet, ultimately reaching a destination server. IP addresses (Layer 3) enable communication across different networks; Ethernet (Layer 2) handles delivery within each local segment.
Review from Module 3
Module 3 covered switches and MAC addresses at Layer 2 of the OSI model. A switch builds a MAC address table by observing source MAC addresses on incoming frames, then uses that table to forward frames only to the correct port. MAC addresses are hardware addresses burned into each network interface card (NIC) and are only meaningful within a single network segment — a switch does not forward frames to other networks.
Today's key question is: how do we communicate beyond our local network? The answer requires IP addresses at Layer 3. While MAC addresses provide local (hop-by-hop) delivery, IP addresses provide end-to-end delivery across the entire path from source to destination.
MAC address = local delivery (within your network segment, changes at every router hop)
IP address = end-to-end delivery (stays the same from source to destination)
Learning Outcomes
After completing this module, you will be able to:
- Explain the role of Layer 3 (IP) addressing and how it differs from Layer 2 (MAC) addressing.
- Describe ARP (Address Resolution Protocol) and how it maps IP addresses to MAC addresses.
- Interpret IPv4 addresses in dotted decimal notation and understand the role of subnet masks.
- Calculate network addresses, broadcast addresses, and usable host ranges using CIDR notation.
- Apply VLSM (Variable Length Subnet Masking) to create subnets of different sizes.
- Identify private IP ranges (RFC 1918) and explain NAT (Network Address Translation).
- Configure IP addresses, subnet masks, and default gateways on network devices.
- Use troubleshooting tools including ping, arp, ipconfig/ifconfig, and traceroute.
- Compare IPv4 and IPv6 addressing formats and describe IPv6 adoption strategies.
IP Fundamentals & Address Resolution
IP Fundamentals & Address Resolution
This section introduces the structure of IPv4 packets and the relationship between Layer 2 and Layer 3 addressing during local delivery and routing. Understanding how these layers interact is fundamental to diagnosing nearly every networking problem.
The IPv4 Datagram Header
Just as Ethernet frames have headers at Layer 2, IP wraps data in a datagram at Layer 3. The IPv4 datagram header contains addressing and control information that routers use to forward packets across the network. The minimum header size is 20 bytes and includes the following key fields:
- Version — identifies the IP version (4 for IPv4).
- TTL (Time to Live) — a counter decremented by 1 at each router hop; when it reaches 0, the packet is discarded to prevent infinite routing loops.
- Protocol — identifies what Layer 4 protocol is inside (e.g., TCP = 6, UDP = 17).
- Source IP Address — the sender's IP address; remains unchanged end-to-end.
- Destination IP Address — the receiver's IP address; remains unchanged end-to-end.
graph TD
subgraph IPv4_Header["IPv4 Datagram Header (≥ 20 bytes)"]
R1["Version | IHL | DSCP | Total Length"]
R2["Identification | Flags | Fragment Offset"]
R3["TTL | Protocol | Header Checksum"]
R4["Source IP Address"]
R5["Destination IP Address"]
R6["Data Payload"]
end
R1 --- R2 --- R3 --- R4 --- R5 --- R6
style R3 fill:#fff7e0,stroke:#d97706
style R4 fill:#e8f1fb,stroke:#004a88
style R5 fill:#e8f1fb,stroke:#004a88
style R6 fill:#f0fdf4,stroke:#16a34a
Figure 2: Simplified IPv4 header structure showing the key fields. The TTL, Protocol, Source IP, and Destination IP fields are highlighted because they are the most important for routing and troubleshooting.
Each router decrements the TTL by 1. When TTL reaches 0, the packet is discarded and an ICMP "Time Exceeded" message is sent back to the source. This is exactly how traceroute works — it intentionally sends packets with low TTL values to map each hop along the path.
Layer 2 vs Layer 3 Addressing
Every device on a network that communicates at Layer 3 has both a MAC address (Layer 2) and an IP address (Layer 3). These two types of addresses serve very different roles:
| Feature | MAC Address (Layer 2) | IP Address (Layer 3) |
|---|---|---|
| Type | Hardware address (burned into NIC) | Logical address (assigned by admin) |
| Scope | Local network only | Across networks (end-to-end) |
| Changes? | Changes at every router hop | Stays the same source to destination |
| Format | 00:1A:2B:3C:4D:5E (48 bits) |
192.168.1.100 (32 bits) |
| Analogy | Apartment number (only useful inside the building) | Full mailing address (works anywhere) |
Think of sending a package across multiple delivery depots. The IP address is like the full mailing address (123 Main St, Springfield, USA) — it stays on the package the entire journey. The MAC address is like the local room number at each depot — it only matters within that building, and it changes at every stop.
How Routers Use Both Addresses
When a packet travels from a source PC to a destination server across a router, the Layer 3 IP addresses remain unchanged throughout the entire journey. However, the Layer 2 MAC addresses change at every hop. The router strips off the incoming Ethernet frame, examines the destination IP address to decide where to forward the packet, then creates a brand new Ethernet frame with new source and destination MAC addresses for the next network segment.
graph LR
subgraph NetA["Network A: 10.0.0.0/24"]
PC["fa:fa-desktop PC
10.0.0.5"]
SW1["fa:fa-network-wired Switch"]
end
subgraph NetB["Network B: 192.168.1.0/24"]
SW2["fa:fa-network-wired Switch"]
SRV["fa:fa-server Server
192.168.1.50"]
end
RTR["fa:fa-wifi Router"]
PC -->|"Src MAC: PC
Dst MAC: Router"| SW1
SW1 --> RTR
RTR -->|"Src MAC: Router
Dst MAC: Server"| SW2
SW2 --> SRV
style PC fill:#e8f1fb,stroke:#004a88
style SRV fill:#f0fdf4,stroke:#16a34a
style RTR fill:#fff7e0,stroke:#d97706
Figure 3: How MAC addresses change at each hop while IP addresses stay constant. On Network A, the frame uses the PC's MAC and the Router's MAC. On Network B, the router creates a new frame using its own MAC and the server's MAC. The IP header (10.0.0.5 → 192.168.1.50) is unchanged throughout.
IP addresses stay the same from source to destination — they provide end-to-end addressing. MAC addresses change at every hop — the router creates a new frame for each network segment.
Address Resolution Protocol (ARP)
Here is a fundamental problem: you know the destination IP address, but to actually send an Ethernet frame you need the destination's MAC address. The Address Resolution Protocol (ARP) solves this by broadcasting a question to the local network: "Who has IP address X? Tell me your MAC address."
The ARP process works in two steps:
- ARP Request — the source device broadcasts a message to every device on the local segment: "Who has
192.168.1.50? Tell192.168.1.10." - ARP Reply — the device with that IP address sends a unicast reply back to the requester: "I have
192.168.1.50. My MAC isAA:BB:CC:11:22:33."
sequenceDiagram
participant A as PC A (.10)
participant SW as Switch
participant B as PC B (.20)
participant C as PC C (.30)
A->>SW: ARP Request (broadcast): "Who has .30?"
SW->>B: ARP Request (broadcast)
SW->>C: ARP Request (broadcast)
C-->>A: ARP Reply (unicast): "I have .30, my MAC is CC:CC:CC..."
Note over A: Stores in ARP cache
Figure 4: ARP request/reply sequence. PC A broadcasts an ARP request to all devices on the segment. Only PC C (the owner of .30) sends a unicast reply with its MAC address. PC A caches this mapping to avoid repeating the broadcast for future packets.
ARP has no authentication — any device can send a fake ARP reply claiming to own any IP address. This attack, called ARP spoofing (or ARP poisoning), allows an attacker to redirect traffic intended for another host, enabling man-in-the-middle attacks. Dynamic ARP Inspection (DAI) on managed switches can mitigate this threat.
ARP Table and Cache
To avoid broadcasting an ARP request for every single packet, the results of ARP lookups are stored in an ARP cache (also called the ARP table). Each entry maps an IP address to its corresponding MAC address. Entries are typically marked as dynamic (learned via ARP, expires after 2–20 minutes) or static (manually added, never expires).
arp -a # Display all ARP cache entries
arp -a 192.168.1.1 # Show entry for a specific IP
arp -d 192.168.1.1 # Delete an entry from the cache
arp -s 192.168.1.1 00-1a-2b-3c-4d-5e # Add a static entry
Sample output of arp -a:
Interface: 192.168.1.100
Internet Address Physical Address Type
192.168.1.1 00-1a-2b-3c-4d-01 dynamic
192.168.1.25 00-1a-2b-3c-4d-25 dynamic
192.168.1.50 00-1a-2b-3c-4d-50 dynamic
192.168.1.254 00-1a-2b-3c-4d-fe static
An empty ARP table means no successful local communication is occurring — ARP requests are not being answered. This almost always points to a Layer 1 or Layer 2 problem (cable unplugged, NIC disabled, wrong VLAN, dead switch port), not an IP configuration issue.
Unicast, Broadcast, Multicast, and Anycast
IPv4 supports four types of communication, each serving a different purpose:
| Type | Description | Common Uses |
|---|---|---|
| Unicast | One-to-one: sent from one device to exactly one destination | Web browsing, email, file transfers |
| Broadcast | One-to-all: sent to every device on the local subnet | ARP requests, DHCP discovery |
| Multicast | One-to-group: sent to a subscribed group of devices | Video streaming, routing protocol updates (e.g., OSPF) |
| Anycast | One-to-nearest: routed to the closest member of a group | DNS root servers, CDNs |
graph TD
subgraph Unicast["Unicast (One-to-One)"]
U_SRC["fa:fa-desktop Source"] -->|single packet| U_DST["fa:fa-desktop Destination"]
end
subgraph Broadcast["Broadcast (One-to-All)"]
B_SRC["fa:fa-desktop Source"] -->|broadcast| B1["fa:fa-desktop Host A"]
B_SRC -->|broadcast| B2["fa:fa-desktop Host B"]
B_SRC -->|broadcast| B3["fa:fa-desktop Host C"]
end
subgraph Multicast["Multicast (One-to-Group)"]
M_SRC["fa:fa-desktop Source"] -->|multicast| M1["fa:fa-desktop Subscriber A"]
M_SRC -->|multicast| M2["fa:fa-desktop Subscriber B"]
end
style U_SRC fill:#e8f1fb,stroke:#004a88
style B_SRC fill:#fff7e0,stroke:#d97706
style M_SRC fill:#f0fdf4,stroke:#16a34a
Figure 5: The three main IPv4 communication types. Unicast targets one specific host; Broadcast reaches every host on the subnet; Multicast delivers only to hosts that have joined the multicast group.
Case Study: Homer's Home Network Mystery
Homer Simpson just set up a new PC in his home office. He runs some connectivity tests:
- He can ping
127.0.0.1(loopback) — Success! - He can ping his own IP
192.168.1.50— Success! - He cannot ping Marge's laptop at
192.168.1.51— Fails! - He cannot reach the internet — Fails!
Homer runs arp -a and sees an empty ARP table.
Questions:
- What does an empty ARP table suggest about network communication?
- What Layer 1 or Layer 2 issue might cause this?
- What should Homer check first?
- An empty ARP table means no successful local communication is occurring — ARP requests are not being answered (or cannot even be sent). Because Homer can ping his own IP and loopback, his TCP/IP stack is working, but his NIC is not communicating with the local network.
- Likely Layer 1/2 causes include: Ethernet cable unplugged or damaged, NIC disabled in the operating system, dead or disabled switch port, wrong VLAN assignment on the switch port.
- Homer should check in order: (1) the cable connection at both the PC and switch, (2) link activity lights on the NIC and switch port, (3) NIC status in Windows Network Connections.
If the ARP table is empty, the problem is almost always Layer 1 or Layer 2 — not the IP configuration. Check physical connectivity first!
Subnetting and Host Addressing
Subnetting and Host Addressing
This section covers IPv4 addressing structure, subnet masks, and host range calculations — the skills used every day in practical network design and administration.
IPv4 Address Format
An IPv4 address is a 32-bit number written in dotted decimal notation as four octets (8-bit groups) separated by periods. Each octet ranges from 0 to 255 (because 28 = 256 possible values). This gives a total address space of approximately 4.3 billion addresses — a number that seemed enormous in 1981 but proved insufficient for the modern internet.
graph LR
subgraph DotDecimal["Dotted Decimal: 192.168.1.100"]
O1["11000000
192
(8 bits)"]
O2["10101000
168
(8 bits)"]
O3["00000001
1
(8 bits)"]
O4["01100100
100
(8 bits)"]
end
O1 --- O2 --- O3 --- O4
style O1 fill:#e8f1fb,stroke:#004a88
style O2 fill:#e8f1fb,stroke:#004a88
style O3 fill:#e8f1fb,stroke:#004a88
style O4 fill:#e8f1fb,stroke:#004a88
Figure 6: IPv4 address 192.168.1.100 broken into its four 8-bit octets, each shown in binary and decimal. All 32 bits together form the complete address.
Each octet is 8 bits. 28 = 256 possible values, numbered 0 through 255. The maximum value of a single octet (all bits set to 1) is: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255.
Network Masks Explained
Every IPv4 address has two logical parts: a network portion that identifies which network the address belongs to, and a host portion that identifies the specific device within that network. The subnet mask defines the boundary between these two parts.
A subnet mask uses 1s in binary to mark the network bits and
0s to mark the host bits. When written in dotted decimal, the most common
masks look like 255.255.255.0 — where the 255s represent octets where all bits
are 1 (network portion) and the 0 represents an octet where all bits are 0 (host portion).
| Network Portion (24 bits) | Host Portion (8 bits) | |
|---|---|---|
| IP Address | 192.168.1 |
.100 |
| Subnet Mask | 255.255.255 |
.0 |
| In Binary | 11111111.11111111.11111111 |
.00000000 |
| Meaning | "Network bits" | "Host bits" |
Think of an IP address like a phone number: the area code identifies the region (network portion) and the local number identifies the specific line (host portion). The subnet mask tells you where the area code ends and the local number begins.
Subnet Mask Examples
The table below shows common subnet masks alongside their CIDR prefix notation, total number of addresses, and usable host count. Note that two addresses are always reserved in every subnet: the network address (all host bits set to 0) and the broadcast address (all host bits set to 1). The formula for usable hosts is 2n − 2, where n is the number of host bits.
| Subnet Mask | CIDR | Total Addresses | Usable Hosts |
|---|---|---|---|
255.0.0.0 |
/8 | 16,777,216 | 16,777,214 |
255.255.0.0 |
/16 | 65,536 | 65,534 |
255.255.255.0 |
/24 | 256 | 254 |
255.255.255.128 |
/25 | 128 | 126 |
255.255.255.192 |
/26 | 64 | 62 |
255.255.255.224 |
/27 | 32 | 30 |
255.255.255.240 |
/28 | 16 | 14 |
255.255.255.248 |
/29 | 8 | 6 |
255.255.255.252 |
/30 | 4 | 2 |
The 2 is subtracted because two addresses in every subnet are always reserved: the network address (all host bits = 0, e.g., 192.168.1.0) and the broadcast address (all host bits = 1, e.g., 192.168.1.255).
Example: /24 has 8 host bits → 28 − 2 = 256 − 2 = 254 usable hosts.
Calculating Host Address Ranges
Given a network address and mask, you can always calculate the four key addresses for that subnet using this procedure:
- Network Address: The base address — all host bits set to 0. Not assignable to a host. Example:
192.168.1.0 - First Usable Host: Network address + 1. Example:
192.168.1.1 - Last Usable Host: Broadcast address − 1. Example:
192.168.1.254 - Broadcast Address: All host bits set to 1 — sent to every device in the subnet. Example:
192.168.1.255
graph TD
NA["192.168.1.0
Network Address
(reserved — all host bits = 0)"]
FH["192.168.1.1
First Usable Host"]
RANGE["192.168.1.2 – 192.168.1.253
Usable Host Range"]
LH["192.168.1.254
Last Usable Host"]
BA["192.168.1.255
Broadcast Address
(reserved — all host bits = 1)"]
NA --> FH --> RANGE --> LH --> BA
style NA fill:#fee2e2,stroke:#dc2626
style FH fill:#f0fdf4,stroke:#16a34a
style RANGE fill:#f0fdf4,stroke:#16a34a
style LH fill:#f0fdf4,stroke:#16a34a
style BA fill:#fee2e2,stroke:#dc2626
Figure 7: Address allocation within the 192.168.1.0/24 subnet. The first and last addresses are reserved (network and broadcast). The 254 addresses between them are available for hosts.
Default Gateway
When a device wants to send a packet to an IP address that is not on its own local subnet, it sends the packet to the default gateway — the router interface on the local subnet that connects to other networks. The default gateway acts as the "exit door" from your local network.
There is one critical rule: the default gateway must be on the same subnet as the
host. If the gateway address is on a different subnet, the host cannot reach
it via ARP (ARP only works locally), and all communication outside the local network
will fail. The gateway is typically assigned the first or last usable address in the
subnet (e.g., .1 or .254).
graph LR
subgraph Local["Local Network: 192.168.1.0/24"]
PC["fa:fa-desktop PC
192.168.1.100
GW: 192.168.1.1"]
GW["fa:fa-wifi Gateway
192.168.1.1"]
end
IN(["fa:fa-cloud Internet"])
PC -->|local traffic| GW
GW ==>|external traffic| IN
style PC fill:#e8f1fb,stroke:#004a88
style GW fill:#fff7e0,stroke:#d97706
style IN fill:#f4f7fb,stroke:#6b7280
Figure 8: Default gateway topology. The PC (192.168.1.100) and gateway router (192.168.1.1) are on the same /24 subnet. Local traffic between devices on the subnet does not go through the gateway; traffic destined for any other network is forwarded to the gateway.
If the gateway is configured on a different subnet than the host, the host cannot reach the gateway via ARP and cannot access anything outside the local network. This is one of the most frequent IP configuration mistakes.
Case Study: Moe's Tavern Network Problem
Moe is setting up a new point-of-sale (POS) system at the tavern to track Duff Beer sales. The system is configured as follows:
| Setting | Value |
|---|---|
| IP Address | 192.168.10.50 |
| Subnet Mask | 255.255.255.0 |
| Default Gateway | 192.168.20.1 |
Barney's laptop (192.168.10.25) can ping the POS system just fine.
However, the POS system cannot reach the internet or the beer
distributor's ordering website.
Questions:
- What is wrong with this configuration?
- Why can Barney reach the POS but the POS cannot reach the internet?
- What should the gateway address be?
- The gateway
192.168.20.1is on a different subnet (192.168.20.x) than the POS system (192.168.10.x). The POS cannot reach the gateway via ARP. - Barney's laptop (
192.168.10.25) and the POS (192.168.10.50) are on the same subnet, so local communication works without needing the gateway. But internet-bound traffic must go through the gateway, which is unreachable because it is on a different subnet. - The gateway should be on the same subnet as the POS — for example,
192.168.10.1.
The default gateway must be on the same subnet as the host. This is one of the most common misconfigurations in real-world networks.
Address Planning Strategies
Address Planning Strategies
Address planning evolved from the rigid constraints of classful addressing to the flexible tools of CIDR and VLSM. Understanding this evolution explains many of the design choices in modern IP networks.
Classful Addressing (Legacy)
The original IPv4 design divided the address space into classes based on the value of the first octet. Each class had a fixed network/host boundary — there was no flexibility to choose a different split. This proved extremely wasteful: a company needing 300 hosts had to obtain a Class B network with 65,534 addresses, leaving over 65,000 addresses unused.
| Class | First Octet | Default Mask | Networks | Hosts/Network |
|---|---|---|---|---|
| A | 1–126 | 255.0.0.0 (/8) | 126 | 16,777,214 |
| B | 128–191 | 255.255.0.0 (/16) | 16,384 | 65,534 |
| C | 192–223 | 255.255.255.0 (/24) | 2,097,152 | 254 |
| D | 224–239 | Multicast — not for hosts | ||
| E | 240–255 | Experimental — reserved | ||
Classful addressing was very wasteful. Huge blocks of addresses were assigned to organizations that used only a fraction of them. CIDR (Classless Inter-Domain Routing) replaced this system in 1993 by allowing any prefix length, eliminating the class boundaries.
Public vs Private Addressing
Not all IPv4 addresses can be routed on the public internet. The IETF set aside three ranges of addresses in RFC 1918 for use in private networks. These private IP addresses can be freely reused by any organization, but they are not routable on the internet. The NAT (Network Address Translation) process at the router converts private addresses to the organization's public IP address when traffic leaves the local network.
| Range | CIDR | Addresses |
|---|---|---|
10.0.0.0 – 10.255.255.255 |
10.0.0.0/8 | 16,777,216 |
172.16.0.0 – 172.31.255.255 |
172.16.0.0/12 | 1,048,576 |
192.168.0.0 – 192.168.255.255 |
192.168.0.0/16 | 65,536 |
NAT is what allows your home router to give every device on your network a private address (e.g., 192.168.1.x) while sharing a single public IP address assigned by your ISP. The router replaces the private source IP with its public IP on outbound packets, and reverses this on inbound replies. This solved the IPv4 address exhaustion problem temporarily but added complexity to end-to-end connectivity.
Other Reserved Address Ranges
Beyond the RFC 1918 private ranges, several other IPv4 address ranges have special meanings:
| Address Range | Name | Purpose |
|---|---|---|
127.0.0.0/8 |
Loopback | Tests the local TCP/IP stack; never leaves the device |
169.254.0.0/16 |
APIPA / Link-Local | Auto-configured when DHCP fails; not routable |
0.0.0.0 |
"This Network" | Default route or unknown/unspecified address |
255.255.255.255 |
Limited Broadcast | Broadcasts to all hosts on the local segment |
If a device has an address in the APIPA range
(169.254.0.0/16), it means the device tried and failed to get an
address from a DHCP server. The device automatically assigned itself an address in
this range so that it can at least communicate with other APIPA devices on the same
segment. Common causes: DHCP server is down, Ethernet cable is unplugged, or the
device is on the wrong VLAN.
CIDR: Classless Inter-Domain Routing
CIDR (Classless Inter-Domain Routing) replaced classful addressing in 1993. Instead of fixed class boundaries, CIDR allows any prefix length from /0 to /32. The prefix length (the number after the slash) specifies how many bits are used for the network portion, giving network administrators complete flexibility in how they divide the address space.
CIDR notation simply appends the prefix length to the IP address:
192.168.1.0/24 means "network address 192.168.1.0, with 24 bits for the
network and 8 bits for hosts." The quick formula for the number of addresses in any
subnet is 2(32 − prefix).
| CIDR | Host Bits | Total Addresses | Usable Hosts |
|---|---|---|---|
| /24 | 8 | 256 | 254 |
| /25 | 7 | 128 | 126 |
| /26 | 6 | 64 | 62 |
| /27 | 5 | 32 | 30 |
| /28 | 4 | 16 | 14 |
| /29 | 3 | 8 | 6 |
| /30 | 2 | 4 | 2 |
Variable Length Subnet Masks (VLSM)
VLSM (Variable Length Subnet Masking) takes CIDR one step further: it allows you to use different subnet sizes within the same larger network block. Rather than dividing a network into equal-sized subnets (which wastes addresses), VLSM lets you right-size each subnet for its actual requirements.
The golden rule of VLSM is: always allocate the largest subnets first, then work downward. This prevents address space from being stranded in unusable gaps.
A company is assigned 172.16.0.0/24 and needs four subnets:
- Sales: 100 hosts → needs /25 (126 usable) →
172.16.0.0/25 - Engineering: 50 hosts → needs /26 (62 usable) →
172.16.0.128/26 - Management: 25 hosts → needs /27 (30 usable) →
172.16.0.192/27 - Point-to-point link: 2 hosts → needs /30 (2 usable) →
172.16.0.224/30
Total used: 220 addresses for 177 hosts. Without VLSM, a /23 (512 addresses) would be required, wasting 292 addresses.
graph TD
POOL["172.16.0.0/24
256 total addresses"]
SALES["Sales
172.16.0.0/25
126 usable hosts"]
ENG["Engineering
172.16.0.128/26
62 usable hosts"]
MGMT["Management
172.16.0.192/27
30 usable hosts"]
P2P["Point-to-Point
172.16.0.224/30
2 usable hosts"]
FREE["Remaining
(future growth)"]
POOL --> SALES
POOL --> ENG
POOL --> MGMT
POOL --> P2P
POOL --> FREE
style POOL fill:#e8f1fb,stroke:#004a88
style SALES fill:#e8f1fb,stroke:#004a88
style ENG fill:#f0fdf4,stroke:#16a34a
style MGMT fill:#fff7e0,stroke:#d97706
style P2P fill:#f5f3ff,stroke:#7c3aed
style FREE fill:#f4f7fb,stroke:#6b7280
Figure 9: VLSM allocation from a single /24 block. Each subnet is sized precisely to its requirements, and the remaining addresses are available for future expansion.
Case Study: Springfield Elementary Network Design
Principal Skinner needs to design the school network with three segments. The
district IT department has assigned him 172.16.50.0/24 (256 addresses).
| Segment | Devices Needed | Description |
|---|---|---|
| Computer Lab | 28 | Student workstations |
| Admin Office | 12 | Staff computers, printers |
| Teachers' Lounge | 6 | Laptops, smart TV |
Skinner wants to use VLSM to efficiently allocate addresses without waste.
Questions:
- What is the smallest subnet size that can fit 28 hosts?
- List appropriate subnet assignments for each segment.
- How many addresses will be "wasted" (unused or reserved)?
- 28 hosts needs at least 30 usable addresses → /27 (32 addresses, 30 usable).
- Subnet assignments (largest first):
Segment Subnet Usable Hosts Computer Lab 172.16.50.0/2730 (for 28 devices) Admin Office 172.16.50.32/2814 (for 12 devices) Teachers' Lounge 172.16.50.48/296 (for 6 devices) - Address accounting: Used 32 + 16 + 8 = 56 addresses. Reserved (network/broadcast) = 6. "Wasted" headroom = 4. Remaining unused = ~200 addresses for future growth.
VLSM lets you right-size subnets. Always assign the largest first, then work down. Leave room for growth!
IP Configuration & Diagnostics
IP Configuration & Diagnostics
Understanding IP addressing theory is only half the battle. You also need to know the host-side tools used to view, configure, and troubleshoot IP settings on Windows and Linux systems.
ipconfig (Windows)
On Windows, ipconfig is the primary command for viewing and managing
network interface configuration. The basic command shows the IP address, subnet mask,
and default gateway for each interface. The /all flag adds the MAC address,
DHCP status, DNS servers, and more.
| Command | Function |
|---|---|
ipconfig | Shows IP, subnet mask, and default gateway |
ipconfig /all | Full detail including MAC, DHCP server, DNS servers |
ipconfig /release | Releases the current DHCP lease |
ipconfig /renew | Requests a new DHCP lease |
ipconfig /flushdns | Clears the local DNS resolver cache |
Sample output of ipconfig /all:
Ethernet adapter Local Area Connection:
Description . . . . . : Intel Ethernet Adapter
Physical Address. . . : 00-1A-2B-3C-4D-5E
DHCP Enabled. . . . . : Yes
IPv4 Address. . . . . : 192.168.1.100
Subnet Mask . . . . . : 255.255.255.0
Default Gateway . . . : 192.168.1.1
DHCP Server . . . . . : 192.168.1.1
DNS Servers . . . . . : 8.8.8.8
If ipconfig shows 169.254.x.x, DHCP has failed — check the
DHCP server and physical connection. If it shows 0.0.0.0, no IP address
has been assigned at all — check the NIC driver and physical link.
ifconfig and ip (Linux)
Linux provides two tools for interface configuration: the older
ifconfig command (now deprecated on most distributions) and the
modern ip command from the iproute2 package. The ip
command is preferred on any modern Linux system.
| Legacy (ifconfig) | Modern (ip) | Function |
|---|---|---|
ifconfig | ip addr / ip a | Show IP addresses for all interfaces |
ifconfig eth0 | ip addr show eth0 | Show a specific interface |
ifconfig eth0 down | ip link set eth0 down | Disable an interface |
ifconfig eth0 up | ip link set eth0 up | Enable an interface |
| (no equivalent) | ip route | Show routing table and default gateway |
| (no equivalent) | ip neigh | Show ARP cache (neighbor table) |
Sample output of ip addr:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP>
inet 192.168.1.50/24 brd 192.168.1.255 scope global eth0
link/ether 00:1a:2b:3c:4d:5e brd ff:ff:ff:ff:ff:ff
The arp Command
The arp command lets you inspect and manipulate the ARP cache directly.
It works the same way on Windows, Linux, and macOS.
| Command | Function |
|---|---|
arp -a | Display all ARP cache entries |
arp -a 192.168.1.1 | Display the entry for a specific IP |
arp -d 192.168.1.1 | Delete an entry from the cache |
arp -s 192.168.1.1 00-1a-2b-3c-4d-5e | Add a permanent static entry |
Use the ARP command when troubleshooting:
- Local connectivity problems — is the gateway's MAC in the cache?
- Duplicate IP addresses — if two devices have the same IP, the ARP cache may show unexpected MAC addresses.
- Suspected ARP poisoning — look for unexpected MAC addresses mapped to known IPs.
ping: The Essential Connectivity Test
The ping command tests whether a remote host is reachable by sending
ICMP (Internet Control Message Protocol) Echo Request
messages and waiting for Echo Reply responses. It reports the
round-trip time (RTT) in milliseconds and the
TTL in the reply (which indicates approximately
how many hops away the destination is).
| Command | Description |
|---|---|
ping 192.168.1.1 | Basic connectivity test (4 pings on Windows) |
ping -t 192.168.1.1 | Continuous ping (Windows) — press Ctrl+C to stop |
ping -c 5 192.168.1.1 | Send exactly 5 pings (Linux/macOS) |
ping 127.0.0.1 | Test the local TCP/IP stack |
Sample ping output:
Pinging 192.168.1.1 with 32 bytes of data:
Reply from 192.168.1.1: bytes=32 time=2ms TTL=64
Reply from 192.168.1.1: bytes=32 time=1ms TTL=64
Reply from 192.168.1.1: bytes=32 time=1ms TTL=64
Reply from 192.168.1.1: bytes=32 time=2ms TTL=64
Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss)
- Reply from … — the host is reachable and responding.
- Request timed out — no response received; the host may be down, unreachable, or blocking ICMP.
- Destination host unreachable — a router on the path cannot forward the packet; likely a routing problem.
- High RTT (> 100ms for local) — possible congestion or long routing path.
Ping Troubleshooting Methodology
A systematic four-step ping methodology isolates connectivity problems to a specific layer or segment. Each step tests a progressively larger portion of the network path, and the step that fails identifies exactly where the problem is.
graph LR
S1["Step 1
Ping 127.0.0.1
Tests TCP/IP stack"]
S2["Step 2
Ping Own IP
Tests NIC config"]
S3["Step 3
Ping Gateway
Tests local network"]
S4["Step 4
Ping Remote IP
Tests routing/WAN"]
S1 -->|Pass| S2 -->|Pass| S3 -->|Pass| S4
style S1 fill:#e8f1fb,stroke:#004a88
style S2 fill:#e8f1fb,stroke:#004a88
style S3 fill:#e8f1fb,stroke:#004a88
style S4 fill:#e8f1fb,stroke:#004a88
Figure 10: The four-step ping troubleshooting methodology. Each step tests a larger scope. The first step that fails identifies the layer or segment where the problem exists.
| Step Fails | Problem Location | What to Check |
|---|---|---|
Step 1 (127.0.0.1) |
TCP/IP stack is broken | Reinstall network drivers; reset TCP/IP stack (netsh int ip reset) |
| Step 2 (own IP) | NIC not configured properly | Check IP settings, physical cable, NIC driver |
| Step 3 (gateway) | Local network issue | Check cable, switch port, gateway address, ARP table, VLAN |
| Step 4 (remote IP) | Routing or remote issue | Check gateway config, ISP connection, firewall rules |
IPv6 Fundamentals
IPv6 Fundamentals
The final section introduces IPv6 structure, address types, and migration approaches from IPv4 environments. IPv6 is not just "a bigger IPv4" — it includes fundamental improvements to how addresses are structured, assigned, and used.
Why IPv6? The Problem with IPv4
IPv4's address space of approximately 4.3 billion addresses seemed enormous in 1981. By 2011, IANA had assigned the last blocks of IPv4 addresses to the Regional Internet Registries. Workarounds like NAT and CIDR extended the life of IPv4 but added complexity and broke end-to-end connectivity. IPv6 provides a permanent solution with an address space so large it will never be exhausted.
IPv6 uses 128-bit addresses, providing 2128 = 340 undecillion unique addresses (340,282,366,920,938,463,463,374,607,431,768,211,456). To put this in perspective: IPv6 could assign a unique address to every atom on Earth's surface and still have addresses to spare.
IPv6 also brings several technical improvements over IPv4:
- Simpler, fixed-size header (40 bytes) for faster routing
- Built-in support for IPsec (encryption and authentication)
- No need for NAT — every device can have a globally routable address
- Stateless Address Autoconfiguration (SLAAC) eliminates the need for DHCP in many cases
- Better multicast support replaces broadcast traffic
IPv6 Address Format
An IPv6 address is 128 bits long, written as
eight groups of four hexadecimal digits separated by colons. This gives an address
like 2001:0db8:85a3:0000:0000:8a2e:0370:7334.
Two rules allow IPv6 addresses to be abbreviated:
- Rule 1 — Drop leading zeros within each group.
0db8becomesdb8;0000becomes0. - Rule 2 — Replace ONE consecutive run of all-zero groups with
::. For example,:0000:0000:becomes::. You can only use::once in an address — using it twice would make the address ambiguous.
Full form: 2001:0db8:85a3:0000:0000:8a2e:0370:7334
After Rule 1 (drop leading zeros): 2001:db8:85a3:0:0:8a2e:370:7334
After Rule 2 (compress consecutive zeros): 2001:db8:85a3::8a2e:370:7334
You can only use :: once per IPv6 address. Using it twice would make the address ambiguous — you would not know how many zero groups each :: represents.
Valid: 2001:db8::1
Invalid: 2001::db8::1 — this has two :: and is not a valid address.
IPv6 Network Prefixes and Address Types
IPv6 uses prefix length notation (e.g., /64)
instead of subnet masks. The standard allocation for a single subnet is /64:
the first 64 bits identify the network prefix, and the last 64 bits are the
interface identifier (similar to the host portion in IPv4).
| Address Type | Prefix | Description |
|---|---|---|
| Global Unicast (GUA) | 2000::/3 |
Public, routable addresses — equivalent to IPv4 public IPs |
| Link-Local | fe80::/10 |
Auto-configured on every interface; not routable; used for neighbor discovery |
| Unique Local | fc00::/7 |
Private addresses — equivalent to RFC 1918; not routable on internet |
| Multicast | ff00::/8 |
One-to-many; replaces broadcast in IPv6 |
| Loopback | ::1/128 |
Equivalent to IPv4's 127.0.0.1 |
| Unspecified | ::/128 |
Indicates "no address" — used during autoconfiguration |
IPv6 Address Types Explained
The most important IPv6 address types to understand for network administration and the Network+ exam are:
Global unicast addresses (starting with 2 or 3) are the
public, routable addresses of IPv6 — equivalent to public IPv4 addresses. They are
assigned by ISPs and are globally unique. Most internet-connected IPv6 traffic uses
GUAs.
Every IPv6-enabled interface automatically generates a link-local address starting
with fe80::, even without any manual configuration or DHCP server.
Link-local addresses are only valid on the local network segment — they are never
routed. They are essential for IPv6 neighbor discovery (which replaces ARP) and
routing protocol communication.
Unique local addresses are the IPv6 equivalent of RFC 1918 private addresses
(like 10.x.x.x or 192.168.x.x). They are for internal
use only and are not routable on the public internet. Unlike link-local addresses,
unique local addresses can be routed within an organization's internal network.
IPv6 replaces broadcast with multicast. Common multicast addresses include
ff02::1 (all nodes on the local segment) and ff02::2
(all routers on the local segment). This improves efficiency since multicast
packets are only delivered to devices that have joined the relevant group.
graph TD
IPV6["IPv6 Address Types"]
GUA["Global Unicast
2000::/3
Public & Routable
(like IPv4 public)"]
LL["Link-Local
fe80::/10
Auto-configured
Not Routed"]
UL["Unique Local
fc00::/7
Private use
(like RFC 1918)"]
MC["Multicast
ff00::/8
One-to-many
(replaces broadcast)"]
LO["Loopback
::1/128
Like 127.0.0.1"]
IPV6 --> GUA
IPV6 --> LL
IPV6 --> UL
IPV6 --> MC
IPV6 --> LO
style GUA fill:#f0fdf4,stroke:#16a34a
style LL fill:#e8f1fb,stroke:#004a88
style UL fill:#fff7e0,stroke:#d97706
style MC fill:#f5f3ff,stroke:#7c3aed
style LO fill:#fee2e2,stroke:#dc2626
Figure 11: IPv6 address type hierarchy. Each type serves a different scope and purpose, from globally routable addresses (GUA) to automatically configured local addresses (link-local).
IPv4 to IPv6 Transition
The internet cannot switch from IPv4 to IPv6 overnight — the transition requires running both protocols simultaneously for years. Three main transition strategies have been deployed:
| Strategy | Description | Pros / Cons |
|---|---|---|
| Dual Stack | Devices run IPv4 and IPv6 simultaneously, using whichever is appropriate | Most common and practical; gradual migration; devices have both address types |
| Tunneling | IPv6 packets are encapsulated inside IPv4 packets to cross IPv4-only networks (6to4, Teredo, ISATAP) | Allows IPv6 over legacy infrastructure; adds overhead and complexity |
| NAT64 | Translates between IPv6 and IPv4 at the network boundary, allowing IPv6-only hosts to reach IPv4 servers | Useful in IPv6-only deployments; complex to manage; last resort |
Dual stack is the preferred and most widely deployed transition method. Run both IPv4 and IPv6 until IPv4 can be safely retired. Most modern operating systems (Windows, Linux, macOS, iOS, Android) support dual stack by default and prefer IPv6 when available.
Module Summary
Module Summary
In this module, we covered the core concepts of IPv4 and IPv6 addressing. Here are the key takeaways:
- IP (Layer 3) provides end-to-end addressing; MAC (Layer 2) provides local, hop-by-hop delivery. ARP resolves IP addresses to MAC addresses on the local network.
- IPv4 addresses are 32-bit values written in dotted decimal (e.g.,
192.168.1.100). The subnet mask divides each address into network and host portions. - The network address and broadcast address are always reserved; usable hosts = 2n − 2 (where n = host bits).
- CIDR notation (e.g., /24) replaced classful addressing, allowing flexible prefix lengths.
- VLSM (Variable Length Subnet Masking) allows subnets of different sizes, enabling efficient IP allocation. Always allocate the largest subnets first.
- Private IP ranges (RFC 1918): 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16. NAT translates private to public for internet access.
- Special addresses:
127.0.0.1(loopback),169.254.x.x(APIPA — DHCP failure indicator). - Address types: Unicast (one-to-one), Broadcast (one-to-all on subnet), Multicast (one-to-group), Anycast (one-to-nearest).
- The default gateway must be on the same subnet as the host. TTL prevents routing loops by limiting packet lifetimes.
- Diagnostic tools:
ipconfig/ifconfig/ip addr(view config),arp -a(view MAC mappings),ping(test reachability),traceroute/tracert(map the path). - Ping methodology: (1) loopback → (2) own IP → (3) gateway → (4) remote host. The first failing step isolates the problem.
- IPv6 uses 128-bit addresses in hex notation (e.g.,
2001:db8::1). Use::to compress consecutive zero groups (only once per address). - IPv6 address types: Link-local (fe80::/10, auto-configured on every interface), Global unicast (2000::/3, public), Unique local (fc00::/7, private).
- Dual stack — running IPv4 and IPv6 simultaneously — is the preferred transition method.
This module has given you the tools to understand and configure IP addressing. In Module 5, we will explore how routers use the destination IP address to forward packets across multiple networks — covering routing protocols, static routes, and how the internet's routing infrastructure works.