Understanding Ports in Networking

May 29, 2024

Understanding Ports in Networking

Definition of a Port

  • A port is a logical connection used by programs and services to exchange information.
  • It determines which program/service on a computer or server is in use (e.g., web page, FTP service, email).
  • Port Numbers: Range from 0 to 65535.

Examples of Common Ports

  • Web Pages: Port 80 (HTTP), Port 443 (HTTPS)
  • FTP Service: Port 21
  • Email: Port 25

Relationship Between IP Address and Port Number

  • IP Address: Numeric identifier for a device on a network (needed for communication).
  • IP Address + Port Number: Work together to exchange data on a network.
  • Example: To access Google’s webpage, your browser uses Google’s IP with port 80 (HTTP).

Process of Connecting to a Webpage

  1. Domain Name Conversion: Converts a domain name (e.g., google.com) into Google’s IP address.
  2. Add Port Number: Adds port 80 for HTTP service.
  3. IP Address Usage: Locates Google’s web server.
  4. Port Number Usage: Forwards the request to the web service to retrieve the webpage.

Viewing Ports - Netstat Utility

  • Netstat (Network Statistics): Command-line tool to display current network connections and port activity.
  • Example: netstat -n to see actual port numbers and connections.

Categories of Port Numbers

  1. System/Well-Known Ports (0-1023)
    • Common ports used daily (e.g., port 80, 443, 21, 25).
  2. User/Registered Ports (1024-49151)
    • Ports registered by companies for particular services.
  3. Dynamic/Private Ports (49152-65535)
    • Client-side ports assigned temporarily during a session.

Server vs. Client-side Ports

  • Server Ports: Well-known and registered ports (e.g., port 21 and port 80 for running services).
  • Client Ports: Dynamic/private ports assigned by the client machine.

Example Connections

  1. Websites: Connecting to yahoo.com and example.com using port 80 (HTTP).
  2. FTP Server: Using port 21 to connect to an FTP service.
  3. Secure Websites: Using port 443 (HTTPS) for secure web pages.

Additional Resources

  • Networking Knowledge: Audio books and resources available.
  • Netstat Utility Video: For a detailed explanation of the netstat command.

Summary

  • Ports are essential for identifying services on a network.
  • They combine with IP addresses to facilitate data exchange between devices.
  • Tools like netstat can be used to monitor and troubleshoot port activity.

Call to Action

  • Subscribe, leave a comment, and watch additional related videos!