Fundamentals 13 min read

Mastering IP, CIDR, and MAC: A Practical Guide to Network Addressing

This guide explains how to view and interpret IP addresses on Windows and Linux, compares net‑tools with iproute2, clarifies IPv4 classful addressing versus CIDR, distinguishes public and private IP ranges, and details MAC addresses and network device flags for reliable networking.

JavaEdge
JavaEdge
JavaEdge
Mastering IP, CIDR, and MAC: A Practical Guide to Network Addressing

Viewing IP Information

On Windows use ipconfig; on Linux the traditional ifconfig command and the newer ip addr command both display network interfaces. ip addr is part of the iproute2 suite, which replaces the older net‑tools utilities that rely on /proc and ioctl calls.

net‑tools originated from BSD and has been unmaintained since 2001; many modern Linux distributions ship only iproute2 .

IPv4 Address Structure

An IPv4 address is a 32‑bit number shown in dotted‑decimal form (e.g., 192.168.10.208). The four octets represent the network and host portions; the address is analogous to a physical door number.

Because 32 bits provide only about 4 billion unique addresses, IPv4 exhaustion led to the creation of IPv6, a 128‑bit scheme that offers a vastly larger address space.

From Classful Networks to CIDR

Traditional class A/B/C networks split the address into a network ID and a host ID. CIDR (Classless Inter‑Domain Routing) replaces this with a prefix length, such as 10.100.122.2/24, where the first 24 bits denote the network and the remaining 8 bits denote hosts.

Broadcast address: network address with all host bits set to 1 (e.g., 10.100.122.255).

Subnet mask: a 32‑bit mask where network bits are 1 and host bits are 0 (e.g., 255.255.255.0).

Applying the mask with a bitwise AND yields the network ID ( 10.100.122.0 in the example).

Public vs. Private IP Ranges

Private IPv4 ranges (e.g., 192.168.0.0/16, 10.0.0.0/8) are used inside homes, offices, and data centers and can be reused across different organizations. Public IP addresses are globally unique and must be obtained from an Internet registry or an ISP.

Think of private addresses as apartment numbers within a building; public addresses are like street addresses assigned by the city.

Calculating a CIDR Example

For 16.158.165.91/22:

Network bits: first 22 bits → 16.158.164.0 is the network address.

Subnet mask: 255.255.252.0.

Broadcast address: 16.158.167.255.

MAC Addresses

A MAC address (e.g., fa:16:3e:c7:79:75) is a 48‑bit hardware identifier unique to each network interface. It functions like an identity card: globally unique but only useful within the same Layer‑2 broadcast domain.

IP addresses provide Layer‑3 routing capability, allowing packets to travel across different subnets, whereas MAC addresses are limited to the local link.

Network Device Flags

Linux network interfaces expose flags such as UP, BROADCAST, MULTICAST, LOWER_UP, and MTU. These indicate whether the interface is active, can send broadcast or multicast traffic, has a physical link, and its maximum transmission unit size.

Queueing Disciplines (qdisc)

The kernel uses a queuing discipline to schedule packets. The simplest is pfifo (first‑in‑first‑out). pfifo_fast adds three priority bands, with Band 0 having the highest priority. Packets are classified into bands based on the IP header's Type‑of‑Service (TOS) field.

Key Takeaways

IP addresses locate devices at Layer 3; MAC addresses identify hardware at Layer 2.

CIDR notation concisely expresses network and host portions and simplifies routing.

Private IP ranges are reusable internally; public IPs must be globally unique.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linux networkingMAC addressCIDRIP addressing
JavaEdge
Written by

JavaEdge

First‑line development experience at multiple leading tech firms; now a software architect at a Shanghai state‑owned enterprise and founder of Programming Yanxuan. Nearly 300k followers online; expertise in distributed system design, AIGC application development, and quantitative finance investing.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.