Network Ports Explained
Understanding Ports
This video explains what a port is, how it works, and its importance in exchanging information between programs and services.
What is a Port?
- A port is not a physical connection but rather a logical connection used by programs and services to exchange information.
- Ports have unique numbers ranging from 0 - 65535 that identify them.
- A port number is always associated with an IP address, which identifies the computer or device on a network.
- An IP address and a port number work together to exchange data on a network.
How Ports Work
- The IP address determines the geographical location of the server while the port number determines which service or program on that server will be used.
- When visiting a web page, for example Google's web page using HTTP (port 80), your computer adds port 80 to Google's IP address to locate its web server.
- Once the server is found, the IP address has done its job. Now it's the turn of the port number.
- Google's web server sees incoming requests with port number 80 and forwards them to its built-in web service so you can retrieve Google's web page.
- Netstat utility can be used to display current network connections and port activity on your computer.
Types of Ports
- Port numbers range from 0 - 65535 and are assigned by an organization called Internet Assigned Numbers Authority (IANA).
- There are three categories of ports: system or well-known ports (0 -1023), registered ports (1024 - 49151), and dynamic or private ports (49152 - 65535).
Overall, this video provides a clear understanding of what a port is, how it works, and its importance in exchanging information between programs and services.
Understanding Port Numbers
This section explains the three categories of port numbers and their usage.
Categories of Port Numbers
- Well-known port numbers are used on servers and range from 0 to 1023.
- Registered port numbers are also used on servers and range from 1024 to 49151.
- Dynamic or private port numbers are used on clients and range from 49152 to 65535.
Client-Side Ports
This section explains how dynamic or private ports are assigned by a client-side computer during a session.
Assigning Dynamic Ports
- A client-side computer assigns itself one of the dynamic or private port numbers when it wants to use a service or program on another computer or server.
- When connecting to websites, the local IP address of our computer along with the dynamic or private client-side port number being used for that particular session is displayed.
Using Port Numbers for Websites and FTP Servers
This section explains how well-known port numbers such as 21 and 80 are used for websites and FTP servers.
Connecting to Websites and FTP Servers
- Port number 80 is used for regular unsecured websites while port number 443 uses HTTPS which stands for secure.
- If you connect to an FTP server, you will see port number 21 being used.
- When connecting to multiple websites, netstat -n command displays the local IP address of our computer along with the dynamic or private client-side port number being used for that particular session.
Conclusion
This section provides additional resources and a summary of the video.
Additional Resources
- The speaker recommends some audiobooks for those interested in networking.
- The speaker also has a video on netstat utility on his channel.
Summary
- Understanding port numbers is important when connecting to servers, websites, and FTP servers.
- Well-known port numbers are used on servers while dynamic or private port numbers are used on clients.