Networking Fundamentals: IP, CIDR, TCP and Ports

Learn IP addressing, CIDR subnetting, TCP vs UDP, ports and routing well enough to design a VPC without guessing.

Beginner · about 8 hours · difficulty 2/5

Learn first: Linux Command Line for Cloud Servers

Cloud networking is ordinary networking with a console on top. If CIDR blocks and ports confuse you, VPC design will too. Spend real time here.

IP addresses and CIDR

  • An IPv4 address has 32 bits, written as four numbers (10.0.1.25).
  • CIDR notation (10.0.0.0/16) says how many leading bits are the network part. /16 gives 65,536 addresses, /24 gives 256, /28 gives 16.
  • Private ranges (RFC 1918): 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16. VPCs use these.
  • AWS reserves 5 addresses in every subnet, so a /24 gives 251 usable IPs.

The layers that matter

  • IP (Layer 3) moves packets between networks using routes.
  • TCP gives reliable, ordered connections (HTTP, SSH, databases). UDP is fast and connectionless (DNS, video, gaming).
  • Ports identify the service: 22 SSH, 80 HTTP, 443 HTTPS, 3306 MySQL, 5432 PostgreSQL, 6379 Redis.

Routing and NAT

A route table says "for traffic to this range, send it here". A default route (0.0.0.0/0) catches everything else. NAT lets many private addresses share one public address for outbound traffic, which is exactly what your home Wi-Fi router does.

HTTP and TLS in one line each

HTTP is the request/response protocol of the web; HTTPS is HTTP inside TLS encryption, and the certificate proves the server's identity.

Pitfalls

  • Choosing overlapping CIDR ranges for networks that may later need to connect.
  • Making the first VPC a /24 and running out of addresses.

You are ready to move on when you can split 10.0.0.0/16 into four /18 or six /20 subnets on paper and say which port a given service uses.

Key concepts

  • IPv4 addresses and binary
  • CIDR and subnetting: The skill VPC design depends on
  • Private vs public IP ranges
  • TCP vs UDP
  • Common ports
  • Routing and default routes
  • NAT
  • OSI and TCP/IP models
  • IPv6 basics

Mini project

Plan, on paper or a spreadsheet, the address space for a company with three environments (dev, staging, prod), each needing public, private and database subnets in two AZs. Use non-overlapping /16 blocks and verify with an online CIDR calculator. No cloud resources needed.

Check yourself

How many usable IPs does an AWS subnet of 10.0.1.0/26 have, and why is it not 64?

Free resources