Lesson Objectives
By the end of this lesson, you will:
Understand the importance of TCP & UDP ports in networking.
Learn the common TCP and UDP port numbers.
Differentiate between well-known, registered, and dynamic ports.
Perform practical exercises using command-line tools to check open ports and active connections.
1. Understanding TCP and UDP Ports
What is a Port?
A port is a virtual endpoint for communication in a network.
Ports allow multiple services to run on a single device using different identifiers.
Every port is associated with an IP address and a specific transport protocol (TCP or UDP).
What is the Difference Between TCP and UDP?
Feature
TCP (Transmission Control Protocol)
UDP (User Datagram Protocol)
Connection-oriented (requires handshake)
Connectionless (no handshake)
Reliable (ensures data delivery)
Unreliable (no guarantee of delivery)
Slower (due to error checking)
Web browsing, email, file transfer
2. Well-Known TCP & UDP Ports
Ports 0 – 1023 (Well-Known Ports)
These are assigned by the Internet Assigned Numbers Authority (IANA) for common services.
Port Number
Protocol
Service
Description
File Transfer Protocol (Data & Control)
Secure Shell for remote login
Simple Mail Transfer Protocol (Email sending)
Domain Name System (Name resolution)
Dynamic Host Configuration Protocol
Trivial File Transfer Protocol
Hypertext Transfer Protocol (Web browsing)
Post Office Protocol (Email retrieval)
Internet Message Access Protocol
Simple Network Management Protocol
Ports 1024 – 49151 (Registered Ports)
Used by software applications (e.g., database servers, proprietary apps).
Examples:
1433: Microsoft SQL Server
Ports 49152 – 65535 (Dynamic/Ephemeral Ports)
Assigned dynamically by the OS for client connections.
Used temporarily during communication.
3. Practical Exercises
Let's use real-world commands to identify and manage ports.
Exercise 1: Checking Open Ports on Your System
Windows:
Open Command Prompt (cmd) as Administrator.
This will show active listening ports.
Linux/macOS:
This will list open ports and associated services.
Exercise 2: Checking a Specific Port
Windows (PowerShell):
To check if port 80 (HTTP) is open:
Linux/macOS:
If the port is open, you will get a successful connection message.
Exercise 3: Scanning for Open Ports
Using Nmap (Install Required)
Scan a network for open ports:
This checks for open ports on a local network device.
4. Key Takeaways
TCP is reliable but slower; UDP is faster but less reliable.
Well-known ports (0-1023) are assigned for critical services.
Use netstat and nmap for port analysis.
Security tip: Close unnecessary ports to reduce vulnerabilities.
TCP ports, UDP ports, well-known ports, registered ports, dynamic ports, netstat, nmap, network security, port scanning, SSH, FTP, HTTP, HTTPS, SMTP, DNS, DHCP, SNMP, Telnet, RDP, firewall, نتورک پلاس
Last updated