Computer Networks

IPv4

32-bit addresses, dotted quad, fragmentation, and a header you should be able to sketch.

Level: beginner

What is it?

IPv4 is the 32-bit version of Internet Protocol. Addresses are usually written as four decimal octets, such as 192.0.2.10, and CIDR prefixes specify how many leading bits identify a network.

Why does it matter?

IPv4 addressing and subnetting are foundational for routing, DHCP configuration, access-control rules, NAT, and troubleshooting connectivity across LANs and WANs.

Mental model

A dotted-decimal address is simply 32 bits displayed in four groups of eight. A /24 prefix means the first 24 bits form the network prefix and the remaining eight bits identify addresses within that subnet.

How it works

  • Each octet represents a value from 0 through 255.
  • CIDR notation such as /24 expresses prefix length; a longer prefix leaves fewer host bits.
  • For a conventional IPv4 subnet, the all-zero host part identifies the network and the all-one host part is the directed broadcast, with special-purpose exceptions such as /31 point-to-point links.
  • The header includes source/destination addresses, protocol, TTL, and fields used for fragmentation and header integrity.
  • Private IPv4 ranges are not globally routed as public addresses; NAT is common but does not itself replace firewall policy.

Steps

  • Convert 192.0.2.10 to 32 bits: four octets, each eight bits.
  • Apply a /24 mask to identify 192.0.2.0 as the network prefix.
  • The host part is the final octet for /24.
  • Check routing, mask, gateway, and ACLs separately when diagnosing reachability.

Real-world usage

  • Calculating network and broadcast addresses.
  • Reading interface configurations and firewall rules.
  • Understanding the roles and limitations of NAT.

Common mistakes

  • Using the first three dotted octets as a universal subnet rule; prefixes can be any supported length.
  • Assuming every address ending in .255 is a broadcast address regardless of prefix.
  • Confusing private addressing with encryption or security.

Interview questions

How many bits are in an IPv4 address?

32 bits, commonly displayed as four decimal octets.

What does 192.0.2.10/24 mean?

The prefix is 24 bits; the conventional subnet is 192.0.2.0/24 with host addresses in the remaining eight bits, subject to special-address rules.

Prerequisites

Related concepts

Continue learning

Browse the full computer science library