Logical Addressing with IPv4
Introduces IPv4 addressing, address structure, notation, and how logical addresses enable communication across networks.
Learning Goals
- Describe the purpose of logical addressing and distinguish it from physical addressing
- Interpret IPv4 addresses in dotted-decimal and binary form
- Identify network and host portions of an IPv4 address for a given addressing scheme
- Differentiate public, private, loopback, and special-use IPv4 address ranges
- Determine whether two IPv4 hosts belong to the same network based on their addresses
In computer networking, every device that communicates over a network requires an address. The Internet Protocol version 4 (IPv4) defines a system of logical addresses that enables end-to-end communication across interconnected networks. Unlike physical addresses (MAC addresses), which are burned into hardware and operate only within a single local network segment, IPv4 logical addresses are assigned by software and are hierarchically structured to support routing across the global internet .
Understanding IPv4 addressing is foundational to networking. This lesson covers the structure of IPv4 addresses, the relationship between binary and dotted-decimal notation, how subnet masks separate network and host portions, the categories of special-use address ranges, and how to determine whether two hosts reside on the same network.
The diagram above illustrates the TCP/IP protocol stack. The Network Layer (Layer 3) is where IPv4 logical addressing operates, enabling packets to be routed between networks. The Data Link Layer (Layer 2) uses physical MAC addresses for local frame delivery within a single broadcast domain .
Footnotes
-
Internet Logical Addressing - Explains how logical addresses work globally across the internet while physical addresses operate locally within a LAN. ↩ ↩2
IPv4 Addressing - CompTIA Network+ N10-009
Logical Addressing vs. Physical Addressing
A key distinction in networking is between logical and physical addresses. Both are essential, but they serve fundamentally different roles in the communication process:
| Feature | Logical Address (IPv4) | Physical Address (MAC) |
|---|---|---|
| OSI Layer | Layer 3 (Network) | Layer 2 (Data Link) |
| Length | 32 bits (4 octets) | 48 bits (6 octets) |
| Notation | Dotted-decimal (e.g., 192.168.1.10) | Hexadecimal (e.g., AA:BB:CC:DD:EE:FF) |
| Assignment | Assigned by software/administrator (configurable) | Burned into NIC hardware by manufacturer (fixed) |
| Scope | Global — routes packets across networks | Local — delivers frames within a single LAN segment |
| Changes | Can change when a device moves to a new network | Remains constant regardless of location |
| Hierarchy | Hierarchical (Network + Host portions) | Flat (no network/host division) |
The logical address is what allows a router to make forwarding decisions. When a packet crosses from one network to another, the source and destination MAC addresses change at each hop, but the source and destination IPv4 addresses remain constant throughout the journey. This is the fundamental reason logical addressing exists: to provide a persistent, routable identity for end-to-end delivery 2.
Footnotes
-
Internet Logical Addressing - Explains how logical addresses work globally across the internet while physical addresses operate locally within a LAN. ↩
-
IPv4 Address Structure - peachyPing - Detailed breakdown of IPv4 dotted-decimal notation, octets, binary conversion, and the network/host division determined by subnet masks. ↩
IPv4 Address Structure and Notation
An IPv4 address is a 32-bit binary number. For human readability, it is expressed in dotted-decimal notation, which divides the 32 bits into four groups of 8 bits. Each 8-bit group is called an octet .
Example:
The IPv4 address 192.168.1.65 in binary is:
Each octet is converted independently:
Since each octet is 8 bits, the minimum value is and the maximum is . Therefore, every octet in dotted-decimal notation must fall within the range .
The total IPv4 address space contains unique addresses.
Footnotes
-
IPv4 Address Structure - peachyPing - Detailed breakdown of IPv4 dotted-decimal notation, octets, binary conversion, and the network/host division determined by subnet masks. ↩ ↩2
Convert 172.16.254.1 to binary:
Octet 1: 172 172 − 128 = 44 → bit 7 = 1 44 − 64? No (44 < 64) → bit 6 = 0 44 − 32 = 12 → bit 5 = 1 12 − 16? No → bit 4 = 0 12 − 8 = 4 → bit 3 = 1 4 − 4 = 0 → bit 2 = 1 0 − 2? No → bit 1 = 0 0 − 1? No → bit 0 = 0 Result: 10101100
Octet 2: 16 → 00010000 Octet 3: 254 → 11111110 Octet 4: 1 → 00000001
Full binary: 10101100.00010000.11111110.00000001
Binary Conversion Shortcut
Memorize the 8-bit place values: 128, 64, 32, 16, 8, 4, 2, 1. When converting decimal to binary, subtract each value starting from 128. If it fits, write a 1 and subtract; if not, write a 0 and move to the next value. This left-to-right subtraction method is faster than repeated division by 2.
Network and Host Portions: The Role of the Subnet Mask
Every IPv4 address is logically divided into two parts:
- Network Portion — Identifies the specific network (like a street name).
- Host Portion — Identifies a specific device on that network (like a house number).
The subnet mask determines where this boundary falls. A subnet mask is a contiguous string of 1-bits (marking the network portion) followed by a contiguous string of 0-bits (marking the host portion) 2.
Example with 192.168.1.65 and mask 255.255.255.0 (/24):
| Component | Dotted-Decimal | Binary |
|---|---|---|
| IP Address | 192.168.1.65 | 11000000.10101000.00000001.01000001 |
| Subnet Mask | 255.255.255.0 | 11111111.11111111.11111111.00000000 |
| Network Address | 192.168.1.0 | 11000000.10101000.00000001.00000000 |
| Host Part | 0.0.0.65 | 00000000.00000000.00000000.01000001 |
The network address is obtained by performing a bitwise AND between the IP address and the subnet mask. The /24 in CIDR notation indicates that the first 24 bits are the network portion 2.
Footnotes
-
TCP/IP Addressing and Subnetting - Microsoft Learn - Comprehensive guide on how subnet masks divide IP addresses and how the TCP/IP stack determines local vs. remote hosts. ↩ ↩2
-
Subnet - Wikipedia - Defines subnetting, CIDR notation, the bitwise AND operation for network prefix determination, and subnet host count formulas. ↩ ↩2
Determining if Two Hosts Are on the Same Network
- 1Step 1
Identify the two IPv4 addresses and the shared subnet mask. Example: Host A = 192.168.1.65, Host B = 192.168.1.200, Subnet Mask = 255.255.255.0 (/24).
- 2Step 2
Host A: 11000000.10101000.00000001.01000001 Host B: 11000000.10101000.00000001.11001000 Mask: 11111111.11111111.11111111.00000000
- 3Step 3
AND the IP address of Host A with the subnet mask, bit by bit. 11000000.10101000.00000001.01000001 AND 11111111.11111111.11111111.00000000 = 11000000.10101000.00000001.00000000 Network A = 192.168.1.0
- 4Step 4
AND the IP address of Host B with the subnet mask, bit by bit. 11000000.10101000.00000001.11001000 AND 11111111.11111111.11111111.00000000 = 11000000.10101000.00000001.00000000 Network B = 192.168.1.0
- 5Step 5
If Network A == Network B, the two hosts are on the same network and can communicate directly (Layer 2). If they differ, a router is required. In this example: 192.168.1.0 == 192.168.1.0 → Same network. ✅
Public, Private, and Special-Use IPv4 Address Ranges
Not all IPv4 addresses are routable on the public internet. The Internet Assigned Numbers Authority (IANA) and the IETF have reserved specific ranges for private networks, loopback testing, link-local auto-configuration, and multicast communication 2.
Private Address Ranges (RFC 1918)
These addresses are used within internal networks and are not routable on the public internet. Network Address Translation (NAT) is used at the network boundary to map private addresses to public ones.
| RFC 1918 Range | CIDR Notation | Number of Addresses | Typical Use |
|---|---|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | Large enterprise networks | |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | Medium-sized organizations | |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | Home and small office networks |
Other Special-Use Ranges
| Range | CIDR | Purpose |
|---|---|---|
| 127.0.0.0 – 127.255.255.255 | 127.0.0.0/8 | Loopback — Used to test the local TCP/IP stack. Traffic to 127.0.0.1 (localhost) never leaves the device. |
| 169.254.0.0 – 169.254.255.255 | 169.254.0.0/16 | APIPA / Link-Local — Automatically assigned when no DHCP server is available. |
| 224.0.0.0 – 239.255.255.255 | 224.0.0.0/4 | Multicast — Used to send data to a group of hosts simultaneously (Class D). |
| 255.255.255.255 | /32 | Limited Broadcast — Sent to all hosts on the local network segment. |
| 0.0.0.0 | /32 | Unspecified — Represents "this network" or "any address" (used in routing and DHCP). |
Public addresses are all remaining IPv4 addresses that are globally routable on the internet, assigned by Regional Internet Registries (RIRs) such as ARIN, RIPE NCC, and APNIC .
Footnotes
-
IPv4 Private Address Space and Filtering - ARIN - Official ARIN reference on RFC 1918 private address ranges and filtering considerations for network operators. ↩ ↩2
-
TCP/IP Addressing and Subnetting - Microsoft Learn - Comprehensive guide on how subnet masks divide IP addresses and how the TCP/IP stack determines local vs. remote hosts. ↩
IPv4 Special-Use Address Space Allocation
Approximate number of addresses in each reserved range (log scale values shown for readability)
Reserved Host Addresses: Network ID and Broadcast
In any subnet, two addresses are always reserved and cannot be assigned to hosts: the Network Address (all host bits set to 0) identifies the network itself, and the Broadcast Address (all host bits set to 1) is used to send packets to every host on that subnet. For a /24 network, this means the usable host range is from .1 to .254, giving usable addresses.
Frequently Asked Questions on IPv4 Addressing
Knowledge Check
Which of the following best describes the purpose of a logical (IPv4) address compared to a physical (MAC) address?