Kahibaro
Discord Login Register

IP addressing

Understanding IP Addresses

In this chapter we focus on how IP addressing works on Linux systems: what an IP address looks like, how it’s structured, and the key concepts you need when configuring or troubleshooting network interfaces.

This chapter assumes you already know in general what a network and an IP-based network are from the parent “Networking Fundamentals” chapter.

IPv4 vs IPv6 (High-Level View)

Two main versions are in use:

Most systems today use both; you’ll often see IPv4 for local networks and IPv6 increasingly used on the internet and modern ISPs.


IPv4 Address Structure

An IPv4 address is made of two logical parts:

Together with a subnet mask or prefix length, the system can tell which part is network and which part is host.

Example (CIDR form):

Here /24 is the prefix length: the first 24 bits are the network portion.

Subnet Masks and Prefix Lengths

A subnet mask is also a 32-bit number, often written in dotted decimal:

This corresponds to prefix length /24 because:

Modern notation tends to use prefix length (CIDR):

Both notations describe the same thing: how many bits are used for the network.


Network, Host, and Broadcast Addresses

For any IPv4 subnet, we can derive three important quantities from the IP address and prefix length.

Given:

Example: 192.168.1.0/24

Example: 10.0.0.0/30 (a very small subnet)

Linux tools like ip addr show will display the IP with CIDR notation; it’s up to you to understand what is network vs host and the usable range.


Private vs Public IPv4 Addresses

Some IPv4 ranges are private and not routable on the public internet. They’re meant for internal networks (home, office, datacenter):

Any IP outside those ranges (plus some special ranges) is generally public and can be routed on the internet.

In practice on Linux:

Loopback and Special IPv4 Addresses

Some special address ranges:

Basic IPv6 Address Structure

IPv6 uses 128-bit addresses, written in hexadecimal:

Conventions to shorten IPv6:

You can only use :: once in an address.

IPv6 also uses prefix lengths:

Common IPv6 Types

A few you’ll often see on Linux:

The concept of network vs host portions is similar to IPv4 but with larger sizes and different addressing rules.


Interfaces, Addresses, and Routes (Conceptual)

An IP address is always assigned to an interface (physical or virtual), not to the machine in the abstract.

On a Linux host:

IP addressing and routing are tightly linked:

Routing details are covered in the “Subnets and routing” chapter; here it’s enough to know that IP addresses plus their network definitions (prefix lengths) determine which destinations are “local” vs “remote”.


Configuring IP Addresses (Conceptual Overview)

You’ll use network configuration tools and config files (covered in other chapters) to set addresses. But regardless of the tool, you’ll always be specifying:

On Linux, IP settings may be:

Understanding the address and prefix is essential regardless of how they’re set.


Common Addressing Pitfalls

When diagnosing and planning IP schemes on Linux, watch for:

  1. Mismatched subnet masks/prefixes
    • One host: 192.168.1.10/24
    • Another: 192.168.1.20/16
    • They may treat different ranges as “local”, causing routing confusion.
  2. IP address conflicts
    • Two machines using 192.168.1.100/24 on the same network.
    • Symptoms:
      • Intermittent connectivity.
      • ARP table flapping (visible with tools like ip neigh).
  3. Wrong gateway for the subnet
    • Host IP is 10.0.1.10/24, but gateway set to 10.0.0.1.
    • They’re in different subnets; host can’t reach the gateway as a “local” neighbor.
  4. Using private addresses on the public side
    • WAN interface accidentally configured with 192.168.x.x, causing upstream issues.
    • Usually a network design problem.
  5. For IPv6
    • Relying only on link-local fe80:: addresses where you expect global connectivity.
    • Missing or incorrect prefix length (e.g. using /128 where /64 is needed for normal operation).

Understanding these typical failures helps you quickly narrow down IP-related issues before diving into more advanced tools.


Planning Addressing Schemes (Basic Concepts)

Even for a small lab or home network, it’s helpful to plan:

In formula form, for IPv4:

Use these formulas to estimate whether a subnet is too small or too big for your planned number of devices.


Summary

Key points you should be comfortable with before moving on:

These concepts will be used heavily when you learn about subnets, routing, and editing Linux network configuration files in the following chapters.

Views: 17

Comments

Please login to add a comment.

Don't have an account? Register now!