Chapter 16 of 28

IP Addressing

When devices communicate over a network, they need a way to identify where data should be sent. Just like a house needs an address to receive a letter, a device needs an IP address to communicate over an IP network.

IP Addressing is the system used to assign logical addresses to devices and networks so that data can be delivered to the correct destination.

An IP address is a logical address assigned to a network interface. It helps identify a device's location within an IP network and allows routers to forward packets toward their destination.

For example:

Computer A
IP: 192.168.1.10
       ↓
    Network
       ↓
Computer B
IP: 192.168.1.20

Here, the IP addresses help the network distinguish between the two devices.


Why Do We Need IP Addresses?

Imagine a network with hundreds or thousands of devices. How would a router know where a packet should go?

IP addressing solves this problem.

It allows networks to:

  • Identify network interfaces logically

  • Identify the source and destination of packets

  • Divide networks into smaller sections

  • Route packets between different networks

  • Organize large networks efficiently

For example, when you visit a website, your device sends packets toward the server's IP address.


Versions of IP

There are two major versions of the Internet Protocol:

  1. IPv4

  2. IPv6

Let's look at both.


IPv4 Address

IPv4 (Internet Protocol version 4) uses a 32-bit address.

It is normally written as four decimal numbers separated by dots.

Example:

192.168.1.10

Each part is called an octet and can have a value from 0 to 255.

For example:

192 . 168 . 1 . 10
 ↑     ↑    ↑    ↑
Octets

Since IPv4 has 32 bits, it provides about 4.3 billion possible addresses. With the huge growth of Internet-connected devices, IPv4 addresses became scarce, which is one reason IPv6 was developed.


IPv6 Address

IPv6 (Internet Protocol version 6) uses a 128-bit address.

It is written using hexadecimal numbers separated by colons.

Example:

2001:db8:1234:5678::1

IPv6 provides an enormous address space and was designed to support the continued growth of Internet-connected devices.

IPv4 vs IPv6

Feature

IPv4

IPv6

Address Size

32 bits

128 bits

Notation

Decimal

Hexadecimal

Example

192.168.1.10

2001:db8::1

Address Space

Smaller

Extremely large

Header

More complex in some areas

Simplified base header


Public and Private IP Addresses

IPv4 addresses are often discussed as public or private.

Private IP Address

A private IP address is used inside a private network, such as a home or office network.

Common IPv4 private ranges are:

Range

Example

10.0.0.0/8

10.0.0.5

172.16.0.0/12

172.16.5.10

192.168.0.0/16

192.168.1.20

For example, your laptop might have:

192.168.1.10

inside your home network.

Private addresses are not directly routable across the public Internet.

Public IP Address

A public IP address is an address that can be used for communication across the public Internet.

For example, your home router may have a public IP address assigned by your Internet Service Provider.


Static and Dynamic IP Addresses

IP addresses can also be classified based on how they are assigned.

Static IP Address

A static IP address is configured so that the address remains the same unless it is deliberately changed.

It can be useful for systems that need a predictable address, such as certain servers and network devices.

Dynamic IP Address

A dynamic IP address is assigned automatically and may change over time.

In IPv4 networks, DHCP (Dynamic Host Configuration Protocol) is commonly used to automatically assign IP configuration to devices.

Comparison

Static IP

Dynamic IP

Usually remains unchanged

Can change

Usually configured manually or through reservation

Commonly assigned automatically

Useful when a predictable address is needed

Convenient for ordinary clients

Requires more management

Easier to manage


Network Address and Host Address

In IPv4 subnetting, an address can be understood as having two logical parts:

  • Network portion

  • Host portion

The network portion identifies the network, while the host portion identifies an interface within that network.

For example, consider:

192.168.1.10/24

The /24 prefix means the first 24 bits identify the network.

So conceptually:

192.168.1 | 10
Network   | Host

The exact range of usable addresses depends on the subnet and addressing rules.


What Is a Subnet Mask?

A subnet mask is used with IPv4 to indicate which part of an address belongs to the network portion and which part belongs to the host portion.

For example:

IP Address:
192.168.1.10

Subnet Mask:
255.255.255.0

This is equivalent to:

192.168.1.10/24

The /24 is called CIDR notation and indicates that the first 24 bits are the network prefix.


What Is a Default Gateway?

A default gateway is the device a host uses to send traffic to destinations outside its local network.

In a typical home network, the default gateway is usually the router.

For example:

Laptop
192.168.1.10
      |
      ↓
Router
192.168.1.1
      |
      ↓
Internet

If the laptop wants to communicate with a device on another network, it sends the traffic to the router.


How IP Addressing Works

Suppose your computer wants to access a server on another network.

A simplified process looks like this:

Your Computer
     ↓
Destination IP Address
     ↓
Router
     ↓
Other Networks
     ↓
Destination Server

Routers examine the destination IP address and use their routing information to determine where to forward the packet.

This process allows packets to travel across multiple interconnected networks.


IP Address vs MAC Address

IP addresses and MAC addresses are both important, but they have different jobs.

IP Address

MAC Address

Network-layer address

Link-layer address

Used for routing between networks

Used mainly for local-link delivery

IPv4: 32 bits, IPv6: 128 bits

Common Ethernet MAC: 48 bits

Can change with network configuration

Can be locally changed or randomized

Used by IP

Used by technologies such as Ethernet and Wi-Fi

A simple way to remember it:

IP address tells the network where to send the packet.

MAC address helps deliver the frame on the local network.


Simple Real-Life Example

Suppose you connect your laptop to your home Wi-Fi.

Your router may assign:

Laptop:
IP Address:     192.168.1.10
Subnet Prefix:  /24
Gateway:        192.168.1.1

Now you open a website.

Your laptop creates packets containing the appropriate destination IP information. If the destination is outside your local network, the packets are sent to the default gateway. Routers then forward them across different networks until they reach the destination.

So, something as simple as opening a website involves IP addressing and routing working together behind the scenes.

Conclusion

IP addressing is the system used to logically identify interfaces and networks so that IP packets can be delivered and routed correctly.

The two major versions are IPv4 and IPv6. IPv4 uses 32-bit addresses, while IPv6 uses 128-bit addresses.

You should especially understand these concepts:

  • IPv4 and IPv6

  • Public and private IP addresses

  • Static and dynamic addressing

  • Subnet masks and CIDR

  • Network and host portions

  • Default gateway

Once these basics are clear, topics like subnetting, routing, DHCP, NAT, and IPv6 become much easier to understand.