How IPv4 addresses are represented
An IPv4 address is a 32-bit unsigned integer. The human-readable forms are all different ways of writing the same underlying number:
- Dotted decimal: four 8-bit octets, each written as a decimal
number 0–255, separated by periods. Example:
192.168.1.1. - Dotted binary: the same four octets, each expanded to 8 binary
digits. Example:
11000000.10101000.00000001.00000001. Used when working through subnet calculations by hand. - Hexadecimal: each octet as two hex digits. Example:
C0:A8:01:01. Common in packet captures, Cisco debug output, and low-level network programming. - 32-bit integer: the raw unsigned value. Example:
3232235777. Used in routing table comparisons, ACL evaluations, and bitwise operations in code.
Converting manually
To convert a decimal octet to binary, successively subtract powers of 2 starting from 128:
| Bit value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| Octet 192 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| Octet 168 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 |
192 = 128 + 64. 168 = 128 + 32 + 8. Each 1-bit means that power of 2 is included in the sum; each 0-bit means it is not.
Why binary matters for subnetting
Subnet masks work by bitwise AND with the IP address. The network address is the IP AND the mask — all host bits set to zero. The broadcast address sets all host bits to one. Understanding the binary representation lets you verify subnet boundaries without a calculator and catch common errors like non-contiguous masks.
Hexadecimal in network engineering
Hex appears in Cisco IOS debug output (debug ip packet), packet
captures (Wireshark shows IP addresses in hex in the raw bytes view), MAC addresses,
and IPv6 addresses. Being able to mentally convert a hex pair like C0
to 192 or FF to 255 is a useful skill for reading diagnostic output
quickly.