Bird
Raised Fist0
Intro to Computingfundamentals~6 mins

IP addresses (IPv4, IPv6) in Intro to Computing - Full Explanation

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Introduction
Imagine you want to send a letter to a friend, but you need their exact home address to make sure it arrives. Computers on the internet face the same problem: they need a unique address to send and receive information. IP addresses solve this by giving every device a unique number, like a home address, so data can find its way.
Explanation
IPv4 Addresses
IPv4 addresses are made of four numbers separated by dots, like 192.168.1.1. Each number ranges from 0 to 255. This system allows about 4 billion unique addresses, which was enough when the internet was small but is now running out as more devices connect.
IPv4 uses four numbers separated by dots to give devices unique addresses but has a limited number of addresses.
IPv6 Addresses
IPv6 was created to solve the shortage of IPv4 addresses. It uses eight groups of four hexadecimal digits separated by colons, like 2001:0db8:85a3::8a2e:0370:7334. This system can create a huge number of unique addresses, enough for the internet to grow for a very long time.
IPv6 uses longer addresses with hexadecimal numbers and colons to provide many more unique addresses than IPv4.
Why Two Versions Exist
IPv4 was the first system and is still widely used, but it can't handle the growing number of devices. IPv6 was designed to fix this problem. Both versions work together during the transition period, so devices can communicate even if they use different IP versions.
IPv4 and IPv6 coexist because IPv6 solves IPv4's address shortage while allowing devices to communicate during the transition.
Structure and Uniqueness
Each IP address must be unique on the internet to avoid confusion, like no two houses having the same address on a street. The structure of IPv4 and IPv6 ensures this uniqueness by following strict rules on how addresses are formed and assigned.
IP addresses must be unique and follow specific formats to ensure data reaches the correct device.
Real World Analogy

Think of sending a postcard to a friend. You need their exact home address to make sure the postcard arrives. If the address is too short or missing parts, the mailman won't know where to deliver it. Similarly, computers need full and unique IP addresses to send information correctly.

IPv4 Addresses → A short home address with four parts, like street number, street name, city, and zip code.
IPv6 Addresses → A longer, more detailed home address with extra information to handle many more houses.
Why Two Versions Exist → Old neighborhoods with short addresses and new neighborhoods with longer addresses, both used during a city expansion.
Structure and Uniqueness → Each house having a unique address so mail doesn't get lost or delivered to the wrong place.
Diagram
Diagram
┌───────────────┐          ┌───────────────┐
│   IPv4        │          │    IPv6       │
│  192.168.1.1 │          │ 2001:0db8::1 │
└──────┬────────┘          └──────┬────────┘
       │                          │
       │          ┌───────────────┴───────────────┐
       │          │       Internet Devices        │
       └─────────>│  Communicate using IP Address  │
                  └───────────────────────────────┘
Diagram showing IPv4 and IPv6 addresses connecting devices on the internet using unique addresses.
Key Facts
IPv4An IP address format using four decimal numbers separated by dots, allowing about 4 billion unique addresses.
IPv6A newer IP address format using eight groups of hexadecimal numbers separated by colons, allowing vastly more unique addresses.
IP Address UniquenessEach IP address must be unique on the internet to ensure data reaches the correct device.
Transition PeriodThe time when both IPv4 and IPv6 are used together to allow devices with different IP versions to communicate.
Common Confusions
IPv4 and IPv6 are completely separate and cannot communicate.
IPv4 and IPv6 are completely separate and cannot communicate. IPv4 and IPv6 can communicate during the transition period using special methods like dual-stack or tunneling.
IPv6 addresses are just longer IPv4 addresses.
IPv6 addresses are just longer IPv4 addresses. IPv6 addresses use a different format with hexadecimal numbers and colons, not just longer decimal numbers.
Summary
IP addresses act like unique home addresses for devices to send and receive data on the internet.
IPv4 uses shorter addresses but is running out of unique numbers, while IPv6 uses longer addresses to provide many more.
Both IPv4 and IPv6 work together during a transition period to keep the internet connected.

Practice

(1/5)
1.

What is the main difference between an IPv4 and an IPv6 address?

easy
A. IPv4 addresses are longer than IPv6 addresses.
B. IPv4 uses eight hexadecimal groups separated by colons; IPv6 uses four decimal numbers separated by dots.
C. IPv4 addresses use letters only; IPv6 uses numbers only.
D. IPv4 uses four decimal numbers separated by dots; IPv6 uses eight hexadecimal groups separated by colons.

Solution

  1. Step 1: Understand IPv4 format

    IPv4 addresses have four numbers (0-255) separated by dots, like 192.168.1.1.
  2. Step 2: Understand IPv6 format

    IPv6 addresses have eight groups of hexadecimal numbers separated by colons, like 2001:0db8:85a3::8a2e:0370:7334.
  3. Final Answer:

    IPv4 uses four decimal numbers separated by dots; IPv6 uses eight hexadecimal groups separated by colons. -> Option D
  4. Quick Check:

    IPv4 = four decimals, IPv6 = eight hex groups [OK]
Hint: IPv4 = dots and decimals; IPv6 = colons and hex [OK]
Common Mistakes:
  • Confusing the separator symbols (dots vs colons)
  • Thinking IPv6 uses only numbers, not hex letters
  • Assuming IPv4 addresses are longer than IPv6
2.

Which of the following is a valid IPv4 address?

192.168.1.256
10.0.0.1
172.16.300.5
255.255.255.256
easy
A. 192.168.1.256
B. 10.0.0.1
C. 172.16.300.5
D. 255.255.255.256

Solution

  1. Step 1: Check each number range in IPv4

    Each number in IPv4 must be between 0 and 255 inclusive.
  2. Step 2: Validate each option

    192.168.1.256 has 256 (invalid), 10.0.0.1 all numbers valid, 172.16.300.5 has 300 (invalid), 255.255.255.256 has 256 (invalid).
  3. Final Answer:

    10.0.0.1 -> Option B
  4. Quick Check:

    Numbers must be 0-255 in IPv4 [OK]
Hint: IPv4 numbers must be 0 to 255 only [OK]
Common Mistakes:
  • Allowing numbers greater than 255
  • Confusing IPv4 with IPv6 format
  • Ignoring invalid last number in address
3.

What is the expanded form of the IPv6 address 2001:db8::1?

medium
A. 2001:0db8:0000:0000:0000:0000:0000:0001
B. 2001:db8:0:0:0:0:1
C. 2001:db8::0001
D. 2001:0db8::1

Solution

  1. Step 1: Understand IPv6 shorthand

    The double colon (::) means one or more groups of zeros are omitted.
  2. Step 2: Expand omitted zeros

    Replace :: with enough groups of 0000 to make total 8 groups: 2001:0db8:0000:0000:0000:0000:0000:0001.
  3. Final Answer:

    2001:0db8:0000:0000:0000:0000:0000:0001 -> Option A
  4. Quick Check:

    :: means fill zeros to total 8 groups [OK]
Hint: Expand :: to enough 0000 groups for 8 total [OK]
Common Mistakes:
  • Not filling enough zero groups
  • Leaving :: in expanded form
  • Mixing uppercase and lowercase hex letters
4.

Identify the error in this IPv6 address: 2001:0db8:85a3:0000:0000:8a2e:0370:7334:1234

medium
A. Too many groups; IPv6 must have exactly 8 groups
B. Invalid characters in groups
C. Groups must be separated by dots, not colons
D. Groups are too short; must be 5 digits each

Solution

  1. Step 1: Count groups in the address

    There are 9 groups separated by colons, but IPv6 requires exactly 8 groups.
  2. Step 2: Check group format

    All groups use valid hexadecimal digits and colons as separators, so no other errors.
  3. Final Answer:

    Too many groups; IPv6 must have exactly 8 groups -> Option A
  4. Quick Check:

    IPv6 = exactly 8 groups separated by colons [OK]
Hint: Count groups; IPv6 must have 8 groups [OK]
Common Mistakes:
  • Allowing more or fewer than 8 groups
  • Confusing colons with dots
  • Thinking group length must be fixed at 5 digits
5.

You have the IPv4 address 192.168.1.10 and want to convert it to an IPv6-mapped IPv4 address. Which is the correct IPv6 format?

hard
A. 2001:db8::192.168.1.10
B. ::192.168.1.10
C. ::ffff:c0a8:010a
D. 192.168.1.10::ffff

Solution

  1. Step 1: Understand IPv6-mapped IPv4 format

    IPv6-mapped IPv4 addresses use ::ffff: followed by the IPv4 address in hexadecimal.
  2. Step 2: Convert IPv4 to hex

    192 = c0, 168 = a8, 1 = 01, 10 = 0a; combined as c0a8:010a.
  3. Step 3: Form full IPv6 address

    Combine prefix and hex: ::ffff:c0a8:010a.
  4. Final Answer:

    ::ffff:c0a8:010a -> Option C
  5. Quick Check:

    IPv4 to hex after ::ffff: prefix [OK]
Hint: Convert IPv4 decimals to hex after ::ffff: prefix [OK]
Common Mistakes:
  • Using dotted decimal instead of hex in IPv6
  • Placing ::ffff: after IPv4 instead of before
  • Not converting IPv4 numbers to hexadecimal