Understanding Ports in Networking
Introduction to Ports
- Definition: A port is a logical connection used by programs and services for exchanging information.
- Not a physical connection.
- Determines the specific program/service to be used on a computer/server.
- Usage Examples:
- Web pages, FTP services, accessing email.
- Unique Identification:
- Ports are identified by numbers ranging from 0 - 65535.
- Common Ports:
- Port 80 and 443: Web pages.
- Port 21: FTP.
- Port 25: Email.
Ports and IP Addresses
- IP Address: A numeric address serving as an identifier for a device on a network.
- Communication: An IP address and a port number work together to exchange data on a network.
- IP address locates the server.
- Port number determines the service/program to use.
Example Use Case
- Port 80 (HTTP):
- Used when visiting web pages.
- Example: Accessing google.com:
- Domain name resolves to Google's IP address.
- Port 80 is appended for HTTP service.
Netstat Utility
- Purpose: Displays current network connections and port activity.
- Usage:
- Command:
netstat -n (shows actual port numbers).
- Output: Local address, IP address, port numbers, foreign address (e.g., google.com).
FTP Example
- Port 21:
- Standard protocol for file transfer between computers and servers.
- Example: Accessing ftp.google.com:
- Domain name resolves to IP address.
- Port 21 is appended for FTP service.
Port Number Ranges
- Categories:
- 0 - 1023: System/well-known ports (e.g., 80, 443, 25, 21).
- 1024 - 49151: User/registered ports (can be registered by companies).
- 49152 - 65535: Dynamic/private ports (client-side ports, assigned temporarily).
Server vs. Client Port Usage
- Well-known and Registered Ports:
- Dynamic/Private Ports:
- Used on clients (temporary assignment during a session).
- Client Acting as Server:
- Computers can act as servers, using well-known ports (e.g., 21 or 80).
Example Command Output
- Connecting to Websites: Example with yahoo.com and example.com, using ports like 80.
- FTP Connection: Using port 21.
Port 443 and HTTPS
- Port 443:
- Used for secure web pages (HTTPS).
- Port 80 vs. Port 443:
- Port 80: Unsecured (HTTP).
- Port 443: Secured (HTTPS).
Additional Resources
- Networking Knowledge: Book recommendations and Audible trial for learning.
- Further Learning: Video on netstat utility available on the presenter's channel.
Note: Subscribe to the presenter's channel for more networking videos.