Bird
Raised Fist0
Computer Networksknowledge~6 mins

IPv4 address structure in Computer Networks - Full Explanation

Choose your learning style10 modes available
Introduction
Imagine trying to send a letter to a friend without knowing their exact home address. Computers face a similar problem when they want to communicate over the internet. They need a unique address to find each other and send information correctly.
Explanation
IPv4 Address Format
An IPv4 address is made up of 32 bits divided into four groups called octets. Each octet contains 8 bits and is written as a decimal number between 0 and 255. These four numbers are separated by dots, forming the familiar format like 192.168.1.1.
An IPv4 address consists of four decimal numbers separated by dots, each representing 8 bits.
Network and Host Parts
The IPv4 address is split into two parts: the network part and the host part. The network part identifies the specific network, while the host part identifies a device within that network. The size of each part depends on the subnet mask used.
IPv4 addresses have a network part and a host part to locate devices within networks.
Subnet Mask
A subnet mask is a 32-bit number that helps separate the network and host parts of an IPv4 address. It uses ones (1s) to mark the network bits and zeros (0s) for the host bits. For example, 255.255.255.0 means the first three octets are the network part.
Subnet masks define which bits in an IPv4 address belong to the network and which belong to the host.
Address Classes
IPv4 addresses are grouped into classes (A, B, C, D, E) based on their first few bits. Classes A, B, and C are used for regular networks with different sizes, while D is for multicast and E is reserved. This classification helps organize address allocation.
IPv4 address classes organize networks by size and purpose using the first bits of the address.
Real World Analogy

Think of an IPv4 address like a street address. The network part is like the city name, and the host part is like the house number on a street. The subnet mask is like a rule that tells you how much of the address is the city and how much is the house number.

IPv4 Address Format → The full street address with city and house number separated by commas
Network and Host Parts → City name (network) and house number (host) parts of the address
Subnet Mask → The rule that tells which part of the address is city and which is house number
Address Classes → Different types of cities with varying sizes and purposes
Diagram
Diagram
┌───────────────┬───────────────┬───────────────┬───────────────┐
│   Octet 1     │   Octet 2     │   Octet 3     │   Octet 4     │
│ (8 bits)      │ (8 bits)      │ (8 bits)      │ (8 bits)      │
├───────────────┼───────────────┼───────────────┼───────────────┤
│ Network Part  │ Network/Host  │ Host Part     │ Host Part     │
│ (depends on   │ (depends on   │               │               │
│ subnet mask)  │ subnet mask)  │               │               │
└───────────────┴───────────────┴───────────────┴───────────────┘
This diagram shows the four octets of an IPv4 address and how the network and host parts are divided depending on the subnet mask.
Key Facts
IPv4 Address → A 32-bit number written as four decimal octets separated by dots.
Octet → A group of 8 bits in an IPv4 address, represented as a decimal number from 0 to 255.
Subnet Mask → A 32-bit number that separates the network and host parts of an IPv4 address.
Network Part → The portion of an IPv4 address that identifies the network.
Host Part → The portion of an IPv4 address that identifies a device within the network.
Address Classes → Categories of IPv4 addresses (A, B, C, D, E) based on the first bits to organize networks.
Common Confusions
Believing all four parts of an IPv4 address always represent the network.
Believing all four parts of an IPv4 address always represent the network. Only the bits marked by the subnet mask belong to the network; the rest identify the host.
Thinking the decimal numbers in IPv4 addresses are random.
Thinking the decimal numbers in IPv4 addresses are random. Each decimal number represents 8 bits of the 32-bit binary address, not random values.
Summary
IPv4 addresses are 32-bit numbers split into four decimal parts called octets.
Subnet masks define which part of the address is the network and which is the host.
Address classes help organize IPv4 addresses by network size and purpose.

Practice

(1/5)
1. What is the correct structure of an IPv4 address?
easy
A. Three numbers separated by dots, each from 0 to 255
B. Six numbers separated by colons, each from 0 to 65535
C. Four numbers separated by dots, each from 0 to 255
D. Four numbers separated by commas, each from 0 to 255

Solution

  1. Step 1: Understand IPv4 format

    An IPv4 address consists of four parts called octets, separated by dots.
  2. Step 2: Check the range of each octet

    Each octet ranges from 0 to 255, which fits in 8 bits.
  3. Final Answer:

    Four numbers separated by dots, each from 0 to 255 -> Option C
  4. Quick Check:

    IPv4 = 4 octets (0-255) [OK]
Hint: IPv4 always has 4 dot-separated numbers 0-255 [OK]
Common Mistakes:
  • Confusing IPv4 with IPv6 format
  • Using commas instead of dots
  • Incorrect number of parts
2. Which of the following is a valid IPv4 address?
easy
A. 10.0.0.1
B. 192.168.1.256
C. 172.16.300.5
D. 255.255.255

Solution

  1. Step 1: Check each octet's value

    Valid IPv4 octets must be between 0 and 255 inclusive.
  2. Step 2: Validate each option

    A has all octets 0-255 and 4 parts (valid). B: 192.168.1.256 has 256 (invalid), C has 300 (invalid), D has only 3 parts (invalid). Only A is valid.
  3. Final Answer:

    10.0.0.1 -> Option A
  4. Quick Check:

    All octets 0-255 and 4 parts = valid IPv4 [OK]
Hint: Check each number is 0-255 and count 4 parts [OK]
Common Mistakes:
  • Allowing numbers above 255
  • Ignoring missing octets
  • Confusing IPv4 with IPv6
3. What is the decimal value of the first octet in the IPv4 address 11000000.10101000.00000001.00000001?
medium
A. 255
B. 168
C. 1
D. 192

Solution

  1. Step 1: Convert first octet from binary to decimal

    Binary 11000000 equals 128+64=192.
  2. Step 2: Confirm decimal value

    The first octet decimal value is 192.
  3. Final Answer:

    192 -> Option D
  4. Quick Check:

    11000000 binary = 192 decimal [OK]
Hint: Convert binary octet to decimal by adding powers of 2 [OK]
Common Mistakes:
  • Misreading binary digits
  • Adding wrong powers of two
  • Confusing octet positions
4. Identify the error in this IPv4 address: 256.100.50.25
medium
A. Too many octets
B. The first octet is out of range
C. Octets must be separated by commas
D. The last octet is missing

Solution

  1. Step 1: Check each octet's value range

    IPv4 octets must be between 0 and 255 inclusive.
  2. Step 2: Identify invalid octet

    The first octet is 256, which is outside the valid range.
  3. Final Answer:

    The first octet is out of range -> Option B
  4. Quick Check:

    Octet > 255 means invalid IPv4 [OK]
Hint: Octets must be 0-255; 256 is invalid [OK]
Common Mistakes:
  • Thinking 256 is valid
  • Confusing separators
  • Ignoring octet count
5. You need to assign IP addresses to 300 devices in a network. Which of these IPv4 address ranges can you use without running out of addresses?
hard
A. 172.16.0.0 to 172.16.1.255
B. 10.0.0.0 to 10.0.0.127
C. 192.168.1.0 to 192.168.1.255
D. 192.168.0.0 to 192.168.0.100

Solution

  1. Step 1: Calculate number of addresses in each range

    Range A: 256 addresses (0-255), B: 128 addresses, C: 512 addresses (two full /24 blocks), D: 101 addresses.
  2. Step 2: Compare with required 300 devices

    Only range C has enough addresses (512) to cover 300 devices.
  3. Final Answer:

    172.16.0.0 to 172.16.1.255 -> Option A
  4. Quick Check:

    More than 300 addresses needed, only C fits [OK]
Hint: Count addresses: 256 per block; need ≥300 [OK]
Common Mistakes:
  • Assuming 256 addresses cover 300 devices
  • Ignoring address range size
  • Confusing IP blocks
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard