Network Devices and Protocols

Chapter 5
IPv4 and IPv6 Addressing and Delivery

Diploma in Computer Architecture and Networking
Network Devices and Protocols   •   Diploma

IPv4 and IPv6 Addressing and Delivery

Introduction

An IP address identifies a network interface at the internetwork layer and enables packets to move between networks. Addressing is not merely a matter of assigning numbers: a sound addressing plan must support routing, growth, fault isolation, security policy, troubleshooting and efficient use of address space. This chapter examines IPv4 and IPv6 addressing, subnetting, CIDR, variable-length subnet masks (VLSM), delivery types, and the protocols that resolve or diagnose addresses.

IPv4 uses 32-bit addresses and remains widely deployed. IPv6 uses 128-bit addresses and was designed to provide an extremely large address space, hierarchical aggregation, simplified packet processing and improved support for autoconfiguration. Both versions use network prefixes to distinguish the destination network from the interface identifier, but their mechanisms for resolution and local delivery differ significantly.

Learning Objectives

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

  • calculate IPv4 network, broadcast, host and usable-address ranges;
  • design IPv4 subnetting and VLSM plans using CIDR notation;
  • interpret IPv6 prefixes and construct practical IPv6 addressing plans;
  • distinguish unicast, broadcast, multicast and anycast delivery;
  • explain the operation and limitations of ARP, Neighbor Discovery, ICMP and NAT;
  • analyse address-resolution and packet-delivery problems in a network.

1. Addressing Fundamentals

An IP address has two logical parts: a prefix, identifying the network or subnet, and an interface identifier, identifying an interface on that subnet. Routers forward packets primarily by comparing the destination address with routing-table prefixes. The route with the longest matching prefix is normally selected.

CIDR notation writes an address followed by a slash and the number of prefix bits. For example, 192.168.20.0/24 has 24 network bits and 8 host bits. IPv4 has 32 total bits, so the number of addresses in a prefix is:

N = 2^(32 − p)

Here, N is the number of IPv4 addresses and p is the prefix length. The formula assumes a conventional binary address space. In an ordinary IPv4 subnet, the all-zero host address identifies the network and the all-one host address is the directed broadcast address. Thus, for a subnet with at least two host bits:

U = 2h − 2

where U is the number of traditionally usable host addresses and h = 32 − p. Modern point-to-point links and some special-purpose configurations may use the address space differently, so the subtraction rule must not be applied mechanically to every context.

IPv4 Address Classes and Private Space

Classful addressing divided IPv4 into Classes A, B and C, but modern networks use classless addressing. Historical class boundaries remain useful for understanding older documentation, not for current design.

The private IPv4 ranges defined for internal use are:

RangeCIDRTypical use
10.0.0.0–10.255.255.25510.0.0.0/8Large enterprises
172.16.0.0–172.31.255.255172.16.0.0/12Medium networks
192.168.0.0–192.168.255.255192.168.0.0/16Small networks and laboratories

Private addresses are not globally routable on the public Internet. They commonly require Network Address Translation (NAT) at an Internet boundary.

Other important IPv4 ranges include 127.0.0.0/8 for loopback, 169.254.0.0/16 for link-local autoconfiguration, and 224.0.0.0/4 for multicast.

2. IPv4 Subnetting and CIDR

Subnetting borrows host bits to create smaller networks. If s host bits are borrowed, the number of equal-sized subnets is:

S = 2s

The remaining host bits are h = 32 − p, where p is the new prefix length. Subnetting improves address administration and limits broadcast domains, although each additional subnet requires routing or a layer-3 gateway between it and other subnets.

Worked Example: Equal-Size Subnets

An organisation owns 192.168.40.0/24 and needs at least six subnets, each supporting at least 25 hosts.

A /24 has 8 host bits. To obtain at least six subnets, borrow 3 bits because 2³ = 8. The new prefix is /27. Each subnet contains 2^(32−27) = 32 addresses, of which 30 are conventionally usable. Therefore /27 satisfies both requirements.

The resulting subnets increase by 32:

SubnetNetworkUsable rangeBroadcast
1192.168.40.0/27.1–.30.31
2192.168.40.32/27.33–.62.63
3192.168.40.64/27.65–.94.95
4192.168.40.96/27.97–.126.127
5192.168.40.128/27.129–.158.159
6192.168.40.160/27.161–.190.191
7192.168.40.192/27.193–.222.223
8192.168.40.224/27.225–.254.255

The remaining two subnets may be reserved for growth, infrastructure or another department.

VLSM

VLSM assigns different prefix lengths within a larger address block. It prevents large departments from receiving the same address allocation as small point-to-point links. A reliable method is to list requirements from largest to smallest, allocate the largest suitable block first, and ensure every subsequent block starts on a valid boundary.

For example, consider 10.20.0.0/24 with requirements for 100 hosts, 50 hosts, 20 hosts and two router links. The allocations can be:

RequirementAllocationUsable capacityRange
100 hosts10.20.0.0/25126.0–.127
50 hosts10.20.0.128/2662.128–.191
20 hosts10.20.0.192/2730.192–.223
Router link 110.20.0.224/302.224–.227
Router link 210.20.0.228/302.228–.231

Addresses .232–.255 remain available. A /30 traditionally provides two usable addresses, suitable for a point-to-point IPv4 link. Some technologies support /31 point-to-point links, in which both addresses are usable and no conventional network/broadcast pair is required.

Route Aggregation

CIDR also reduces routing-table size. Adjacent networks can be advertised as one larger summary if the address ranges are aligned and contiguous. Incorrect summarisation can direct traffic to the wrong location, so the summary must represent only prefixes actually reachable through the advertising router.

3. IPv6 Addressing

IPv6 addresses contain 128 bits and are written as eight groups of four hexadecimal digits, separated by colons, for example:

2001:0db8:0001:0000:0000:0000:0000:0042

Leading zeroes in a group may be omitted, and one consecutive sequence of zero groups may be compressed with :::

2001:db8:1::42

The double-colon notation may be used only once in an address because it represents an unambiguous number of omitted groups.

An IPv6 prefix is written in CIDR form, such as 2001:db8:1200::/48. A common site design assigns /64 to each LAN. This supports Stateless Address Autoconfiguration (SLAAC), standard interface-identifier practices and efficient subnet planning. A /48 site allocation contains 2^(64−48) = 65,536 possible /64 subnets.

IPv6 address categories include:

TypeMeaning
Global unicastGlobally routable address
Link-local (fe80::/10)Valid only on the local link; required on IPv6 interfaces
Unique local (fc00::/7)Private-style addressing for internal networks
Multicast (ff00::/8)One-to-many delivery
Loopback (::1/128)Local host testing
Unspecified (::/128)No address assigned or source not yet known

IPv6 has no broadcast address. Functions formerly associated with broadcast are implemented through multicast, especially solicited-node multicast groups and all-nodes or all-routers groups.

IPv6 Interface Identifiers and Privacy

An interface identifier may be generated from a hardware address, randomly, cryptographically, or by operating-system privacy extensions. Stable addresses may assist administration, whereas temporary privacy addresses reduce long-term tracking. Organisations should document which addresses are used for server identity, management, monitoring and outbound client sessions.

4. Delivery Models

Unicast sends one packet from one source to one destination. Web traffic to a server is normally unicast.

Broadcast sends to all hosts in an IPv4 broadcast domain. IPv4 limited broadcast is 255.255.255.255; a subnet-directed broadcast has host bits set to one. Broadcast can be useful for discovery, but excessive broadcast traffic consumes resources and creates security concerns. IPv6 does not use broadcast.

Multicast sends one packet to members of a group. IPv4 multicast occupies 224.0.0.0/4; IPv6 multicast begins with ff. Hosts join groups, and switches and routers may use protocols such as IGMP and MLD to control group membership.

Anycast assigns the same address to multiple interfaces or sites. Routing delivers a packet to the topologically nearest or preferred instance according to routing policy. Anycast is useful for distributed DNS and content services, but stateful sessions and return-path consistency require careful engineering.

5. ARP and IPv6 Neighbor Discovery

Address Resolution Protocol

IPv4 packets require a link-layer destination address for local delivery. When a host knows the destination IPv4 address but not the destination MAC address, it broadcasts an ARP Request. The device owning the address returns an ARP Reply, usually unicast. The result is stored in an ARP cache for a limited time.

If the destination is on another IP network, the sender resolves the MAC address of its default gateway, not the remote host. The router then performs resolution on the next link. This distinction is fundamental in troubleshooting.

ARP has no strong built-in authentication. Attackers can send forged replies, redirecting traffic through a malicious device. Mitigations include switch inspection features, static entries for selected systems, segmentation, encryption and monitoring.

IPv6 Neighbor Discovery

IPv6 replaces ARP with Neighbor Discovery (ND), which uses ICMPv6 messages and multicast. Important messages include:

  • Router Solicitation (RS): a host requests router information;
  • Router Advertisement (RA): a router announces prefixes, default-router information and configuration parameters;
  • Neighbor Solicitation (NS): resolves a neighbor’s link-layer address or checks reachability;
  • Neighbor Advertisement (NA): supplies the response;
  • Redirect: informs a host of a better next hop.

ND also supports Duplicate Address Detection (DAD), which checks whether an address is already in use. A host typically sends an NS for the tentative address before assigning it.

Because ND depends on ICMPv6, indiscriminate blocking of ICMPv6 can break address configuration, path discovery and normal communication. RA Guard and switch-level controls help reduce rogue-router attacks.

6. ICMP, Path Discovery and Error Reporting

ICMP communicates network-layer control and diagnostic information; it is not a transport protocol for application data. IPv4 ICMP includes Echo Request and Echo Reply, Destination Unreachable and Time Exceeded. The ping utility commonly uses Echo messages, while traceroute or tracert relies on TTL expiration and ICMP responses.

IPv6 uses ICMPv6 for equivalent functions and for Neighbor Discovery. Path MTU Discovery is especially important: routers generally do not fragment IPv6 packets. If a packet is too large, a router sends an ICMPv6 Packet Too Big message, allowing the sender to reduce its packet size. Firewalls must permit necessary ICMP and ICMPv6 traffic while applying rate limits and stateful filtering rather than blocking all messages.

7. NAT and Address Resolution at Network Boundaries

NAT translates addresses, and often transport-layer port numbers, as traffic crosses a boundary. A common form is many-to-one Port Address Translation (PAT): multiple private hosts share one public IPv4 address, with different source-port mappings.

NAT conserves public IPv4 addresses and hides internal addressing, but it is not a complete security mechanism. It complicates inbound connections, logging, peer-to-peer applications, troubleshooting and some protocols that carry addresses inside payloads. Port forwarding creates a controlled inbound mapping but increases exposure.

IPv6 was designed to reduce dependence on NAT. Global IPv6 addressing does not automatically mean unrestricted reachability: stateful firewalls, access-control lists and host security remain necessary. NAT should not be used as a substitute for a security policy.

8. Designing an Addressing Plan

A professional plan begins with requirements rather than arbitrary address selection.

  1. Inventory sites, VLANs, users, servers, wireless networks, voice systems, management networks and point-to-point links.
  2. Estimate current and future host counts, including addresses for gateways, infrastructure and reserved capacity.
  3. Choose a hierarchical private IPv4 block and an IPv6 prefix supplied by the provider or organisation.
  4. Allocate larger blocks to sites and progressively smaller blocks to VLANs.
  5. Reserve space for growth and document excluded ranges.
  6. Define address-assignment methods: static addressing, DHCP, DHCPv6, SLAAC or combinations.
  7. Summarise routes where possible without overlapping unrelated networks.
  8. Record gateway addresses, DNS servers, NTP servers, DHCP scopes, VLAN identifiers and security zones.
  9. Test for overlap, correct masks, valid IPv6 compression and operational reachability.

Address management should be maintained in an IP Address Management (IPAM) system. Documentation should identify ownership, purpose, allocation date, lease or reservation data and change history.

Applied Case: Illustrative Campus Network

Background

A college has an administrative building, teaching laboratories, a residence network and a data centre. It receives 10.50.0.0/16 for internal IPv4 use and a provider IPv6 prefix 2001:db8:5000::/48 for documentation and design practice.

Problem

The college has been using one flat network. Broadcast traffic is increasing, laboratory devices conflict with administrative systems, and future expansion is difficult.

Analysis

The design requires separate security and operational zones: administration, laboratories, residence, voice, network management and servers. The largest expected IPv4 segment needs about 400 hosts, while the smallest management segment needs about 30. A single mask would waste substantial address space or fail to support the largest segment.

Approach and Solution

The designer assigns site blocks by the second and third octets and uses VLSM within each site. For example:

FunctionIPv4 allocationIPv6 allocation
Administration10.50.0.0/232001:db8:5000:10::/64
Laboratories10.50.2.0/232001:db8:5000:20::/64
Residence10.50.4.0/222001:db8:5000:30::/64
Voice10.50.8.0/242001:db8:5000:40::/64
Management10.50.9.0/262001:db8:5000:50::/64
Servers10.50.10.0/242001:db8:5000:60::/64

IPv4 DHCP serves clients, reservations identify managed devices, and firewalls restrict traffic between zones. IPv6 RAs advertise the relevant /64 prefixes; servers receive stable addresses, while client devices may use privacy addresses. DNS records are maintained for both address families. ICMP and ICMPv6 are permitted in a controlled, monitored manner.

Outcome and Learning Points

The design reduces broadcast-domain size, supports route summarisation, separates security zones and leaves unused capacity. The key lesson is that an addressing plan must integrate technical allocation with routing, security, documentation and anticipated growth.

Challenges, Governance and Best Practices

Address depletion, overlapping private ranges after mergers, undocumented static addresses and incorrect masks are common operational problems. IPv6 introduces additional concerns: rogue router advertisements, excessive reliance on link-local addresses for administration, incomplete dual-stack monitoring and applications that support only one protocol.

Dual-stack operation increases visibility and testing requirements because a client may prefer IPv6 while an application or firewall path supports only IPv4. Transition technologies such as tunnelling and translation can assist migration but add complexity and should be introduced only with documented security and operational controls.

Good practice includes least-privilege routing, authenticated management, encrypted application traffic, centralised logs, regular IPAM reconciliation, DHCP and ND monitoring, protection against rogue DHCP or RA services, and periodic review of unused allocations. Address records can reveal user or device activity, so logs and IPAM data should be retained and accessed according to institutional policy and applicable privacy law.

Chapter Summary

IPv4 and IPv6 use prefixes to support hierarchical delivery and routing. IPv4 subnetting borrows host bits, while CIDR provides flexible prefix lengths and route aggregation. VLSM allocates different-sized subnets according to actual requirements. IPv6 uses 128-bit addresses, normally assigns /64 prefixes to LANs, and replaces broadcast with multicast-based mechanisms. Unicast, multicast, broadcast and anycast serve different delivery objectives. ARP resolves IPv4 addresses to MAC addresses, whereas IPv6 Neighbor Discovery uses ICMPv6 and supports router discovery, address resolution and duplicate-address detection. ICMP provides diagnostics and error reporting, and NAT conserves IPv4 space but introduces complexity and is not a substitute for security. Effective addressing plans combine calculation, routing hierarchy, address resolution, security, documentation and growth planning.

Key Terms

IPv4: A 32-bit Internet Protocol addressing system.

IPv6: A 128-bit Internet Protocol addressing system.

Prefix: The network portion of an IP address.

CIDR: Classless Inter-Domain Routing using a variable-length prefix.

Subnetting: Dividing one network block into smaller networks.

VLSM: Variable-Length Subnet Masking, using different subnet sizes.

Broadcast: Delivery to all hosts in an IPv4 broadcast domain.

Multicast: Delivery to members of a defined receiver group.

Anycast: Delivery to one of several hosts sharing an address.

Unicast: One-to-one packet delivery.

ARP: IPv4 protocol mapping an IP address to a link-layer address.

Neighbor Discovery: IPv6 ICMPv6 mechanism for neighbor and router functions.

SLAAC: Stateless Address Autoconfiguration for IPv6 hosts.

DAD: Duplicate Address Detection.

ICMP: Internet Control Message Protocol for errors and diagnostics.

NAT: Network Address Translation.

PAT: Port Address Translation, usually many-to-one NAT.

IPAM: IP Address Management and documentation system.

Route aggregation: Combining contiguous prefixes into a summary route.

Link-local address: An address valid only on the local network link.

Review Questions

Short Answer Questions

  1. What are the two logical parts of an IP address?
  2. Why does IPv6 use multicast instead of broadcast?
  3. What is the purpose of ARP?
  4. State one use of ICMP.
  5. What is the main advantage of VLSM?

Long Answer Questions

  1. Explain how CIDR and route aggregation improve network scalability.
  2. Describe the complete process of IPv4 subnetting, including network and broadcast addresses.
  3. Compare ARP with IPv6 Neighbor Discovery.
  4. Explain the benefits and limitations of NAT.
  5. Describe a method for designing a hierarchical dual-stack addressing plan.

Analytical / Application Questions

  1. A company has 192.168.100.0/24 and needs subnets for 60, 30, 12 and 6 hosts. Design a VLSM allocation and show the unused space.
  2. A host can reach local IPv4 devices but cannot reach a remote network. Develop a troubleshooting sequence involving the subnet mask, default gateway, ARP, routing and ICMP.
  3. A campus wants to deploy IPv6 but blocks all ICMPv6 at its firewall. Analyse the likely operational consequences and recommend a safer policy.

Multiple Choice Questions with Answers

Question 1

How many conventionally usable IPv4 host addresses are available in a /27 subnet?

A. 14

B. 30

C. 32

D. 62

Correct Answer: B. 30

Question 2

Which protocol resolves an IPv4 address to a MAC address on a local network?

A. ARP

B. DNS

C. ICMP

D. DHCPv6

Correct Answer: A. ARP

Question 3

Which IPv6 mechanism replaces the broadcast function?

A. Unicast

B. NAT

C. Multicast

D. PAT

Correct Answer: C. Multicast

Question 4

A /48 IPv6 allocation contains how many /64 subnets?

A. 256

B. 4096

C. 65536

D. 16777216

Correct Answer: C. 65536

Question 5

What is the principal purpose of VLSM?

A. Encrypting packets

B. Assigning different subnet sizes according to requirements

C. Replacing DNS

D. Converting IPv6 to MAC addresses

Correct Answer: B. Assigning different subnet sizes according to requirements

Question 6

Which IPv6 message can announce a default router and network prefix?

A. Router Advertisement

B. Neighbor Solicitation

C. Echo Reply

D. Destination Unreachable

Correct Answer: A. Router Advertisement

Question 7

If an IPv4 destination is remote, which MAC address does the source host normally resolve?

A. The remote server's MAC address

B. The DNS server's MAC address

C. The default gateway's MAC address

D. The broadcast MAC address only

Correct Answer: C. The default gateway's MAC address

Question 8

What is a common function of PAT?

A. Allowing many private hosts to share one public IPv4 address

B. Creating IPv6 multicast groups

C. Detecting duplicate IPv6 addresses

D. Aggregating IPv6 routes

Correct Answer: A. Allowing many private hosts to share one public IPv4 address

Question 9

Which IPv6 address type is valid only on the local link?

A. Global unicast

B. Link-local

C. Anycast

D. Unique local only

Correct Answer: B. Link-local

Question 10

A /26 IPv4 subnet contains how many total addresses?

A. 32

B. 62

C. 64

D. 128

Correct Answer: C. 64

Network Devices and Protocols
Chapter 5 of 14