networking & subnetting reference

IP Addressing & Subnetting

Everything from what an IP address actually is, to reading a subnet mask, to working out network/broadcast/usable ranges by hand β€” beginner to expert. Includes a live subnet calculator.

root@tfhost-server:~# ipcalc 160.119.196.135 255.255.255.192
Address: 160.119.196.135
Netmask: 255.255.255.192 = 26
Network: 160.119.196.128/26
Broadcast: 160.119.196.191
HostMin: 160.119.196.129
HostMax: 160.119.196.190
Hosts/Net: 62
5beginner
6intermediate
5advanced
1live calculator

Beginner

foundations

Start here if subnetting is new. This builds the vocabulary everything else depends on.

What Is an IP Address?
The core concept β€” every device needs one
β–Ά

An IP address (Internet Protocol address) is a numeric label assigned to every device on a network, so it can send and receive data. Think of it like a street address β€” without it, data has no idea where to go or where it came from.

There are two versions in use today:

  • IPv4 β€” the classic format, written as four numbers separated by dots, e.g. 192.168.1.10. This is what almost all of this guide covers, and what you'll deal with daily on TFhost servers.
  • IPv6 β€” the newer, much larger address space, written in hex groups, e.g. 2001:0db8:85a3::8a2e:0370:7334. Built because IPv4 has "run out" of addresses globally.
Every server, router, laptop, and phone on a network needs a unique IP address (within that network) to be reachable.
IPv4 Structure β€” Octets & Binary
Why an IP looks like x.x.x.x
β–Ά

An IPv4 address is a 32-bit number, split into four 8-bit sections called octets, separated by dots. Each octet ranges from 0–255, because 8 bits can represent 2⁸ = 256 values (0 through 255).

160 . 119 . 196 . 135 10100000.01110111.11000100.10000111 ← same address, in binary

This is the single most important mental model for subnetting: everything is binary underneath. The decimal dotted format is just a human-friendly way of reading four 8-bit binary blocks.

Binary bit value1286432168421
Position12345678
Memorize that row of powers of 2 (128-64-32-16-8-4-2-1). It's the key that unlocks subnetting math in your head.
Public vs Private IP Addresses
Which ranges are reachable from the internet
β–Ά

Private IPs are reserved ranges meant only for use inside local networks (offices, home LANs, internal server VLANs). They are not routable on the public internet.

RangeCIDRTypical use
10.0.0.0 – 10.255.255.25510.0.0.0/8Large internal networks
172.16.0.0 – 172.31.255.255172.16.0.0/12Medium networks, Docker defaults
192.168.0.0 – 192.168.255.255192.168.0.0/16Home/office routers

Public IPs are everything else β€” globally unique and routable, assigned by your ISP or a regional registry (like AFRINIC for Nigeria). This is the type of IP a hosting server's main network interface typically has, e.g. 160.119.196.135 from your earlier example.

A router uses NAT (Network Address Translation) to let many private-IP devices share one public IP when talking to the internet. More on this in the advanced section.
IP Address Classes (A / B / C / D / E)
The old classful system β€” still useful for intuition
β–Ά

Before CIDR (which you'll use in practice), IPv4 addresses were split into "classes" based on their first octet. Modern networking doesn't strictly follow this anymore, but it's still how a lot of default subnet masks got their historical starting point.

ClassFirst octet rangeDefault maskUse
A1 – 126255.0.0.0 (/8)Huge networks
B128 – 191255.255.0.0 (/16)Medium-large networks
C192 – 223255.255.255.0 (/24)Small networks
D224 – 239β€”Multicast
E240 – 255β€”Reserved / experimental
In real-world networking today, we ignore classes and use CIDR notation (covered next section) instead β€” it lets you slice a network to any size, not just /8, /16, or /24.
Default Gateway & Loopback
Two special addresses you'll see constantly
β–Ά

The default gateway is the IP address of the router that a device sends traffic to whenever the destination isn't on its own local subnet β€” basically, "the door out of this network."

A common assumption is that the gateway is always the second usable IP in a subnet (e.g. .129 in a /26). That's just a convention, not a rule. The gateway can be configured as any usable address in the subnet's range β€” the actual network/broadcast boundaries are determined purely by the subnet mask, never by where the gateway happens to sit.

Loopback (127.0.0.1, hostname localhost) always refers to "this machine" β€” used for testing services locally without touching the network.

Intermediate

subnetting core

This is where actual subnetting math lives β€” the part that trips people up without a mental model.

Subnet Masks Explained
How a mask splits an address into network + host
β–Ά

A subnet mask tells devices which part of an IP address is the network portion (shared by every device in that subnet) and which part is the host portion (unique to each device).

In binary, a mask is a run of 1s followed by a run of 0s. The 1s mark "network bits," the 0s mark "host bits."

255.255.255.192 β†’ 11111111.11111111.11111111.11000000 └──────── network β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”” host β”˜

Here, the last octet has 2 bits set to 1 (contributing to network) and 6 bits set to 0 (host bits). Those 6 host bits give you 2⁢ = 64 total addresses in the block β€” which matches what we calculated for the 160.119.196.135 example earlier.

Dotted maskBinary (last relevant octet)Host bitsBlock size
255.255.255.0000000008256
255.255.255.128100000007128
255.255.255.19211000000664
255.255.255.22411100000532
255.255.255.24011110000416
255.255.255.2481111100038
255.255.255.2521111110024
CIDR Notation
The /24, /26, /30 shorthand
β–Ά

CIDR (Classless Inter-Domain Routing) notation writes a subnet mask as a slash followed by the number of network bits β€” e.g. /26 means 26 bits are network bits, leaving 32 βˆ’ 26 = 6 host bits.

CIDRSubnet maskHost bitsTotal addressesUsable hosts
/24255.255.255.08256254
/25255.255.255.1287128126
/26255.255.255.19266462
/27255.255.255.22453230
/28255.255.255.24041614
/29255.255.255.248386
/30255.255.255.252242 (point-to-point links)

You'll write CIDR constantly β€” firewall rules, VPS provisioning, WHMCS IP allocations, cloud security groups all use it. 160.119.196.135/26 is the same information as an IP + 255.255.255.192, just more compact.

Network Address & Broadcast Address
The two addresses you can never assign to a device
β–Ά

Every subnet block "reserves" its first and last address:

  • Network address β€” the very first address in the block (all host bits = 0). It identifies the subnet itself, not a device.
  • Broadcast address β€” the very last address in the block (all host bits = 1). Sending a packet here reaches every device on that subnet at once.

Neither can be assigned to a server, router interface, or workstation. That's why usable hosts = block size βˆ’ 2.

Block: 160.119.196.128 – 160.119.196.191 (/26, 64 addresses) Network: 160.119.196.128 ← reserved Usable: 160.119.196.129 – 160.119.196.190 ← assignable, 62 addresses Broadcast: 160.119.196.191 ← reserved
Calculating a Usable Range by Hand
The method β€” step by step, no calculator
β–Ά

This is the exact process for the question that started this whole page β€” given an IP and a mask, find the network, broadcast, and usable range.

  1. Find the block size from the mask's last non-255, non-0 octet. For 255.255.255.192: 256 βˆ’ 192 = 64.
  2. Find which block the IP falls in by dividing the relevant octet by the block size and rounding down, then multiplying back. For 135: 135 Γ· 64 = 2.1 β†’ block starts at 2 Γ— 64 = 128.
  3. Network address = block start β†’ 160.119.196.128
  4. Broadcast address = network + block size βˆ’ 1 β†’ 128 + 64 βˆ’ 1 = 191 β†’ 160.119.196.191
  5. Usable range = network+1 to broadcastβˆ’1 β†’ 160.119.196.129 – 160.119.196.190
This is exactly how we determined that gateway 160.119.196.135 sits inside network 160.119.196.128/26, not .134 β€” 134 isn't a multiple of 64, so it can never be a valid network address for a /26.
Common Subnet Sizes β€” Cheat Sheet
Print this one out
β–Ά
CIDRMaskBlock boundaries (last octet)Usable hosts
/30.2520,4,8,12,16...2522
/29.2480,8,16,24,32...2486
/28.2400,16,32,48...24014
/27.2240,32,64,96,128,160,192,22430
/26.1920,64,128,19262
/25.1280,128126
/24.00254
A network address is always a multiple of its block size. If someone hands you a "network address" that isn't a clean multiple, something's wrong β€” that was the exact mistake in the /26 gateway example (134 vs 128).
Binary ⇄ Decimal Conversion
The manual skill behind every shortcut above
β–Ά

To convert decimal β†’ binary for one octet, repeatedly check off the largest power of 2 that fits:

135 β†’ 128? yes (135-128=7) β†’ 1 64? no β†’ 0 32? no β†’ 0 16? no β†’ 0 8? no β†’ 0 4? yes (7-4=3) β†’ 1 2? yes (3-2=1) β†’ 1 1? yes (1-1=0) β†’ 1 = 10000111

To go binary β†’ decimal, just add up the powers of 2 where there's a 1: 128+4+2+1 = 135.

Once this becomes fast in your head, subnetting stops being "memorized tables" and becomes arithmetic you can do for any mask, on any octet, instantly.

Advanced

expert territory

Designing address space, not just reading it β€” the skills for planning real infrastructure.

VLSM β€” Variable Length Subnet Masking
Different subnet sizes carved from the same block
β–Ά

VLSM means you don't have to give every subnet the same size mask. You carve a large address block into subnets of exactly the size each segment needs β€” a /30 for a router link, a /28 for a small VLAN, a /24 for a big one β€” instead of wasting a uniform /24 everywhere.

Example: You're given 160.119.196.0/24 and need: a 100-host LAN, a 40-host LAN, a 10-host LAN, and 2 point-to-point router links.

100 hosts β†’ needs /25 (126 usable) β†’ 160.119.196.0/25 40 hosts β†’ needs /26 (62 usable) β†’ 160.119.196.128/26 10 hosts β†’ needs /28 (14 usable) β†’ 160.119.196.192/28 Link 1 β†’ /30 (2 usable) β†’ 160.119.196.208/30 Link 2 β†’ /30 (2 usable) β†’ 160.119.196.212/30

Rule of thumb: allocate biggest subnets first, so smaller ones fit cleanly into the leftover space without fragmenting the block.

Worked Practice Problems
Try these, then check your work
β–Ά

Problem 1: IP 41.203.88.50, mask 255.255.255.224 (/27). Find network, broadcast, usable range.

Block size = 256-224 = 32 50 Γ· 32 = 1.5 β†’ block starts at 1Γ—32 = 32 Network: 41.203.88.32 Broadcast: 41.203.88.63 Usable: 41.203.88.33 – 41.203.88.62 (30 hosts)

Problem 2: IP 10.10.5.200, mask 255.255.255.240 (/28). Find network, broadcast, usable range.

Block size = 256-240 = 16 200 Γ· 16 = 12.5 β†’ block starts at 12Γ—16 = 192 Network: 10.10.5.192 Broadcast: 10.10.5.207 Usable: 10.10.5.193 – 10.10.5.206 (14 hosts)

Problem 3: How many /29 subnets fit inside a /24?

/24 has 2^(29-24) = 2^5 = 32 subnets of /29 each
Route Summarization / Supernetting
Combining many small networks into one route
β–Ά

Supernetting is the reverse of subnetting: combining several contiguous smaller networks into one larger route announcement, so routers carry fewer entries in their routing tables.

Example: 192.168.0.0/24, 192.168.1.0/24, 192.168.2.0/24, 192.168.3.0/24 can be summarized as a single 192.168.0.0/22 β€” because those four /24s are contiguous and align on a /22 boundary (a block of 1024 addresses starting at a multiple of 4 in the third octet).

This matters for BGP announcements and large internal routing tables β€” fewer, larger routes are more efficient than many small ones, as long as the underlying blocks are genuinely contiguous.
NAT β€” Network Address Translation
How private IPs reach the public internet
β–Ά

NAT lets a router rewrite the source (or destination) IP of packets as they cross between a private network and the public internet, so many private-IP devices can share one public IP.

  • SNAT (Source NAT) β€” rewrites the outgoing source IP, typically used so an entire office LAN shares one public IP to browse the internet.
  • DNAT (Destination NAT / port forwarding) β€” rewrites the incoming destination IP, used to expose an internal server (e.g. a VPS behind a private subnet) on a specific public IP/port.
  • 1:1 NAT β€” maps one private IP directly to one public IP, common in hosting environments giving each VM its own reachable address.
On a Virtualizor/KVM node, this is the same mechanism behind assigning a dedicated public IP to a VPS versus routing it through the host's shared IP with port forwards.
Common Subnetting Mistakes
The misconceptions that cause real outages
β–Ά
  • Assuming the gateway defines the network address. It doesn't β€” the mask does. A gateway can legally sit anywhere in the usable range, not just "2nd IP" or "1st IP."
  • Forgetting the network/broadcast reservation. Assigning the first or last address of a block to a device will cause routing failures β€” those two addresses are never usable.
  • Mixing up mask and wildcard mask. Some devices (Cisco ACLs) want a wildcard mask, which is the inverse of a subnet mask β€” e.g. /26's subnet mask is 255.255.255.192, but its wildcard mask is 0.0.0.63.
  • Treating VLSM subnets as independent /24s. If you carve a /24 into VLSM chunks, remember the smaller subnets are not separate β€” they share the parent block's addressing and must not overlap.
  • Not double-checking block alignment. A network address must always be an exact multiple of its block size (0, 64, 128, 192 for a /26). If it isn't, the subnet boundary was calculated wrong.

Live Subnet Calculator

tool

Punt an IP + mask (or CIDR) in, get network, broadcast, usable range, and host count out. Same logic as the worked examples above.

CIDR
β€”
Network Address
β€”
Broadcast Address
β€”
First Usable
β€”
Last Usable
β€”
Usable Hosts
β€”