IPv4 Addressing (1)
An IPv4 address is just 32 bits — but everything a router does depends on how those bits are split between the network and the host. This lesson builds the address from the bits up, then shows you the classful rules and the private ranges you must know cold.
The anatomy of an IPv4 address
An IPv4 address is a 32-bit number. Writing all 32 bits every time would be unbearable, so we group them into four 8-bit blocks called octets and separate the octets with dots. Each octet holds a value from 0 to 255. Writing the address this way is called dotted-decimal notation.
192.168.1.77.Dotted decimal: 192 . 168 . 1 . 77 Binary (32 bits): 11000000.10101000.00000001.01001101 Octet index: 1 2 3 4
Remember the count: 4 octets × 8 bits = 32 bits. That number is a favourite exam check.
Why binary matters
Humans read decimal; hosts and routers read binary. The reason is that every important question about an address — which network is this? which part is the host? is this the broadcast address? — is answered with bit-level logic, especially the bitwise AND between an address and its mask. You cannot subnet reliably without seeing the bits.
An octet uses place values that double from right to left: 128, 64, 32, 16, 8, 4, 2, 1. A bit is either on (1, contributes its place value) or off (0, contributes nothing). To convert a decimal octet to binary, subtract the largest place value that fits, mark a 1, and repeat with the remainder. To convert binary to decimal, add the place values where the bits are 1.
| Bit position | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| Place value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Network portion vs host portion
Every IPv4 address is made of two logical parts:
- The network portion identifies which network the address belongs to. All hosts on the same network share this prefix.
- The host portion identifies the specific device (host) inside that network.
Because the boundary between the two parts is not written into the 32 bits, we need a second
value — the subnet mask — to tell us where the network bits end and the
host bits begin. A mask is also 32 bits: a run of 1s (network bits) followed by a run of 0s (host
bits). The prefix length is simply the count of leading 1s, written /n.
We will use masks in depth in Lesson 4; for now, know that the mask defines the split.
Default classful masks and class ranges
Before CIDR, IPv4 addresses were organised into classes, and each class came with a default mask that fixed the network/host boundary. These defaults are the foundation of subnetting, so learn them exactly:
| Class | Default prefix | Default mask | Network bits | Host bits |
|---|---|---|---|---|
| A | /8 | 255.0.0.0 | 8 | 24 |
| B | /16 | 255.255.0.0 | 16 | 16 |
| C | /24 | 255.255.255.0 | 24 | 8 |
255.0.0.0 is 8 ones (11111111.00000000.00000000.00000000), so it is /8.
255.255.0.0 is 16 ones → /16. 255.255.255.0 is 24 ones
→ /24. A full octet of 255 is 8 network bits; a 0 octet is 8 host bits.The class of a classful address is decided by its first octet. Ranges are
inclusive, and note carefully that 127 is carved out of Class A and
reserved for loopback.
| Class | First-octet range (decimal) | First-bit pattern | Purpose |
|---|---|---|---|
| A | 1 – 126 | 0xxxxxxx | Very large networks (unicast) |
| — | 127 | 01111111 | Loopback (e.g. 127.0.0.1) |
| B | 128 – 191 | 10xxxxxx | Medium networks (unicast) |
| C | 192 – 223 | 110xxxxx | Small networks (unicast) |
| D | 224 – 239 | 1110xxxx | Multicast |
| E | 240 – 255 | 1111xxxx | Experimental / reserved |
Note that Classes A, B, and C are the only classes used to address individual hosts; D is for
multicast groups and E is reserved. The loopback block is the whole network
127.0.0.0/8, and 127.0.0.1 is the standard loopback address you ping to test
your own TCP/IP stack.
Public vs private addresses
Not every IPv4 address may be used on the public Internet. Three blocks are reserved by RFC 1918 as private addresses. Private addresses can be used freely inside any home, office, or lab — they are reused all over the world — but they are not routable on the public Internet. To reach the Internet, a private host must pass through a device doing NAT (Network Address Translation), which rewrites its address to a public one.
| Block | Range | Default mask | Typical use |
|---|---|---|---|
| Private A | 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | Large enterprises |
| Private B | 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | Mid-size networks |
| Private C | 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | Home & small offices |
172.16.0.0/12 spans only
172.16.0.0 through 172.31.255.255 — not all of 172. Addresses such as
172.15.1.1 or 172.32.1.1 are public.Public addresses are globally unique and routable on the Internet; they are assigned by IANA and its regional registries, and leased to you by your ISP. A single public address at the edge, combined with NAT, is enough to give thousands of private hosts Internet access.
Worked conversions and key terms
Three conversions you should be able to do without thinking.
Example 1 — decimal to binary: convert 192.
192 ≥ 128 -> 1, remainder 64 64 ≥ 64 -> 1, remainder 0 32,16,8,4,2,1 -> 0 Result: 11000000
Example 2 — decimal to binary: convert 168.
Place: 128 64 32 16 8 4 2 1 Bits: 1 0 1 0 1 0 0 0 Check: 128 + 32 + 8 = 168 Result: 10101000
Example 3 — binary to decimal: convert 11000000.10101000.00000001.01001101.
11000000 = 128+64 = 192 10101000 = 128+32+8 = 168 00000001 = 1 = 1 01001101 = 64+8+4+1 = 77 Result: 192.168.1.77
01001101. Practice until you can do a full octet in a few seconds.Key terms
| Term | Meaning |
|---|---|
| Octet | An 8-bit group; an IPv4 address has four of them, each 0–255. |
| Dotted-decimal notation | Writing an IPv4 address as four decimal octets separated by dots. |
| Network portion | The leading bits that identify the network an address belongs to. |
| Host portion | The trailing bits that identify a specific device within the network. |
| Subnet mask | A 32-bit value whose 1s mark network bits and 0s mark host bits. |
| Prefix length | The number of leading 1s in the mask, written /n. |
| Classful addressing | The pre-CIDR scheme that fixes the network/host boundary by address class. |
| Private address | An RFC 1918 address usable only inside a private network, not routable on the Internet. |
| NAT | Network Address Translation; rewrites private addresses to public ones for Internet access. |
Review
Check what you have learned with these review questions.
Sources & references
- Postel, J. RFC 791: Internet Protocol (1981), Section 2.3 (Addressing) and Section 3.2 (classful address formats). rfc-editor.org/rfc/rfc791.
- Rekhter, Y. et al. RFC 1918: Address Allocation for Private Internets (1996). rfc-editor.org/rfc/rfc1918.
- Braden, R. RFC 1122: Requirements for Internet Hosts — Communication Layers (1989). rfc-editor.org/rfc/rfc1122.
- Cisco. CCNA (200-301) Exam Topics, IP Connectivity / IPv4 addressing. cisco.com.
Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.