For a network service to receive incoming communications, it must listen for communications on a specific TCP or UDP port. When troubleshooting network problems, you might want to view the ports on which your computer listens for incoming connections to verify that a service is properly configured and that the port number has not changed from the default.
Netstat (Netstat.exe) is a useful command-line tool for identifying network services and the ports they listen on. Listing the ports a computer listens on is useful for verifying that a network service is using the expected port. It is common practice to change the port numbers that services listen on, and Netstat can quickly identify nonstandard listening ports.
To view open ports and active incoming connections, open a command prompt and run the following command.
netstat -a -n -o
Netstat will display a list of listening ports as well as outgoing connections and the Process Identifiers (PIDs) associated with each listener or connection.
Notice that the line in bold is listening for incoming connections on TCP port 3389, which Remote Desktop uses. Because the Foreign Address column shows an IPv4 address, you can tell that a user is connected to the computer using Remote Desktop from a computer with the IP address of 192.168.1.196. If you notice that a computer is listening for incoming connections on unexpected ports, you can use the value in the PID column to identify the process. Tools such as the Processes tab in Task Manager can reveal which process is associated with a PID.
Note To identify processes by PID in Task Manager, select the Processes tab. On the View menu, click Select Columns. Select the PID (Process Identifier) check box and then click OK.
Alternatively, if you can open a command prompt with elevated privileges, you can use the -b parameter to resolve applications associated with active connections. The following example demonstrates that using the -b parameter shows the associated process in brackets before each connection.
netstat -a -n -o -b
TCPView, a free download from Microsoft, provides similar functionality with a graphical interface. TCPView is described later in this tutorial.
In this tutorial:
- Troubleshooting Network Issues
- Tools for Troubleshooting
- Table-1 Network Troubleshooting Tools
- How to Identify a Problem with the ARP Cacher
- How to Clear the ARP Cache
- Event Viewer
- How to View Shared Folders on the Local Computer
- How to View Shared Folders on Another Computer
- Network Monitor
- Verifying that the Default DNS Server Resolves Correctly
- Verifying that a Specific DNS Server Resolves Correctly
- Verifying Specific Types of Addresses
- Using TCP for DNS Lookups
- PathPing Output
- Routing Loops
- Performance Problems
- Possible Connectivity Issues
- No Connectivity Issues
- Performance Monitor
- Data Collector Sets
- Windows Resource Monitor
- Identifying the TCP Port for a Service
- Windows 7 Testing Service Connectivity
- Determining Available Remote Management Protocols
- Why PortQry Is Great
- Task Manager
- Telnet Client
- Testing Service Connectivity
- Test TCP
- Windows Network Diagnostics
- The Process of Troubleshooting Network Problems
- How to Troubleshoot Network Connectivity Problems
- How to Troubleshoot Application Connectivity Problems
- Default Port Assignments for Common Services and Tasks
- How to Troubleshoot Name Resolution Problems
- How to Verify Connectivity to a DNS Server
- How to Use the Hosts File
- How to Troubleshoot Performance Problems and Intermittent Connectivity Issues
- How to Troubleshoot Joining or Logging on to a Domain
- How to Verify Requirements for Joining a Domain
- How to Troubleshoot Network Discovery
- How to Troubleshoot File and Printer Sharing
- How to Troubleshoot File and Printer Sharing from the Client
- How to Troubleshoot File and Printer Sharing from the Server
- How to Troubleshoot Wireless Networks
- Network Diagnostics
- How to Troubleshoot Firewall Problems