~3 min read • Updated Aug 3, 2025

1. What is Subnetting?


Subnetting is the process of dividing a large IP network into smaller subnetworks to reduce broadcast domains, simplify management, and improve performance and security.


2. Subnet Design Steps


  • Determine the number of required physical or WAN segments
  • Calculate how many hosts are needed per subnet
  • Select the proper subnet mask and define valid host address ranges

3. Powers of 2 for Subnetting



2^1 = 2  
2^2 = 4  
2^3 = 8  
2^4 = 16  
2^5 = 32  
2^6 = 64  
2^7 = 128  
2^8 = 256  
2^9 = 512  
2^10 = 1024

4. Default Masks for IP Classes


  • Class A: 255.0.0.0 (/8)
  • Class B: 255.255.0.0 (/16)
  • Class C: 255.255.255.0 (/24)

5. CIDR and Subnet Masks


Subnet MaskCIDR
255.255.255.128/25
255.255.255.192/26
255.255.255.224/27
255.255.255.240/28
255.255.255.248/29
255.255.255.252/30

6. Mental Subnetting (Class C)



Block size = 256 - subnet mask  
Subnets = 2^x (x = number of 1 bits)  
Hosts per subnet = 2^y - 2 (y = number of 0 bits)

7. Example: 192.168.10.0/25



Subnets: 2  
Hosts per subnet: 126  
Valid subnets: 0 and 128  
Broadcast addresses: 127 and 255  
Host ranges:  
Subnet 0: 192.168.10.1 to 192.168.10.126  
Subnet 128: 192.168.10.129 to 192.168.10.254

8. IP Troubleshooting Steps



ping 127.0.0.1       → test TCP/IP stack  
ping local IP        → test network card  
ping default gateway → test LAN connection  
ping remote server   → test WAN or DNS routing

9. Key CLI Tools


  • ping
  • tracert
  • arp -a
  • ipconfig /all

10. Common IP Addressing Errors



Error: Gateway address is set as broadcast address  
Fix: Use a valid host IP from the subnet

Error: Host IP equals broadcast address  
Fix: Pick an address between network and broadcast

11. Static IP Assignment Example



Network: 192.168.20.24/29  
Mask: 255.255.255.248  
Router: 192.168.20.25  
Server: 192.168.20.30  
Gateway: 192.168.20.25

12. What is NAT?


Network Address Translation maps private IPs to public IPs, allowing secure internet access and IPv4 address conservation.


13. NAT Pros and Cons


ProsCons
Preserves public IPsHarder to trace hosts
Provides flexibilitySome apps may fail with NAT
Improves securityAdds translation latency

14. NAT Types


  • SNAT: Static mapping of private to public IP
  • DNAT: Dynamic mapping to available public IPs
  • PAT: Overloading many private IPs using ports

15. NAT Terminology


  • Inside Local: private IP before translation
  • Inside Global: translated public IP
  • Outside Local: destination IP before translation
  • Outside Global: final destination public IP

16. PAT Example



10.1.1.1:5000 → 203.0.113.1:5000  
10.1.1.2:6000 → 203.0.113.1:6000  
Response packets are mapped back via NAT table

17. Port Forwarding in NAT



203.0.113.1:80 → 192.168.1.10:80 (Internal Web Server)

Written & researched by Dr. Shahin Siami