Network Protocols

Protocols are the rules that govern how data is transmitted. Let's explore the most important ones through interactive visualizations.

TCP vs UDP

These are the two main transport protocols. They have very different approaches:

TCP vs UDP - Interactive Comparison

TCP
Transmission Control Protocol
Reliable, ordered delivery
  • Guarantees delivery
  • Maintains order
  • Error checking
  • Higher latency
UDP
User Datagram Protocol
Fast, connectionless
  • No delivery guarantee
  • No ordering
  • Very fast
  • Low overhead
Sender
Receiver
Click a button above to see the difference

When to Use Each?

TCP
Use TCP For
Web browsing
HTML, CSS, JS must arrive intact
File downloads
Every byte matters
Email
Messages can't lose data
SSH connections
Commands must execute correctly
UDP
Use UDP For
Video streaming
Speed over perfection
Online gaming
Low latency is critical
Voice calls (VoIP)
Real-time is more important
DNS queries
Quick lookups, can retry

The TCP 3-Way Handshake

Before TCP can send data, it establishes a connection using this handshake:

TCP 3-Way Handshake

Client
CLOSED
Server
LISTEN
Connection Closed

No connection exists yet between client and server.

Why 3 steps? Both sides need to confirm they can send AND receive. The handshake ensures reliable two-way communication.

Port Numbers

Ports identify specific applications on a device. Think of IP as a building address and ports as apartment numbers.

Common Port Numbers

Tip: Focus on memorizing: 22 (SSH), 80 (HTTP), 443 (HTTPS), 53 (DNS), 25 (SMTP). These are the most commonly asked!

Port Ranges

  • 0-1023: Well-known ports (reserved for standard services)
  • 1024-49151: Registered ports (for specific applications)
  • 49152-65535: Dynamic/private ports (temporary connections)

DNS: Domain Names to IP Addresses

When you type a URL, DNS translates it to an IP address your computer can use:

DNS Lookup Process

When you type a URL, your computer needs to find the server's IP address. Watch how the request bounces between servers!

Your Browser
DNS Resolver
Root Server
.com TLD
Auth Server
Click "Play Animation" or select a step below to see how DNS works
Query (asking)
Response (answer)

DNS in Action

Try it yourself in the terminal:

nslookup google.com
# or
dig google.com

Other Important Protocols

DHCP (Dynamic Host Configuration Protocol)

Automatically assigns IP addresses to devices on your network.

The DHCP Process (DORA):

  1. Discover - Device broadcasts "I need an IP!"
  2. Offer - DHCP server offers an available IP
  3. Request - Device accepts the offer
  4. Acknowledge - Server confirms the assignment

ICMP (Internet Control Message Protocol)

Used for network diagnostics and error messages.

# Test if a host is reachable
ping google.com

# Trace the route to a destination
traceroute google.com   # Mac/Linux
tracert google.com      # Windows

SSH (Secure Shell)

Encrypted remote access to systems on port 22.

ssh [email protected]

Practice Tasks

DNS Practice: Open your terminal and run nslookup or dig on your favorite website. What IP address(es) do you get?

Port Quiz: Use the "Quiz Me!" button in the ports section above until you can correctly identify at least 5 common ports.

Ping Test: Ping google.com from your terminal. What's the average response time?

Summary

  • TCP: Reliable, ordered delivery with connection handshake
  • UDP: Fast, connectionless, accepts some packet loss
  • Ports: Identify applications (80=HTTP, 443=HTTPS, 22=SSH)
  • DNS: Translates domain names to IP addresses
  • DHCP: Automatically assigns IP addresses
  • ICMP: Network diagnostics (ping, traceroute)

Test Your Knowledge

Congratulations on completing Networking Basics! Move on to Advanced Networking for subnetting and routing protocols.

Loading...