How to Find My Port Number on My LAN

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
Communication takes place over a LAN.

Port numbers are assigned to applications and their communications on a local area network (LAN). They help to keep one particular "conversation" distinguishable from another. Default port numbers have been assigned to most applications or services. For example, standard web access (http) runs over port 80, and secure web access (https) runs over port 443. Official well-known port numbers can be found at the Internet Assigned Numbers Authority's website, which is linked in the Resources section. Many commonly known unofficial port numbers are in use by vendors as well.

Advertisement

Step 1

Open a terminal. For Windows, open a command prompt by clicking on "Start" and typing "CMD" in the "Run" box. For a Mac, type "terminal" in the finder, or go to the Applications folder, open the Utilities folder and open "Terminal." These commands can be run from the client computer or from the server side. Oftentimes, you will not have access to the server side.

Advertisement

Video of the Day

Step 2

Run the command "netstat -an" from the terminal or command prompt. The output is similar for Linux, Windows and Mac. If your output has multiple sections, then scroll up until you find these column headings: Protocol, Local address, Foreign Address and State. The local and foreign address columns indicate the Internet protocol (IP) address and the port number, separated by a colon. Each row indicates an application that is either in a conversation with another computer or waiting to establish a conversation.

Advertisement

Step 3

Look for a state of "listen" to find the port number of services running on your computer (your computer acting as a server.) "Listen" means your computer is waiting for another computer to request access to that application. Look under the "Local address" column of the associated row to determine the port number.

Advertisement

Step 4

Look for the state of "established" to find the port number your computer uses to connect to services running on another computer (your computer acting as a client). "Established" means your computer is communicating with an application on another computer. Look under the "Foreign Address" column of the associated row to determine the port number.

Advertisement

Advertisement

Step 5

Run "netstat -bn" and "netstat -abn" from a Windows command prompt to determine the port number in use by a particular application. On a computer running the application as a service (server side), look for the application in the "listening" state, and check the "Local Address" column to find that application's port number. On a computer trying to connect to the service (client side), open the application to establish the connection, and then run the "netstat -abn" command. Look for the application in the "established" state, and find that application's port number in the "Foreign Address" column.

Advertisement

This is harder to do for Linux or Mac, but the command "lsof -i" will sometimes show you the applications and the tcp ports they use.

Step 6

Find the non-standard port number that was configured on the server. Do this by using one of the previous methods or by looking at the configuration preferences for the application running on the server. If you do not have access to the server, then ask the server's administrator which port number the application uses.

Video of the Day

Advertisement

Advertisement

references & resources