Ports & Common
Protocols
Understand how ports and protocols like TCP, UDP, DNS, DHCP, HTTP/S, and SSH form the backbone of network communication: and why they matter for cyber security.
What Is a Port?
Think of an IP address as a building's street address. A port is a specific door number inside that building. Each door leads to a different service: web traffic, email, file transfer, or remote login.
What Is a Protocol?
A protocol is a set of rules that governs how data is formatted, transmitted, and received over a network. Without protocols, devices would have no common language to communicate.
Why Ports & Protocols Matter for Security
Every open port is a potential entry point for attackers. Understanding which ports should be open: and which should not: is fundamental to defending a network.
TCP vs UDP: The Two Transport Protocols
TCP vs UDP: Key Differences
| Feature | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented | Connectionless |
| Reliability | Guaranteed delivery | No guarantee |
| Ordering | Ordered packets | Unordered |
| Speed | Slower (overhead) | Faster |
| Error Checking | Yes + retransmission | Checksum only |
| Use Cases | HTTP/S, SSH, FTP | DNS, DHCP, VoIP |
DNS: The Internet's Phone Book
The Domain Name System (DNS) translates human-readable domain names (like example.com) into IP addresses (like 93.184.216.34). It primarily uses UDP port 53.
DHCP: Automatic IP Assignment
Dynamic Host Configuration Protocol (DHCP) automatically assigns IP addresses to devices when they join a network. It uses UDP ports 67 (server) and 68 (client).
HTTP vs HTTPS: Encryption Matters
SSH: Secure Remote Access
Secure Shell (SSH) provides encrypted remote login and command execution on TCP port 22. It replaced the insecure Telnet protocol (port 23), which transmitted everything in plaintext.
ssh admin@192.168.1.10 -p 22
# Using key-based authentication (more secure)
ssh -i ~/.ssh/id_rsa admin@192.168.1.10
The Well-Known Ports Map
How to Analyze Network Traffic
Security analysts use port and protocol knowledge to investigate traffic. Here is a step-by-step approach:
Example: Reading Firewall Rules
A security admin reviews these firewall rules. Which traffic is allowed?
ALLOW TCP ANY → 443 # HTTPS inbound
ALLOW TCP ANY → 22 # SSH inbound
ALLOW UDP ANY → 53 # DNS queries
DENY TCP ANY → 23 # Block Telnet
DENY TCP ANY → 80 # Block plain HTTP
DENY ALL ANY → ANY # Default deny
Example: Spotting Suspicious Traffic
An analyst notices these connections in a network log. Which ones are suspicious?
10.0.0.5 → 93.184.216.34 TCP 443 # Normal HTTPS
10.0.0.12 → 8.8.8.8 UDP 53 # Normal DNS
10.0.0.8 → 45.33.32.156 TCP 4444 # ??? Unusual port
10.0.0.3 → 198.51.100.1 TCP 23 # Telnet? Insecure!
Example: Understanding a Port Scan
An Nmap scan reveals open ports on a web server. What do the results tell us?
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp open https
3306/tcp open mysql
8080/tcp open http-proxy
Common Mistakes
Protocols & Ports: Quick Reference
| Protocol | Port(s) | Transport | Secure? |
|---|---|---|---|
| HTTP | 80 | TCP | No |
| HTTPS | 443 | TCP | Yes (TLS) |
| SSH | 22 | TCP | Yes |
| DNS | 53 | UDP (TCP) | No* |
| DHCP | 67/68 | UDP | No |
| FTP | 20/21 | TCP | No |
| Telnet | 23 | TCP | No |
| SMTP | 25 | TCP | No* |
Question 1 of 5
Which port and protocol combination is used by HTTPS for secure web traffic?
Question 2 of 5
A security analyst sees outbound traffic from an internal machine to an external IP on TCP port 4444. What is the most likely concern?
Question 3 of 5
What is the primary difference between TCP and UDP?
Question 4 of 5
The DHCP process follows four steps: Discover, Offer, Request, Acknowledge. Which transport protocol does DHCP use?
Question 5 of 5
An Nmap scan shows that port 3306 (MySQL) is open and accessible from the public internet on a web server. What is the recommended action?