A port is a logical address that is assigned to a specific service or running application on the computer. It is a connection endpoint ( a docking point) that channels traffic to/from a specific service. Similar to physical sea ports that were used for ships to dock and allow for transportation to and from a country
Today all computers have to communicate with the other systems over the network locally or over the internet to access services or share information, before passing this information these systems first establish a connection each end of which is a socket, to make sure the information flows remains specific to that request and reaches the right system and service running on the system. A socket is a combination of transport protocol (TCP or UDP), an IP Address, and a Port.
The term port here should not be confused with physical ports on network devices, ethernet cards etc, to connect cables or establish connectivity, here it refers to a part of the logical address as explained above.
Referring to OSI model, ports are a transport layer (layer 4) concept. Only a transport protocol such as the Transmission Control Protocol (TCP) or User Datagram Protocol (UDP) can indicate which port a packet should go to.
Port Number Ranges
Service names and port numbers are used to differentiate between the various services that execute over transport protocols, such as TCP or UDP. Internet Assigned Numbers Authority (IANA) is responsible for assigning service names and port numbers and maintains the registries which store service names and port numbers. Port Number is a 16-bit numerical value that ranges from 0 to 65535 and the port registries for transport protocols are divided into three number ranges.
- System Ports (0-1023)
- User Ports (1024-49151)
- Dynamic / Private Ports (49152-65535)
Default Ports for Common Services
The system ports reserved for specific applications are referred to as well-known ports or default ports, for example FTP uses 21, HTTP uses 80, and DNS uses 53. This default port on which the application works can be modified as per our requirements by editing the configuration file for the specific services for example httpd.conf, named.conf etc.
We can check the ports that the service is listening on, using netstat or nmap commands refer to Top 10 network commands and their uses – Upspir for more details
/etc/services
We can find the details of the well-known ports in the /etc/services file, The /etc/services
file is used by applications to translate human readable service names into port numbers when connecting to a machine across a network. The file will typically include the service name, port/protocol, any aliases, and comments. 1
The /etc/services file should not be modified. The file is also a good resource to see which services use which port numbers and the protocols that are specified to work. 1
Some well-known ports
20 FTP Data (For transferring FTP data) | |
21 FTP Control (For starting FTP connection) | |
22 SSH | |
23 Telnet | |
25 SMTP | |
53 DNS | |
67 BootP | |
69 TFTP | |
80 HTTP | |
110 POP3 | |
123 NTP | |
389 LDAP | |
443 HTTPS |
Note : On Windows machines, the service names, port numbers and protocols can be found in the C:windows\system32\drivers\etc\services file.
Reference
1https://access.redhat.com/articles/1761
.
.
Author
Nikhil Kumar Ahluwalia
Founder Upspir
Nikhil has over 16 years of experience in the tech industry, before starting UPSPIR he was Vice President – Support and Delivery at Ameyo/Exotel. Nikhil has a vast experience in leading technical support and delivery teams. By building strong processes around training, mentoring and development of people he was able to create high performing support, delivery and professional services organizations in Ameyo, He is passionate about developing people, which motivated him to start Upspir. With Upspir he aims to take his passion next level by sharing his experiences and learning with those who want to build their career in the technical support domain.