IP Address and Subnetting
Description
An IP address is a unique identifier for network devices, used for locating and communicating on the internet. Subnetting is the technique of dividing a large IP network into multiple smaller subnets, aiming to improve network management efficiency, reduce broadcast domains, and optimize IP address allocation. Understanding subnetting requires mastering the IP address structure, the role of subnet masks, and the specific calculation steps for subnet division.
Background Knowledge
- IP Address Composition: An IPv4 address is a 32-bit binary number, usually represented in dotted-decimal notation (e.g., 192.168.1.1), and is divided into a network portion and a host portion.
- Subnet Mask: Used to distinguish the network bits from the host bits in an IP address, consisting of consecutive 1s (network bits) and 0s (host bits) (e.g., 255.255.255.0).
- CIDR Notation: The network bit length is indicated by appending "/number" after the IP address (e.g., 192.168.1.0/24, meaning a subnet mask of 255.255.255.0).
Problem-Solving Process: Steps for Subnetting
Assume the network 192.168.1.0/24 needs to be divided into 4 subnets, with each subnet accommodating at least 50 hosts.
Step 1: Determine Required Number of Subnets and Hosts
- Number of subnets: 4.
- Number of hosts: At least 50 per subnet (must reserve the network address and broadcast address, so the actual requirement must satisfy 2^H - 2 ≥ 50, where H is the number of host bits).
Step 2: Calculate the Number of Host Bits H
- Formula: 2^H - 2 ≥ 50.
- Try H=6: 2^6 - 2 = 62 ≥ 50 (satisfied), so 6 host bits are required.
- The original network is /24 (8 host bits). Now reducing host bits to 6 means the network bits increase to 32 - 6 = 26 bits.
Step 3: Determine the Subnet Mask
- With 26 network bits, the subnet mask is 255.255.255.192 (binary: 11111111.11111111.11111111.11000000).
- CIDR representation is /26.
Step 4: Calculate the Subnet Block Size
- Block size is determined by the number of host bits: Block size = 2^H = 2^6 = 64.
- Subnet addresses increase by the block size.
Step 5: List All Subnet Ranges
Based on dividing 192.168.1.0/24:
- Subnet 1: 192.168.1.0/26
- Usable address range: 192.168.1.1 ~ 192.168.1.62 (192.168.1.0 is the network address, 192.168.1.63 is the broadcast address).
- Subnet 2: 192.168.1.64/26
- Usable addresses: 192.168.1.65 ~ 192.168.1.126.
- Subnet 3: 192.168.1.128/26
- Usable addresses: 192.168.1.129 ~ 192.168.1.190.
- Subnet 4: 192.168.1.192/26
- Usable addresses: 192.168.1.193 ~ 192.168.1.254.
Verification: Each subnet has 62 usable addresses (satisfying ≥50), totaling 4 subnets. The subnetting is successful.
Key Points Summary
- The core of subnetting is "borrowing host bits as network bits," thereby increasing the number of subnets and reducing the number of hosts per subnet.
- The 1s and 0s in the subnet mask must be consecutive and cannot be interrupted.
- The first address of each subnet is the network address, and the last address is the broadcast address. These two addresses cannot be assigned to devices.