CIDR, Subnetting, Internet Gateway, and More
Detailed notes on CIDR, Subnetting, Internet Gateway, NAT, and DHCP in computer networks.
๐ Computer Network Notes: CIDR, Subnetting, Internet Gateway, and More
๐งฎ CIDR (Classless Inter-Domain Routing)
Definition: CIDR is a method for allocating IP addresses and routing that replaces the older classful addressing system. It allows more efficient use of IP address space.
Key Points:
- Introduced in 1993 to replace Class A, B, and C networks.
- Uses the format:
IP_address/prefix_length(e.g.,192.168.1.0/24). - The prefix length indicates the number of bits used for the network portion of the address.
- Example:
192.168.1.0/24โ 255.255.255.0 (256 addresses)10.0.0.0/16โ 255.255.0.0 (65,536 addresses)
Advantages:
- Efficient IP address utilization.
- Reduces the size of routing tables.
- Supports route aggregation (supernetting).
Disadvantages: - Slightly more complex to calculate and manage compared to classful addressing.
๐งฉ Subnetting
Definition: Subnetting divides a single IP network into smaller logical sub-networks (subnets).
Purpose:
- Improves network management, security, and performance.
- Efficient use of available IP addresses.
Key Concepts: - A subnet mask identifies the network and host portions of an IP address.
- Example:
- IP:
192.168.1.100 - Subnet Mask:
255.255.255.0โ/24 - Network Address:
192.168.1.0 - Broadcast Address:
192.168.1.255
Formula:
- IP:
- Subnets = 2โฟ (n = borrowed bits)
- Hosts per subnet = 2สฐ โ 2 (h = host bits)
Advantages: - Reduces network congestion.
- Better control and security per subnet.
Disadvantages: - Complex configuration for large networks.
๐ Internet Gateway
Definition: An Internet Gateway connects a private network (LAN) to the Internet, acting as a bridge between the two.
Key Functions:
- Provides a path for traffic to reach the Internet.
- Performs Network Address Translation (NAT).
- Enforces firewall and security rules.
Types:
- Default Internet Gateway (AWS/Cloud) โ Routes traffic from private subnets to the Internet.
- Hardware/Software Gateways โ Routers or firewalls in enterprise setups.
Advantages:
- Enables Internet connectivity.
- Adds control and security.
Disadvantages: - Can become a bottleneck if overloaded.
๐ NAT (Network Address Translation)
Definition: NAT translates private IP addresses into public IPs before sending packets to the Internet.
Purpose:
- Conserves public IP addresses.
- Adds a security layer by hiding internal IPs.
Types:
- Static NAT โ One-to-one mapping.
- Dynamic NAT โ Uses a pool of public IPs.
- PAT (Port Address Translation) โ Many private IPs share one public IP via ports.
Advantages:
- Saves IPs.
- Adds obscurity for internal hosts.
Disadvantages: - Can break certain apps (e.g., VoIP).
- Adds processing overhead.
โ๏ธ DHCP (Dynamic Host Configuration Protocol)
Definition: DHCP automatically assigns IP addresses and other configuration details (DNS, gateway) to devices.
Key Functions:
- Automates IP configuration.
- Uses UDP ports 67 (server) and 68 (client).
DHCP Process (DORA):
- Discover โ Client broadcasts for IP.
- Offer โ Server offers IP.
- Request โ Client requests the offered IP.
- Acknowledge โ Server confirms.
Advantages:
- Simplifies IP management.
- Avoids conflicts.
Disadvantages: - If server fails, new devices canโt get IPs.
- Not ideal for static devices.
๐งญ Summary Table
| Concept | Full Form | Function | Key Feature | Advantage | Layer |
|---|---|---|---|---|---|
| CIDR | Classless Inter-Domain Routing | Efficient IP allocation | Variable-length subnet mask | Saves address space | Network |
| Subnetting | โ | Divides network into smaller subnets | Improves management | Efficient IP use | Network |
| Internet Gateway | โ | Connects LAN to Internet | Performs NAT and routing | Internet access | Network |
| NAT | Network Address Translation | Maps private to public IPs | Hides internal addresses | IP conservation | Network |
| DHCP | Dynamic Host Configuration Protocol | Assigns IPs automatically | DORA process | Simplifies management | Application |
Summary:
- CIDR enables flexible IP allocation.
- Subnetting divides a network for better management.
- Internet Gateways connect private networks to the Internet.
- NAT conserves public IPs and secures internal systems.
- DHCP automates IP assignment and simplifies configuration.