Beginner

IP Addressing and Subnetting

Private IPv4 ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.

Table of Contents

This reference covers the foundation knowledge required to work confidently with IP addressing and subnetting: binary and hexadecimal numbering systems, IPv4 addressing and subnet masks, classless inter-domain routing (CIDR) and Variable Length Subnet Masking (VLSM), private versus public addressing, IPv6 addressing, and the fundamentals of routing and routing tables.


Module 1: Understanding IPv4

Understanding Binary and Decimal Conversion

Binary is a base-2 numbering system that only uses the digits 0 and 1. These digits are called bits, and they correspond to the on/off states used in electronics (1 = on, 0 = off). Bits are the fundamental unit used to represent data and instructions in computing, and they determine how much data can be stored or how fast it can be transmitted over a network.

Two key units of measurement must be distinguished:

  • A bit (lowercase b) is the smallest unit of data — a single 1 or 0. Bits are used to measure network transmission speed (bits per second, e.g. megabits per second, gigabits per second).
  • A byte (uppercase B) is a unit of 8 bits. Bytes are used to measure storage capacity (e.g. gigabytes or terabytes of RAM or disk space).

When counting in decimal, columns are used for units, tens, hundreds, and so on. Binary uses the same positional principle, but each column represents a power of 2 instead of a power of 10:

Binary column1286432168421

To convert binary to decimal, add up the value of every column containing a 1. For example:

  • 00000000 = decimal 0
  • 00000001 = decimal 1
  • 00000010 = decimal 2
  • 00000011 = decimal 3
  • 00000100 = decimal 4
  • 11111111 = decimal 255 (all eight bits set to 1)

A critical fact to remember: eight binary 1s equal decimal 255. Also remember that counting starts at 0, so the range 0 to 255 actually represents 256 distinct values (0 is a number too).

In practice, binary/decimal conversions are usually performed with a calculator rather than by hand. The built-in Windows Calculator (in “Programmer” mode), or the equivalent calculator app on macOS/Linux, can instantly convert between decimal, binary, and hexadecimal. For example, entering decimal 255 shows the binary equivalent 11111111, and entering binary 100 shows the decimal equivalent 4.

flowchart LR
    A["Decimal number\ne.g. 255"] -->|"Convert using\npositional binary columns\n128 64 32 16 8 4 2 1"| B["Binary number\ne.g. 11111111"]
    B -->|"Sum the columns\nwhere bit = 1"| A

Applying Binary to a 32-bit Address Scheme

Before diving into the numbers, it helps to place IP in context. The OSI model and the TCP/IP model are reference models used throughout networking for troubleshooting and architecture. IP (Internet Protocol) is a Layer 3 protocol used to identify network devices and route traffic — it is fundamentally about addressing.

There are two versions of IP in common use today: IPv4 and IPv6. (An IP version 5 did exist, introduced in the late 1970s/1980s as an experimental streaming protocol, but it never gained traction and was never adopted as a general-purpose replacement — IPv6 became that replacement.)

IPv4 addresses are used for three main types of communication:

Address typeDescription
UnicastOne-to-one communication between two devices
BroadcastOne-to-all communication on the local subnet (a device “shouts” to every device on the subnet)
MulticastOne-to-many communication, e.g. to support high-availability clusters such as web or database server farms

IPv4 is a 32-bit address scheme broken into two logical parts:

  1. The subnet address (a.k.a. network address)
  2. The unique host identifier — the specific computer on that network

The 32 bits are split into four sections of 8 bits each, called octets, separated by dots and normally represented in decimal — this is known as dotted-decimal notation, which is easier for humans to read than raw binary.

Worked example — converting 192.168.2.20 to binary:

OctetDecimalBinary
1st19211000000
2nd16810101000
3rd200000010
4th2000010100

Concatenated, the computer sees this address as a single 32-bit string:

11000000.10101000.00000010.00010100

The problem is that, by itself, this string of 1s and 0s does not tell you (or the computer) where the network address ends and the host identifier begins. That distinction is solved by the subnet mask.

flowchart TB
    subgraph IPv4["32-bit IPv4 Address (4 octets of 8 bits)"]
    O1["Octet 1\n11000000\n(192)"] --- O2["Octet 2\n10101000\n(168)"] --- O3["Octet 3\n00000010\n(2)"] --- O4["Octet 4\n00010100\n(20)"]
    end

Understanding IPv4 Subnet Masks

A useful analogy for the network-address/host-identifier split is postal addressing: a zip code / postcode identifies the street, and a house number identifies the specific residence on that street. Different countries format postcodes differently (5-digit US zip codes vs. the more complex UK alphanumeric postcodes), so a fixed, unambiguous rule is needed to separate “network” from “host” in an IP address.

An IT system does this by placing a binary 1 under every bit that belongs to the network address portion, and a binary 0 under every bit that belongs to the host identifier portion. This bit pattern is the subnet mask.

Using the earlier example of 192.168.2.20 on the first three octets being network and the last octet being host:

Address:     11000000.10101000.00000010.00010100
Subnet mask: 11111111.11111111.11111111.00000000

A subnet mask is normally recorded in one of two ways:

  • Dotted-decimal notation: converting eight 1s per octet to decimal gives 255.255.255.0.
  • Slash (CIDR) notation: simply counts the total number of 1 bits used for the network portion. Three full octets of 1s = 8 + 8 + 8 = 24 bits, so this is written as /24.
flowchart LR
    A["Subnet mask in binary\n11111111.11111111.11111111.00000000"] --> B["Dotted-decimal\n255.255.255.0"]
    A --> C["Slash / CIDR notation\n/24"]

Understanding IPv4 Subnetting and Classful Addressing

Historically, IPv4 addressing used classful addressing, dividing the address space into five classes based on their subnet mask length:

ClassSubnet maskCIDRPurposeUsable hosts per network
A255.0.0.0/8Very large networks16,777,214
B255.255.0.0/16Large/medium networks65,534
C255.255.255.0/24Small networks254
D(reserved)Multicast addressingn/a
E(reserved)Testing / experimental usen/a

Classful addressing is rarely used today because it is highly inflexible — a single Class A network with over 16.7 million possible hosts, or a Class B network with over 65,000 hosts, is unrealistic to deploy on a single broadcast domain. Class C, allowing 254 hosts, is more practical and is commonly still seen as the default subnet mask on small business/home routers.

Other notable IPv4 addresses worth remembering:

Address / RangePurpose
127.0.0.1Loopback address — lets a device/application communicate with itself
255.255.255.255Broadcast address (32 binary 1s) — used by various protocols for discovery/diagnostics
169.254.x.x (APIPA)Automatic Private IP Addressing — a Class B reserved range (/16, i.e. 255.255.0.0) that a device self-assigns when it cannot obtain an address from DHCP. A device found with a 169.254.x.x address indicates it failed to reach a DHCP server — a key troubleshooting signal

Calculating usable hosts — even though classful addressing is largely obsolete, the underlying math is the foundation for all subnetting. Take a Class C network 192.168.2.0 /24:

  • Subnet mask 255.255.255.0 → 8 bits remain for the host portion.
  • 8 bits can represent decimal values 0 through 255 → that is 256 possible values (remembering that 0 counts as a value).
  • Golden rule: the all-zeros host value is reserved as the network address, and the all-ones host value is reserved as the broadcast address for that subnet. This means 2 addresses must always be subtracted from the total when calculating usable hosts.
  • Usable hosts = 256 − 2 = 254, with a usable range of .1 through .254.

Classful addressing’s downsides — inflexibility, inefficiency, and reduced security — led to the development of Classless Inter-Domain Routing (CIDR). CIDR allows subnet boundaries to fall anywhere, enabling proper subnetting and Variable Length Subnet Masking (VLSM), which in turn allows for far more efficient routing table entries, better scalability, and more efficient use of address space.

flowchart TD
    A["IPv4 Addressing"] --> B["Classful Addressing\n(Class A/B/C/D/E)"]
    A --> C["Classless Inter-Domain Routing (CIDR)"]
    B --> B1["Fixed mask boundaries\nInflexible / Inefficient / Insecure\nLargely obsolete"]
    C --> C1["Flexible subnet boundaries"]
    C1 --> D["Subnetting"]
    D --> E["Variable Length Subnet Masking (VLSM)"]
    E --> F["Efficient routing table entries\nScalability & flexibility"]

Implementing Variable Length Subnet Masking – Part 1

Variable Length Subnet Masking (VLSM) allows a network engineer to:

  • Break up large IP blocks for more efficient utilization
  • Achieve scalability and improved security
  • Simplify and summarize routing tables

A very effective manual technique for these calculations is the 256 Chart. It is a simple reference chart (not binary itself, just a memory aid) built as follows:

  • Top row: starts at 2 in the right-hand column and doubles all the way up to 256. This row tells you the number of subnets you can create, or the number of hosts available (remembering to subtract 2 for the network/broadcast addresses).
  • Bottom row: starts at 1 (right-hand column) and increases up to 8. This row tells you the number of bits required to achieve that many subnets/hosts.
Bits (bottom row)12345678
Subnets/Hosts (top row)248163264128256

For example, starting subnet 192.168.2.0 /24 has 8 host bits remaining. Looking up “8” in the bottom row shows “256” above it in the top row. Applying the golden rule (subtract 2), this confirms 254 usable hosts on a /24 — consistent with the earlier calculation.

Worked Example 1 — dividing one /24 subnet into 8 equal subnets

Starting point: 192.168.2.0 /24 (254 hosts), and the requirement is to split it into 8 equal subnets.

  1. Look up “8” (subnets required) in the top row of the 256 Chart → the bottom row shows 3 bits are needed.
  2. Add those 3 bits to the existing /24 → new mask is /27 (24 + 3).
  3. In binary, /27 is 11111111.11111111.11111111.11100000, or in dotted decimal, 255.255.255.224.
  4. Bits remaining for hosts = 32 − 27 = 5 bits.
  5. Looking up “5” in the 256 Chart’s bottom row shows “32” above it. Subtracting 2 gives 30 usable hosts per subnet.
  6. To find the increment value between subnets, use binary: the 3 bits added to the mask land under the 32s column of the 4th octet, so subnets increment by 32.

Binary column reference used to derive the increment value:

128  64  32  16  8  4  2  1
                    <- 3 new mask bits landed here, last one under the 32 column

This produces the following 8 subnets:

Subnet #Network addressCIDRUsable host rangeBroadcast address
1192.168.2.0/27192.168.2.1 – 192.168.2.30192.168.2.31
2192.168.2.32/27192.168.2.33 – 192.168.2.62192.168.2.63
3192.168.2.64/27192.168.2.65 – 192.168.2.94192.168.2.95
4192.168.2.96/27192.168.2.97 – 192.168.2.126192.168.2.127
5192.168.2.128/27192.168.2.129 – 192.168.2.158192.168.2.159
6192.168.2.160/27192.168.2.161 – 192.168.2.190192.168.2.191
7192.168.2.192/27192.168.2.193 – 192.168.2.222192.168.2.223
8192.168.2.224/27192.168.2.225 – 192.168.2.254192.168.2.255

Note that 192.168.2.224 + 32 = 256, which cannot fit in an octet (maximum value 255) — confirming that subnet 8 is the final subnet available from this /24 block.

The companion reference guide for this course captures the same 256 Chart technique with a slightly condensed walkthrough of a 4-subnet version of this exact scenario:

With a starting subnet of 192.168.2.0 /24 (1 subnet, 254 hosts), divide it into 4 equal subnets. Look up 4 on the top row of the 256 Chart and read the bits needed below it — 2 bits. New mask = /26 (24 + 2). Remaining host bits = 6, so 64 possible values minus 2 = 62 usable hosts per subnet. The increment value, found using the binary columns 128 64 32 16 8 4 2 1, is 64 (the last of the 2 new mask bits lands under the 64s column).

Resulting subnets: 192.168.2.0/26, 192.168.2.64/26, 192.168.2.128/26, 192.168.2.192/26, with usable host ranges 192.168.2.1–62, 192.168.2.65–126, 192.168.2.129–190, and 192.168.2.193–254 respectively (always remembering to reserve the broadcast address on each subnet).

flowchart TD
    A["Start: 192.168.2.0 /24\n254 hosts"] --> B{"How many subnets\nneeded?"}
    B -->|"4"| C["Look up 4 in 256 Chart\n→ 2 extra bits\nNew mask /26"]
    B -->|"8"| D["Look up 8 in 256 Chart\n→ 3 extra bits\nNew mask /27"]
    C --> E["6 host bits left\n64 − 2 = 62 hosts/subnet\nIncrement = 64"]
    D --> F["5 host bits left\n32 − 2 = 30 hosts/subnet\nIncrement = 32"]

Implementing Variable Length Subnet Masking – Part 2

Worked Example 2 — creating 5 subnets of variable sizes (true VLSM)

This scenario models a small organization (e.g. a school) with different host requirements per subnet:

SubnetPurposeHosts required
1Classroom30
2Classroom30
3Smaller classroom / lab14
4Administrative office6
5Administrative office6

Using the 256 Chart to size each subnet’s mask (starting from a base of /24, 32 total bits):

SubnetHosts needed256 Chart lookupBits requiredNew CIDR (32 − bits, or 24 + bits added)
130column “32”5 bits/27
230column “32”5 bits/27
314column “16”4 bits/28
46column “8”3 bits/29
56column “8”3 bits/29

The increment value changes for each subnet size because a different number of host bits remain:

  • /27 subnets (5 host bits) → increment value 32
  • /28 subnet (4 host bits) → increment value 16
  • /29 subnets (3 host bits) → increment value 8

Building the address plan sequentially, starting from 192.168.2.0:

SubnetCIDRNetwork addressUsable host rangeBroadcast address
1/27192.168.2.0192.168.2.1 – 30192.168.2.31
2/27192.168.2.32192.168.2.33 – 62192.168.2.63
3/28192.168.2.64192.168.2.65 – 78192.168.2.79
4/29192.168.2.80192.168.2.81 – 86192.168.2.87
5/29192.168.2.88192.168.2.89 – 94192.168.2.95

Notes on the derivation:

  • Subnet 3 starts immediately after subnet 2’s broadcast address (192.168.2.63), at 192.168.2.64, then increments by 16 (its own increment value) to reserve the block up to .79.
  • Subnet 4 starts at 192.168.2.80 and, being a /29 with increment value 8, its usable range is .81.86 with broadcast .87.
  • Subnet 5 starts at 192.168.2.88; continuing the increment pattern, the next available network after subnet 5 would be 192.168.2.96.
flowchart LR
    S1["Subnet 1 /27\n.0 (1-30)"] --> S2["Subnet 2 /27\n.32 (33-62)"]
    S2 --> S3["Subnet 3 /28\n.64 (65-78)"]
    S3 --> S4["Subnet 4 /29\n.80 (81-86)"]
    S4 --> S5["Subnet 5 /29\n.88 (89-94)"]
    S5 --> S6["Next available\n.96"]

Mastering VLSM is primarily a matter of practice: repeat this 256-Chart-based method against different scenarios (mapped to a real or hypothetical organization) until the workflow becomes second nature.

Understanding Private and Public Networking

IPv4 address space is split into two categories:

  • Public IP addresses — used on public networks such as the internet, allocated by an Internet Service Provider (ISP). Most organizations only need a single public IP address to reach the internet.
  • Private IP addresses — used on internal/private networks, not routable on the public internet. They can be assigned manually (static) or automatically via DHCP (Dynamic Host Configuration Protocol). An organization can use and subnet as many private addresses as needed.
Private IPv4 rangeCIDR block
10.0.0.0 – 10.255.255.25510.0.0.0/8
172.16.0.0 – 172.31.255.255172.16.0.0/12
192.168.0.0 – 192.168.255.255192.168.0.0/16

To reach the internet, private-network traffic must pass through a router (a Layer 3 network device) using Network Address Translation (NAT). NAT allows many internal devices, each with a private address, to share a single public IP address provided by the ISP. Variants of NAT exist, including Port Address Translation (PAT). NAT typically sits alongside the firewall function on the router, keeping internal private addresses hidden from external view. The local router that performs this function is commonly referred to as the default gateway.

flowchart LR
    subgraph Internal["Internal / Private Network"]
    PC1["Host A\n192.168.1.10"] --> GW
    PC2["Host B\n192.168.1.11"] --> GW
    GW["Default Gateway / Router\n(NAT + Firewall)"]
    end
    GW -->|"Single Public IP\n(via NAT)"| Internet(("Public Internet"))

Demo: Translating IPCONFIG and IFCONFIG Output

This walkthrough translates real-world command output into the addressing concepts covered above.

Windows — ipconfig

ipconfig

Typical output includes the IPv4 address, subnet mask, default gateway, and a link-local IPv6 address. For example, if the output shows:

IPv4 Address. . . . . . . . . . . : 192.168.195.128
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.195.2

Since the mask is /24 (three full octets), the network address is 192.168.195.0, and this specific host is number 128 on that network. The default gateway lives on the same subnet, at host .2.

For a fuller picture, including the adapter’s physical (MAC) address and DHCP information:

ipconfig /all

This reveals the computer name, the network adapter’s physical (MAC) address, confirmation that the address was leased from a DHCP server, and the location of the DNS servers (also typically supplied by DHCP) — all useful first steps in diagnosing local network connectivity issues.

Linux — ifconfig

ifconfig

The output format differs from Windows but exposes similar information: the IPv4 address and subnet mask, the subnet’s broadcast address (the .255 equivalent), the adapter’s MAC address, the IPv6 address, and the loopback address.

To find the default gateway on Linux, several tools can be used. One convenient approach is to filter the routing table output for the keyword default:

ip route | grep default

This surfaces the default gateway address along with information related to the DHCP-assigned configuration.

A useful exercise: run ipconfig (Windows) or ifconfig (Linux) to see your private/internal IP address, then open a browser and search “what’s my IP address” to see your public IP address as seen from the internet (assigned by your ISP). Comparing the two clearly demonstrates the difference between a private internal address and the single public address used for NAT, and also identifies your local network’s address range and default gateway.


Module 2: Understanding IPv6

Understanding the Need for IPv6

IPv4 is a 32-bit address scheme supporting approximately 4.3 billion addresses. While that sounded like a large number initially, it was clear by the late 1980s that it would not be sufficient to support an expanding internet — a shortage made more acute by the explosive growth of mobile devices, the Internet of Things (IoT), and cloud computing resources.

IPv6 was introduced specifically to address this shortage. It is a 128-bit address scheme — four times the bit-length of IPv4 — supporting approximately 340 undecillion addresses (a 1 followed by 36 zeros). This address space is so vast that exhaustion is not a realistic near-term concern.

Key benefits of IPv6:

  • Enormous scalability due to the huge address space
  • Improved routing efficiency
  • Simplified network configuration
  • Built-in security via IPSec (IP Security), providing integrated authentication and encryption

IPv6 was designed to coexist with IPv4, and the two protocols are expected to run side by side on networks for the foreseeable future.

flowchart LR
    A["IPv4\n32-bit\n~4.3 billion addresses"] -->|"Address exhaustion\ndriven by mobile/IoT/cloud growth"| B["IPv6\n128-bit\n~340 undecillion addresses"]
    B --> C["Coexists with IPv4\n(dual-stack networks)"]

Understanding Hexadecimal Systems

Hexadecimal (hex) is a base-16 numbering system widely used in IT — for example, to represent large binary numbers such as IPv6 addresses, and also MAC (physical) addresses.

Hex uses the digits 09, and then, having run out of single digits, continues with letters AF to represent values 10–15. One hexadecimal digit represents exactly 4 bits of binary.

DecimalBinaryHexadecimal
0–90000–10010–9 (same as decimal)
101010A
111011B
121100C
131101D
141110E
151111F
409610000000000001000

The benefit of hex becomes obvious at scale: decimal 4096 requires a lengthy binary string but only 4 hex digits (1000). A full 128-bit IPv6 address written out in raw binary would be extremely long and impractical for humans to read or write — hexadecimal notation solves this readability problem.

As with binary/decimal conversions, the built-in calculator app (in “Programmer” mode on Windows, or the equivalent on macOS/Linux) can instantly convert between hexadecimal, decimal, and binary — simply switch the calculator’s numbering-system mode.

flowchart LR
    A["1 hex digit"] -->|"represents"| B["4 binary bits"]
    C["128-bit IPv6 address"] -->|"grouped into"| D["32 hex digits\n(8 groups of 4 hex digits\n= 8 hextets)"]

Introducing IPv6 Addressing

An IPv6 address is a 128-bit value written as eight 16-bit hexadecimal segments, called hextets, separated by colons. Structurally:

  • The first 64 bits represent the network prefix (used for routing, and where subnetting is performed).
  • The last 64 bits represent the interface identifier (the unique host portion).

Example full-form IPv6 address:

2001:0db8:0000:0042:0000:0000:0000:0329

Unlike IPv4, IPv6 does not use dotted-decimal subnet masks — subnetting is instead performed within the network-prefix portion of the address, and prefix length is expressed using slash notation (e.g. /64). Addresses may be statically assigned or automatically configured (e.g. via DHCPv6 or SLAAC — see below).

Shortening rules — because full IPv6 addresses are long, two conventions are used to shorten them for readability:

  1. Remove leading zeros within each hextet: a hextet with leading zeros (e.g. 0db8) can be written without them (db8); the system understands the omitted digits are zero.
  2. Compress consecutive all-zero hextets using a double colon (::): any run of one or more consecutive all-zero hextets can be replaced with ::. This shorthand can only be used once per address — if used more than once, the number of zero hextets each :: represents becomes ambiguous and cannot be reconstructed.

Applying both rules to the example above:

Full:       2001:0db8:0000:0042:0000:0000:0000:0329
Step 1:     2001:db8:0:42:0:0:0:329       (leading zeros removed)
Step 2:     2001:db8:0:42::329            (consecutive all-zero hextets compressed)
flowchart TD
    A["Full IPv6 address\n8 hextets, 128 bits"] --> B["Remove leading zeros\nper hextet"]
    B --> C{"Any consecutive\nall-zero hextets?"}
    C -->|"Yes (only once allowed)"| D["Replace with ::"]
    C -->|"No"| E["Address fully shortened"]
    D --> E

Understanding the Types of IPv6 Addresses

Address typeDescriptionTypical prefix
Global Unicast Address (GUA)Public, routable IPv6 address, similar in role to a public IPv4 address; assigned by the ISP. Removes the need for NAT on internal networksVaries (globally routable)
Unique Local Address (ULA)Private IPv6 address for internal-only networks; not routable on the public internetFC00::/7 (commonly seen as FC or FD, depending on usage)
Link-Local AddressSelf-assigned address automatically generated by a device for communication on its local link onlyFE80::/10
Loopback AddressEquivalent to IPv4’s 127.0.0.1 — used for a device to communicate with itself::1 (127 zero-bits followed by a 1)
MulticastOne-to-many communication, conceptually similar to IPv4 multicast (IPv6 does not use broadcast in the traditional sense)FF00::/8
AnycastA variation of multicast where a group of interfaces shares an address, but only the closest device (by routing distance) responds — an efficient way to reach the “nearest” available service instanceAllocated from Unicast space

Demo — inspecting IPv6 configuration on Windows

ipconfig /all

On a wireless adapter with DHCP enabled, this typically reveals:

  • A static Unique Local Address, used to communicate with other devices on the local network.
  • A temporary IPv6 address, which rotates regularly and is generally used for outbound internet browsing (a privacy feature).
  • An automatically configured link-local address, identifiable by its FE80:: prefix. It may appear suffixed with a zone index (e.g. %10), which identifies the specific network interface the address belongs to.
  • An IPv6-assigned DNS server address, automatically configured via DHCP.

Link-local addresses support the Neighbor Discovery Protocol, which lets a device discover other devices on the same network link. This relies on Stateless Address Autoconfiguration (SLAAC) — a mechanism that lets devices generate their own unique IPv6 address automatically, without needing a DHCP server.

A further useful tool is Windows PowerShell:

Get-NetIPAddress

This surfaces IP configuration (IPv4 and IPv6) across all network adapters (e.g. Ethernet, Wi-Fi, Bluetooth), including interface index, address family (IPv6 Unicast, etc.), and prefix length (e.g. 64).

flowchart TD
    A["IPv6 Address Types"] --> B["Global Unicast (GUA)\nPublic / ISP-routable"]
    A --> C["Unique Local (ULA)\nFC::/FD:: — private"]
    A --> D["Link-Local\nFE80:: — local link only"]
    A --> E["Loopback\n::1"]
    A --> F["Multicast\nFF00::/8 — one-to-many"]
    A --> G["Anycast\nNearest responder wins"]

Module 3: Understanding Routing Tables

Analyzing a Routing Table

Routing is the process of sending data from one network to another. It is a Layer 3 network function (again referencing the OSI model) that relies on many different protocols. A router (or, on modern networks, a Layer 3 switch) is the device responsible for making forwarding decisions, based on the protocols in use and the contents of its routing table.

A routing table can be thought of as a database or roadmap, stored locally on the router, that lets it decide how to forward packets to their destination.

Demo — viewing a routing table on Windows

route print

An equivalent command that produces very similar output:

netstat -r

On a dedicated Cisco router, the equivalent command is:

show ip route

Typical elements found in a Windows routing table (route print) output:

  • Interface list — every network interface known to the machine (e.g. gigabit Ethernet adapter, loopback interface, and — on a typical home machine — Wi-Fi/Bluetooth interfaces).
  • IPv4 Route Table — including loopback and multicast entries, broadcast addressing for known networks, and the default broadcast address.
  • Gateway address — the default gateway/router known to the device (e.g. 192.168.195.2).
  • Interface address — the local machine’s own address used to reach that gateway (e.g. 192.168.195.128).
  • Netmask — the subnet mask associated with each route entry.
  • Metric — a weighting/cost value used by the router to select the best path to a destination. On a dedicated router, metrics are typically influenced by link speed and media type, as configured by a network engineer.
  • Persistent Routes — statically configured routes that survive a reboot, typically entered manually by a network engineer or system administrator.
  • IPv6 Route Table — similarly includes multicast entries, the loopback address (::1), and the self-assigned link-local address (FE80:: prefix), plus any persistent IPv6 routes.

These entries let the local machine decide whether to communicate directly with another device on-link (same local network) or whether it must use the default gateway to reach a device that is off-network (e.g. on the internet). Host routing table entries are generated automatically at startup and updated automatically if new network adapters are added; a dedicated router, in contrast, must be explicitly programmed with this information, either statically or via dynamic routing protocols.

flowchart TD
    A["route print / netstat -r\n(Windows)"] --> B["Interface List"]
    A --> C["IPv4 Route Table"]
    A --> D["IPv6 Route Table"]
    C --> C1["Network destination\nNetmask\nGateway\nInterface\nMetric"]
    C --> C2["Persistent Routes\n(static, admin-configured)"]
    D --> D1["Multicast / Loopback (::1)\nLink-local (FE80::)"]

Understanding Routing

Consider a simple topology with two routers:

  • Router 1 is directly connected to Subnet A and Subnet B.
  • Router 2 is directly connected to Subnet C and Subnet D.
  • Router 1 and Router 2 are connected to each other via a dedicated link.
flowchart LR
    SA["Subnet A"] --- R1["Router 1"]
    SB["Subnet B"] --- R1
    R1 <--> R2["Router 2"]
    SC["Subnet C"] --- R2
    SD["Subnet D"] --- R2

Each router’s routing table contains entries for its own directly connected subnets plus the link to the other router. Router 1 can easily forward traffic between Subnet A and Subnet B, and Router 2 can easily forward traffic between Subnet C and Subnet D. The interesting case is when a device on Subnet A needs to reach a device on Subnet C — Router 1 must consult its routing table to decide where to send that traffic.

Two general approaches solve this:

  • Static routing — Subnets C and D are manually entered into Router 1’s routing table (and A/B into Router 2’s), similar to the “persistent routes” seen earlier. This works fine in small, simple topologies.
  • Dynamic routing protocols — used once the number of routers/networks grows (e.g. across a large internet-scale topology). Common dynamic routing protocols include:
ProtocolFull name
RIPRouting Information Protocol
OSPFOpen Shortest Path First
BGPBorder Gateway Protocol
EIGRPEnhanced Interior Gateway Routing Protocol (Cisco)

Regardless of protocol, every router makes a forwarding decision based on:

  • The destination address of the packet.
  • The next hop — the next router in the path, determined by the routing protocol.
  • The metric/cost associated with each possible path.
  • The default gateway, sometimes called the Gateway of Last Resort, used when no more specific route matches.
  • The Administrative Distance, a value used (depending on the routing protocol) to rank the trustworthiness of different route sources.
  • The Longest Prefix Match (LPM) rule, used to resolve ambiguity when multiple routes could match the same destination.

Longest Prefix Match (LPM) worked example: suppose a router needs to forward traffic to a client at 192.168.2.10. Two entries in the routing table could both match this address:

  • 192.168.2.0/24
  • 192.168.2.0/26

Both subnets legitimately contain the host 192.168.2.10. LPM resolves the ambiguity by selecting the route with the longest (most specific) prefix — in this case, 192.168.2.0/26 — since the more specific route is more likely to be accurate for the intended destination.

flowchart TD
    A["Packet destined for\n192.168.2.10"] --> B{"Multiple matching\nrouting table entries?"}
    B -->|"192.168.2.0/24\nand\n192.168.2.0/26\nboth match"| C["Apply Longest Prefix Match (LPM)"]
    C --> D["Select /26\n(longest / most specific prefix)"]

Understanding Routing Planes

Router functionality can be divided into three logical planes of responsibility:

PlaneResponsibility
Control planeCreates and maintains the routing table; determines how to route traffic using the relevant protocols
Data planePerforms the actual forwarding of data packets from one interface to another, based on rules established by the control plane
Management planeProvides the connections that let an administrator configure and monitor the device
flowchart TD
    subgraph Router["Router"]
    CP["Control Plane\nBuilds/maintains routing table\nRuns routing protocols"]
    DP["Data Plane\nForwards packets\nbetween interfaces"]
    MP["Management Plane\nAdmin configuration\n& monitoring"]
    end
    CP -->|"Programs forwarding rules"| DP
    MP -->|"Configures"| CP
    MP -->|"Monitors"| DP

Closely related is Software-Defined Networking (SDN), a more centralized approach to network management that:

  • Separates the control plane from the data plane, enabling more flexible, centralized management.
  • Allows networks to be programmed and automated via software and APIs.
  • Improves overall network security and efficiency.

SDN is a more advanced topic worth further independent study as a natural next step after mastering these routing fundamentals.


Summary

This course built foundation networking knowledge from the ground up:

  • Binary and decimal conversion underpins every IP addressing calculation — remember that 8 binary 1s equal 255, and that ranges are always inclusive of 0.
  • IPv4 is a 32-bit, dotted-decimal address scheme split into a network address and a host identifier, defined by a subnet mask (expressed in dotted-decimal or CIDR/slash notation).
  • Classful addressing (Class A/B/C/D/E) is largely obsolete but remains useful as a foundation for understanding host-count math; CIDR and VLSM replaced it with flexible, efficient subnet boundaries.
  • The 256 Chart technique (mapping bits ↔ subnets/hosts) is a fast, reliable manual method for calculating new subnet masks, host counts, and increment values — always remembering to subtract 2 for the network and broadcast addresses on each subnet.
  • Private IPv4 ranges (10/8, 172.16/12, 192.168/16) are not internet-routable and require NAT on a router/default gateway to reach the public internet using a single public IP address.
  • IPv6 is a 128-bit, hexadecimal address scheme (8 hextets) designed to solve IPv4 exhaustion, with built-in IPSec security, no traditional broadcast (multicast/anycast instead), and address types including GUA, ULA, link-local, loopback, multicast, and anycast.
  • Routing tables let routers (and hosts) decide how to forward traffic, using metrics, administrative distance, default gateways, and the Longest Prefix Match rule to resolve overlapping routes; router functionality is logically divided into control, data, and management planes.

Quick-Reference Cheat Sheet

The 256 Chart (bits ↔ subnets/hosts):

Bits added/used12345678
Subnets or raw host values248163264128256
Usable hosts (subtract 2)026143062126254

CIDR / subnet mask / host-count reference (based on a /24 starting network):

CIDRSubnet maskHost bitsTotal addressesUsable hostsIncrement value (4th octet)
/24255.255.255.08256254256 (1 network)
/25255.255.255.1287128126128
/26255.255.255.1926646264
/27255.255.255.2245323032
/28255.255.255.2404161416
/29255.255.255.2483868
/30255.255.255.2522424

Classful addressing reference:

ClassMaskCIDRUsable hosts
A255.0.0.0/816,777,214
B255.255.0.0/1665,534
C255.255.255.0/24254

Private IPv4 ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16

Special IPv4 addresses: loopback 127.0.0.1; broadcast 255.255.255.255; APIPA 169.254.0.0/16

IPv6 address types: GUA (public), ULA (FC00::/7, private), Link-Local (FE80::/10), Loopback (::1), Multicast (FF00::/8), Anycast (nearest responder)

VLSM calculation steps:

  1. Determine how many subnets/hosts are required.
  2. Look up the requirement in the 256 Chart to find the number of new mask bits needed.
  3. Add those bits to the current CIDR to get the new mask.
  4. Subtract the new CIDR from 32 to find remaining host bits, then look up the host count (minus 2 for network/broadcast).
  5. Use the binary column position of the last new mask bit to find the increment value.
  6. Build out each subnet’s network address (incrementing), usable host range, and broadcast address sequentially.

Search Terms

ip · addressing · subnetting · networking · fundamentals · systems · security · ipv6 · routing · ipv4 · subnet · binary · length · masking · variable

Interested in this course?

Contact us to book it or get a custom training plan for your team.