# Subnetting

#### Basics of Subnetting

Subnetting is the process of dividing a network into smaller, more manageable pieces. Its primary purpose is to improve network performance and management while conserving the number of IP addresses needed.

#### Why Subnet?

* **Improved Performance**: Segmenting a network into subnets can reduce network traffic, as each subnet essentially acts as its own small network, containing broadcast traffic.
* **Enhanced Security**: Subnetting can improve network security by isolating groups of hosts, making it more difficult for an intruder to access all devices on the network.
* **Optimized IP Usage**: It allows for efficient usage of a limited IP address space by segregating a large network into smaller, more controllable blocks.

#### How Subnetting Works

1. **Choose a Subnet Mask**: A subnet mask is a 32-bit number that masks an IP address and divides the IP address into network address and host address.
2. **Calculate Available Subnets**: By borrowing bits from the host part of the IP address, you can create multiple smaller subnets.
3. **Assign IP Ranges**: Each subnet will have a range of IP addresses that can be assigned to devices within that subnet.

#### Example

Imagine an IP address of `192.168.1.0` with a standard subnet mask of `255.255.255.0`. This allows for 256 addresses within the network, ranging from `192.168.1.0` to `192.168.1.255`. If we change the subnet mask to `255.255.255.192`, we've created four subnets each with 64 addresses.

#### Subnetting Calculations

To successfully subnet a network, one needs to be comfortable with binary math, as IP addresses and subnet masks are best viewed in their binary forms to understand how the subnetting process works.

**Keep in mind** that subnetting requires thoughtful planning to allocate address space efficiently and according to the specific needs of your network.
