Q: I'm trying to find out which network ports I must open on my intranet firewalls to make one of our inhouse Windows client/server applications communicate properly. How can I list the remote network ports that a client-side application uses?

A: I recommend you use the Netstat command-line tool. If you run Netstat with the -an switch, the tool will display all existing connections on your local system and the local IP address, port information, remote IP address, and port information for each connection. The -a switch tells Netstat to display all connections and ports the system is listening to and the -n switch tells Netstat to display all network information in a numerical form, using the IP address and port number.

If you run Netstat with the -anob switch, it will also display the name of the local executable that is establishing the connection (the -b switch), and the local process ID of the process that owns the connection (the -o switch). If you replace the -n switch with the -f switch and run the command

netstat -afob

Netstat will display the Fully Qualified Domain Names (FQDNs) of the network entities involved instead of their IP addresses.

Netstat is available on all Windows systems by default. If you want a tool that shows you the network ports and associated processes and applications in a nice GUI, you can download Process Explorer or TCPView from Microsoft.

Discuss this Article 1

durkinr
on Feb 19, 2009
Good tips. The f switch is not available in Windows XP. Just use -aob instead.

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottYou'll have the opportunity to experience:
• The Microsoft
Technology Roadmap
• Office 365 Implementation
• Hyper-V Optimizing
• Windows 8 Deployment
and much more!

Come See Paul Thurrott & Rod Trent in Person!

Early Registration Now Open

Upcoming Training

Mastering SharePoint 2013: Succeeding, Not Just Surviving

Building on the success of the “Mastering SharePoint 2010” seminars, the presenters have updated the content to cover the latest and greatest SharePoint product: SharePoint 2013. While SharePoint 2013 is relatively new on the marketplace, the presenters have been working with SharePoint 2013 for well over a year, and have implemented it with a number of clients in production environments.

Register Now

Current Issue

May 2013 - The NameTranslate object is useful when you need to translate Active Directory object names between different formats, but it's awkward to use from PowerShell. Here's a PowerShell script that eliminates the awkwardness.

CURRENT ISSUE / ARCHIVE / SUBSCRIBE

Windows Forums

Get answers to questions, share tips, and engage with the Windows Community in our Forums.