- IP subnetting is the process of dividing an IP (Internet Protocol) address into smaller subnets. This enables network administrators to allocate IP addresses more efficiently and manage network traffic.
- By logically grouping IP addresses, subnetting facilitates routing and network segmentation.
- Subnets are created by borrowing host bits from a Class A, B, or C network to create more networks.
- When host bits are borrowed, new subnets are created, reducing the number of usable IP addresses in the network.
- Each subnet has its own range of IP addresses and a subnet mask.
- The first address of a subnet is the network address, while the last address is the broadcast address. The usable IP range lies between these two.
FLSM and VLSM
FLSM (Fixed Length Subnet Masking)
FLSM involves splitting an IP address space into subnets of equal size. It is simpler and easier to manage but may lead to inefficient use of IP addresses.
Example: To divide the 192.168.1.0/24 network into 4 equal-sized subnets, follow these steps:
1. Determine the Subnet Mask
- To create 4 equal subnets, borrow 2 bits (2^2 = 4).
-
Before division, the subnet mask for the network:
- CIDR: /24
- Binary: 11111111.11111111.11111111.00000000
- Decimal: 255.255.255.0
-
After borrowing 2 bits for subnetting:
- CIDR: /26
- Binary: 11111111.11111111.11111111.11000000
- Decimal: 255.255.255.192
-
2. Calculate Network Addresses Using the binary values of the borrowed bits, find the network addresses:
| 2⁷ | 2⁶ | 2⁵ | 2⁴ | 2³ | 2² | 2¹ | 2⁰ | Network Start Address | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | ||
| 192.168.1. | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 192.168.1. | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 64 |
| 192.168.1. | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 128 |
| 192.168.1. | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 192 |
Network Addresses:
| Subnets | Network Address | Usable Host Range | Broadcast Address |
|---|---|---|---|
| 1. | 192.168.1.0/26 | 192.168.1.1 - 192.168.1.62 | 192.168.1.63 |
| 2. | 192.168.1.64/26 | 192.168.1.65 - 192.168.1.126 | 192.168.1.127 |
| 3. | 192.168.1.128/26 | 192.168.1.129 - 192.168.1.190 | 192.168.1.191 |
| 4. | 192.168.1.192/26 | 192.168.1.193 - 192.168.1.254 | 192.168.1.255 |
VLSM (Variable Length Subnet Masking)
VLSM allows IP address spaces to be divided into subnets of different sizes, making more efficient use of IP addresses by tailoring the subnet size to the specific needs.
Example:
- Subnet 1: 50 devices
- Subnet 2: 30 devices
- Subnet 3: 10 devices
- Subnet 4: 2 devices
To divide the 192.168.1.0/24 network into subnets based on the number of devices required:
1. Determine Subnet Masks:
-
Calculate the number of host bits required and determine the subnet mask by subtracting these from the 32-bit total.
-
Use the formula
2^n - 2
to calculate the number of usable IP addresses, where n is the number of host bits.
Subnet 1 - 50 devices
- 2⁶ - 2 = 62 addresses
- Host bits: 6
- Subnet Mask: 255.255.255.192 (/26)
Subnet 2 - 30 devices
- 2⁵ - 2 = 32 addresses
- Host bits: 5
- Subnet Mask: 255.255.255.224 (/27)
Subnet 3 - 10 devices
- 2⁴ - 2 = 14 addresses
- Host bits: 4
- Subnet Mask: 255.255.255.240 (/28)
Subnet 4 - 2 devices
- 2² - 2 = 2 addresses
- Host bits: 2
- Subnet Mask: 255.255.255.252 (/30)
2. Calculate Network Addresses:
In VLSM, subnets are ordered from largest to smallest, and addresses are allocated accordingly. The starting address of each subnet is determined by the previous subnet’s ending address.
Calculation for Subnet 1 (50 devices):
| 2⁷ | 2⁶ | 2⁵ | 2⁴ | 2³ | 2² | 2¹ | 2⁰ | Network Address | |
|---|---|---|---|---|---|---|---|---|---|
| 1st Subnet | 1 | 1 | X | X | X | X | X | X | 192.168.1.0 /26 |
| 2nd Subnet | 1 | 1 | 1 | X | X | X | X | X | 192.168.1.64 /27 |
| 3rd Subnet | 1 | 1 | 1 | 1 | X | X | X | X | 192.168.1.96 /28 |
| 4th Subnet | 1 | 1 | 1 | 1 | 1 | 1 | X | X | 192.168.1.112 /30 |