Skip to main content
TCP/IP Model Complete Guide
CHAPTER 05 Beginner

IP Addressing Complete Guide

Updated: May 15, 2026
20 min read

# CHAPTER 5

IP Addressing Complete Guide

1. Introduction

In the previous chapter, we established that IP addresses act as the postal addresses of the internet. However, an IP address is much more complex than a simple street number. It is a carefully engineered mathematical coordinate. To configure networks, troubleshoot connectivity, or secure cloud servers, a DevOps engineer must be able to read an IP address and instantly understand its scope, network boundaries, and routing behavior. In this chapter, we will dissect the anatomy of an IPv4 address, explore the critical distinctions between Public and Private IPs, and introduce the Subnet Mask.

2. Learning Objectives

By the end of this chapter, you will be able to:
  • Understand the dotted-decimal structure of an IPv4 address.
  • Differentiate between Public IP addresses and Private IP addresses.
  • Differentiate between Static and Dynamic IP assignments.
  • Explain the purpose of a Subnet Mask.
  • Read and interpret basic CIDR notation (e.g., /24).

3. Beginner-friendly Explanations

The Anatomy of IPv4: An IPv4 address looks like this: 192.168.1.50. It is made of 4 sections (called octets), separated by dots. Each section is a number ranging from 0 to 255. *(You will never see an IP address like 300.400.1.1, because 255 is the mathematical limit of an 8-bit binary number).*

Public vs. Private IP Addresses: Imagine an office building with 500 employees.

  • The Public IP: The building has one official mailing address: "123 Main Street." The postal service knows exactly where this is. This is a Public IP. It is unique across the entire global internet.
  • The Private IP: Inside the building, employee John has "Desk #4". The postal service has no idea where "Desk #4" is. "Desk #4" is a Private IP. It only matters *inside* the office.

Every device in your house (TV, phone, laptop) is assigned a Private IP (usually starting with 192.168.x.x). The global internet cannot see them. When your laptop requests a webpage, your home router translates your Private IP into your one, single Public IP address, and sends the request to the internet.

4. Static vs Dynamic IPs

How does a device actually get an IP address?
  • Static IP: You manually type the IP address into the computer's settings. It never changes. This is mandatory for things like Web Servers and Network Printers, because if their address changes, nobody will be able to find them!
  • Dynamic IP: When you connect your phone to Wi-Fi, it automatically asks the router, "Can I have an IP address?" The router temporarily leases an IP address to the phone using a protocol called DHCP. This is how 99% of consumer devices connect.

5. The Subnet Mask

An IP address actually contains two distinct pieces of information hidden inside it: the Network ID (the street) and the Host ID (the house number). How does the computer know which part of the IP is the street, and which part is the house? It uses the Subnet Mask.

A standard home Subnet Mask is: 255.255.255.0

  • The 255 means: "Lock this section down. This is the Network ID (the street)."
  • The 0 means: "This section can change. This is the Host ID (the house)."

So, if your IP is 192.168.1.50 and your mask is 255.255.255.0:

  • Your Network (Street) is: 192.168.1
  • Your Specific Device (House) is: 50

*Critical Rule:* If two computers have the same Network ID, they can talk to each other directly through a Switch. If their Network IDs are different, they MUST use a Router to communicate.

6. CIDR Notation

Writing out Subnet Mask: 255.255.255.0 is tedious. Network engineers use a shorthand called CIDR notation. Instead of writing the full mask, they write a slash followed by a number at the end of the IP address: 192.168.1.50/24

The /24 means "The first 24 bits (the first 3 sections) of this IP address are locked as the Network ID." In professional environments, you will almost exclusively see CIDR notation.

7. Configuration Examples

You can view your IP, Subnet Mask, and Gateway simultaneously.
bash
1234567
# Windows
ipconfig

# Linux / Mac
ifconfig
# or the modern Linux command:
ip a

8. Best Practices

  • Reserved IP Addresses: Never assign an IP address ending in .0 or .255 to a computer. In standard networks (/24), the .0 address is mathematically reserved as the "Network Name", and the .255 address is mathematically reserved as the "Broadcast Address" (an emergency loudspeaker used to shout a message to every device on the network simultaneously).

9. Common Mistakes

  • Leaking Private IPs: Beginners often post on forums asking for help and say, "My IP address is 192.168.1.10, why can't my friend connect to my Minecraft server?" They don't realize they gave their friend their *Private* IP, which is invisible to the outside world. They must give their friend their *Public* IP (found by Googling "What is my IP").

10. Mini Project: IP Calculation Exercise

Look at this configuration: IP: 10.0.5.42 Mask: 255.255.0.0
  1. 1. Look at the Mask. It has two 255s. That means the first two sections are the Network.
  1. 2. The Network ID is: 10.0
  1. 3. The Host ID is: 5.42
  1. 4. If a computer has the IP 10.0.99.100 on the same network, can they talk directly? Yes! Because they both start with the identical Network ID: 10.0.

11. Practice Exercises

  1. 1. Using CIDR notation, what is the equivalent of a 255.255.255.0 subnet mask?
  1. 2. Why is it dangerous (and often impossible) to assign a Static IP address to a laptop that moves between home and a coffee shop?

12. MCQs with Answers

Question 1

Which of the following IP addresses is universally recognized as a Private IP address format commonly used in home networks?

Question 2

What is the primary purpose of a Subnet Mask?

13. Interview Questions

  • Q: Explain the difference between a Public IP and a Private IP. How do they interact to provide internet access to a home network?
  • Q: What does the /24 indicate in the IP address 192.168.1.50/24?
  • Q: Explain why network servers usually require Static IP addresses instead of Dynamic IP addresses.

14. FAQs

Q: What is the IP address 127.0.0.1? A: This is the "Loopback" address (also known as localhost). It is a special IP address that points directly back to your own computer. Web developers use it to test websites locally before putting them on the internet.

15. Summary

In Chapter 5, we deciphered the numerical code of the internet. We learned that an IPv4 address is constrained to values between 0 and 255. We established the vital architectural difference between globally routable Public IPs and localized Private IPs, understanding how DHCP automatically handles Dynamic assignments. Finally, we decoded the Subnet Mask and CIDR notation, learning how to mathematically split an IP address into a Network ID (the street) and a Host ID (the house) to determine local connectivity boundaries.

16. Next Chapter Recommendation

We understand the default 255.255.255.0 subnet mask. But what if an enterprise needs to chop a massive network into 50 smaller, secure networks? Proceed to Chapter 6: Subnetting for Beginners.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·