Networking Fundamentals

To use the subnetting calculator you can visit this page that I have built:
Subnets

Private vs Public IP Address Ranges

Public IP Addresses are globally unique and assigned by ISPs. They are used to identify devices on the internet and are directly routable.

Private IP Addresses are used within private networks (e.g., home, office) and are not routable on the internet. They are non-unique and reusable across private networks. They are reserved for internal use and must be translated to a public IP address (via NAT) to access the internet.

Type IP Address Range Description
Private 10.0.0.0 – 10.255.255.255 Class A private range (16.7M hosts)
Private 172.16.0.0 – 172.31.255.255 Class B private range (1M hosts)
Private 192.168.0.0 – 192.168.255.255 Class C private range (65k hosts)
Public All IPs not in private ranges Globally unique, assigned by ISPs

IP Address Classes

The 32-bit IPv4 address space was partitioned into five classes (A-E) as shown in the following tables:

Source: https://en.wikipedia.org/wiki/Classful_network
Class Leading Bits Network Bits Host Bits Number of Networks Addresses per Network Total Addresses Start Address End Address Default Subnet Mask CIDR Notation
A 0 8 24 128 (2⁷) 16,777,216 (2²⁴) 2,147,483,648 (2³¹) 0.0.0.0 127.255.255.255[a] 255.0.0.0 /8
B 10 16 16 16,384 (2¹⁴) 65,536 (2¹⁶) 1,073,741,824 (2³⁰) 128.0.0.0 191.255.255.255 255.255.0.0 /16
C 110 24 8 2,097,152 (2²¹) 256 (2⁸) 536,870,912 (2²⁹) 192.0.0.0 223.255.255.255 255.255.255.0 /24
D (Multicast) 1110 Not defined Not defined Not defined Not defined 268,435,456 (2²⁸) 224.0.0.0 239.255.255.255 Not defined /4[7]
E (Reserved) 1111 Not defined Not defined Not defined Not defined 268,435,456 (2²⁸) 240.0.0.0 255.255.255.255[b] Not defined Not defined

Binary Representation and Subnetting

An IPv4 address is a 32-bit number, typically represented in dotted-decimal notation (e.g., 192.168.1.1). Each octet (8 bits) is converted to binary to understand how subnetting works.

Subnetting involves dividing an IP network into smaller subnets by borrowing bits from the host portion of the address. The subnet mask determines the network and host portions.

Notes:

Network Bits = Derived from CIDR notation /n
Host Bits = Total bits (32) - network bits
Number of Hosts = 2Host bits - 2
Borrowed bits = New Subnet's network bits - Original vnet's network bits
Number of Subnets = 2Borrowed bits

Concrete Example #1: Subnetting 192.168.1.0/24

Let's break down the IP address 192.168.1.0 with a subnet mask of 255.255.255.0 (CIDR /24):

Step 1: Convert IP Address and Subnet Mask to Binary

IP Address: 192.168.1.0

192      168      1        0
11000000 10101000 00000001 00000000
      

Subnet Mask: 255.255.255.0 (CIDR /24)

255      255      255      0
11111111 11111111 11111111 00000000
      

Step 2: Calculate the Network Address

Perform a bitwise AND operation between the IP address and subnet mask to find the network address.

IP Address:   11000000 10101000 00000001 00000000
Subnet Mask:  11111111 11111111 11111111 00000000
              -----------------------------------
Network:      11000000 10101000 00000001 00000000  (192.168.1.0)
      

Step 3: Determine the Usable Host Range

The usable host range is all IPs between the network address and the broadcast address.

Network Address:   192.168.1.0
Broadcast Address: 192.168.1.255
Usable Host Range: 192.168.1.1 – 192.168.1.254
      

Step 4: Calculate the Number of Hosts

The formula to calculate the number of usable hosts is: 2^(host bits) - 2.

Host Bits: 8 (from the subnet mask 255.255.255.0)
Number of Hosts: 2^8 - 2 = 254
      

Concrete Example #2: Subnetting 10.0.0.0/16

The Class A private IP range is 10.0.0.0/8, which allows for a large number of hosts (16.7 million). Subnetting this range involves borrowing bits from the host portion to create smaller, more manageable subnets.

Let's break down an example using the IP address 10.0.0.0 with a subnet mask of 255.255.0.0 (CIDR /16).

Step 1: Convert IP Address and Subnet Mask to Binary

IP Address: 10.0.0.0

10        0        0        0
00001010 00000000 00000000 00000000
      

Subnet Mask: 255.255.0.0 (CIDR /16)

255      255      0        0
11111111 11111111 00000000 00000000
      

Step 2: Calculate the Network Address

Perform a bitwise AND operation between the IP address and subnet mask to find the network address.

IP Address:   00001010 00000000 00000000 00000000
Subnet Mask:  11111111 11111111 00000000 00000000
              -----------------------------------
Network:      00001010 00000000 00000000 00000000  (10.0.0.0)
      

Step 3: Determine the Usable Host Range

The usable host range is all IPs between the network address and the broadcast address.

Network Address:   10.0.0.0
Broadcast Address: 10.0.255.255
Usable Host Range: 10.0.0.1 – 10.0.255.254
      

Step 4: Calculate the Number of Hosts

The formula to calculate the number of usable hosts is: 2^(host bits) - 2.

Host Bits: 16 (from the subnet mask 255.255.0.0)
Number of Hosts: 2^16 - 2 = 65,534
      

Subnetting Fundamentals:: An example for Class A Private Networks

A subnet mask is used to divide an IP address into network and host portions. It is represented in dotted-decimal notation (e.g., 255.255.255.0) or CIDR notation (e.g., /24).

CIDR (Classless Inter-Domain Routing) is a compact representation of the subnet mask, indicating the number of network bits. For example, /24 means the first 24 bits are used for the network portion.

Subnetting is the process of dividing a large network into smaller, more manageable subnets. For Class A private networks (range: 10.0.0.0 – 10.255.255.255), subnetting allows you to create smaller networks with a specific number of hosts and subnets.

Key concepts:

so you may ask "Why do we substract 2"?the first one, is reserved for the Network Address (10.0.0.0) and the last one is typically reserved for the Broadcast Address (10.255.255.255)

Class A private networks (range: 10.0.0.0 – 10.255.255.255) can be subnetted from `/8` to `/30`. Each subnet mask defines the number of subnets and hosts per subnet.

To see this in action, visit this subnet calculator page that I have built:
Subnets