Lesson

IPv4 Addressing

Learning objective

Read dotted-decimal addresses and prefixes and distinguish network, host, private, public, loopback, link-local, and documentation ranges.

Learning objective

Read an IPv4 address and prefix, separate its network and host portions, and recognize addresses that have special local purposes.

Read an IPv4 address

Where the address sits in an IPv4 packet

Swipe sideways to see all fields

IPv4 packet header format
Version · 4 bitsIHL · 4 bitsDSCP + ECN · 8 bitsTotal length · 16 bits
Identification · 16 bitsFlags + fragment offset · 16 bits
TTL · 8 bitsProtocol · 8 bitsHeader checksum · 16 bits
Source IPv4 address · 32 bits
Destination IPv4 address · 32 bits
Options + padding · optional
Payload · variable
The base header is 20 bytes; IHL gives the header size when options are present. TTL changes at each router. Cell widths here are schematic, not bit-proportional. Cell widths are schematic, not byte/bit proportional.

IPv4 identifies an interface with 32 bits. People normally write those bits as four octets, such as 192.0.2.44. Each octet contains eight bits and therefore ranges from 0 to 255. An address identifies a logical attachment to an IP network; it is not a permanent identity for the whole device.

Dotted decimal and binary

The positions in one octet have values 128, 64, 32, 16, 8, 4, 2, 1. Add the positions whose bits are 1. For example, 11000000 is 128 + 64, or 192. Dotted decimal is only a readable representation of the same binary value routers process.

Interactive binary explorer

Build one IPv4 octet

Each switch represents one binary place value. Toggle it and watch the decimal octet change.

192 = 11000000

Prefixes, network and host portions

The prefix length tells you how many leading bits form the network portion. The remaining bits form the host portion. In 192.0.2.44/24, the first 24 bits identify 192.0.2.0/24; the last eight select an address inside it. A prefix is not optional decoration—it changes the boundary.

Interactive address boundary

Reveal the network boundary

Choose an address scenario

192.0.2.44/24

Network: 192.0.2.0Broadcast: 192.0.2.255Network bits: 24Host bits: 8Type: documentation

Special address ranges

Not every syntactically valid address is a normal internet destination. Private ranges are commonly used inside organizations and are not globally routed by default. 127.0.0.0/8 is loopback for the local host. 169.254.0.0/16 is IPv4 link-local, often indicating that normal configuration failed. The documentation ranges 192.0.2.0/24, 198.51.100.0/24, and 203.0.113.0/24 are safe for examples. Public addresses are not automatically reachable, owned by you, or safe to expose.

Inspect address evidence

Use Windows ipconfig or Get-NetIPConfiguration, and Linux ip address, to verify the address and prefix on the interface that actually carries the traffic. Record the interface, address, prefix, gateway, and source of configuration. Do not assume that seeing an address proves the gateway or destination is reachable.

Troubleshoot addressing

  1. Confirm the active interface and its operational state.
  2. Validate every octet and the prefix length.
  3. Decide whether the destination is on-link or requires a gateway.
  4. Compare with a working neighbour instead of guessing.
  5. Treat a 169.254.x.x address as evidence to investigate automatic configuration—not as the root cause by itself.

Interview scenario

Show answer and reasoning
A workstation has 10.20.30.40/16, while its peers use /24. Explain how the longer perceived on-link scope can prevent it from sending some destinations to the gateway, then identify the smallest safe correction.

Knowledge check and summary

Knowledge check: How many bits are in an IPv4 address?
Knowledge check: What does /24 specify?
Knowledge check: Which address most strongly suggests an IPv4 link-local fallback?
IPv4 Addressing for Beginners