top of page

What is Port Number?

  • Writer: Yash asti
    Yash asti
  • May 2, 2017
  • 3 min read

A port number is a way to identify a specific process to which an Internet or other network message is to be forwarded when it arrives at a server. For the Transmission Control Protocol and the User Datagram Protocol, a port number is a 16-bit integer that is put in the header appended to a message unit.

A port number is a way to identify a specific process to which an Internet or other network message is to be forwarded when it arrives at a server. For the Transmission Control Protocol and the User Datagram Protocol, a port number is a 16-bit integer that is put in the header appended to a message unit. This port number is passed logically between client and server transport layers and physically between the transport layer and the Internet Protocol layer and forwarded on.

For example, a request from a client (perhaps on behalf of you at your PC) to a server on the Internet may request a file be served from that host's File Transfer Protocol (FTP) server or process. In order to pass your request to the FTP process in the remote server, the Transmission Control Protocol (TCP) software layer in your computer identifies the port number of 21 (which by convention is associated with an FTP request) in the 16-bit port number integer that is appended to your request. At the server, the TCP layer will read the port number of 21 and forward your request to the FTP program at the server.

Some services or processes have conventionally assigned permanent port numbers. These are known as well-known port numbers. In other cases, a port number is assigned temporarily (for the duration of the request and its completion) from a range of assigned port numbers. This is called an ephemeral port number.

How Port Numbers Work

Port numbers relate to network addressing. In TCP/IP networking, both TCP and UDPutilize their own set of ports that work together with IP addresses.

These port numbers work like telephone extensions. Just as a business telephone switchboard can use a main phone number and assign each employee an extension number (like x100, x101, etc.), so a computer has a main address and a set of port numbers to handle incoming and outgoing connections.

In both TCP and UDP, port numbers start at 0 and go up to 65535. Numbers in the lower ranges are dedicated to common Internet protocols (like 21 for FTP and 80 for HTTP). To find the specific values used by certain applications, see this TCP / UDP Port Number Glossary. Those using Apple software can also refer to TCP and UDP ports used by Apple software products.

When You May Need to Take Action with Port Numbers

Port numbers are processed by network hardware and the software automatically. Casual users of a network do not see them nor need to take any action involving their operation. Individuals can, however, encounter network port numbers in certain situations:

  • network administrators may need to set up port forwarding to allow the port numbers of specific applications to pass through a firewall. On home networks, broadband routers support port forwarding on their configuration screens.

  • network programmers sometimes need to specify port numbers in their code, such as in socket programming.

  • sometimes, a Web site URL will require a specific TCP port number to be included. For example, http://localhost:8080/ uses TCP port 8080 rather than the default port 80. Again, this is usually seen in software development environments than in mainstream usage.

Open and Closed Ports

Network security enthusiasts also frequently discuss port number usage as a key aspect of attack vulnerabilities and protections. Ports can be classified as either open or closed: Open ports have an associated application listening for new connection requests while closed ports do not.

A process called network port scanning directs test messages at each port number individually to identify which ports are open. Network professionals use port scanning as a tool to measure their exposure to attackers and often lock down their networks by closing non-essential ports. Hackers, in turn, use port scanners to probe networks for open ports that may be exploitable.

 
 
 

Comments


bottom of page