What Is a Port Number in Networking?
Port numbers allow different applications on the same computer to share network resources simultaneously. Home network routers and computer software work with these ports and sometimes support configuring port number settings.
How Port Numbers Work
Port numbers relate to network addressing. In TCP/IP networking, both TCP and UDP use a set of ports that work together with IP addresses. These port numbers work like telephone extensions. Just as a business telephone switchboard can use the main phone number and assign each employee an extension number, a computer can have a main address and a set of port numbers to handle incoming and outgoing connections. In the same way that all employees within a building can use one phone number, one IP address can be used to communicate with various applications behind one router. The IP address identifies the destination computer, and the port number identifies the specific destination application. This is true whether it’s a mail application, file transfer program, or web browser. When you request a website from a web browser, the browser communicates over port 80 for HTTP. Then, the data is sent back over the same port and displays in the program that supports that port (the web browser). In both TCP and UDP, port numbers start at 0 and go up to 65535. The lower ranges are dedicated to common internet protocols such as port 25 for SMTP and port 21 for FTP. To find the specific values used by certain applications, view a list of the most popular TCP and UDP port numbers. For Apple software, view the TCP and UDP ports used by Apple software products.
When You May Need to Take Action With Port Numbers
The network hardware and the software automatically process port numbers. Casual users of a network do not see these port numbers and don’t 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, a broadband router supports port forwarding on its configuration screens. A common application of homeport forwarding is for online games that use non-standard ports that the router’s built-in firewall blocks. Network programmers sometimes need to specify port numbers in their code, such as in socket programming. A website URL will sometimes require a specific TCP port number to be included. For example, http://localhost:8080/ uses TCP port 8080 rather than the default port 80. This is usually seen in software development environments more than in mainstream consumer usage.
Open and Closed Ports
Network security enthusiasts also frequently discuss the port number used as a key aspect of attack vulnerabilities and protections. Ports can be classified as either open or closed. Open ports have an associated application that listens for new connection requests, and closed ports do not. A process called network port scanning detects test messages at each port number to identify which ports are open. Network professionals use port scanning as a tool to measure exposure to attackers and often lock down networks by closing non-essential ports. Hackers, in turn, use port scanners to probe networks for open ports that may be exploitable. You can use the netstat command in Windows to see information regarding active TCP and UDP connections.