How to use the Netstat command to troubleshoot network issues


Netstat (Network Statistics) is a command-line tool used for monitoring and troubleshooting computer network issues. This tool shows you all your device’s connections in as much detail as you need.

With Netstat, you can view all your connections and their ports and stats. This information is valuable when setting up or fixing your connectivity. This article will introduce you to the Netstat command and the main parameters for filtering information displayed about your connections.

Using Netstat command to troubleshoot network issues

We’ll explore the following topics in this section:

  1. How to use the Netstat command.
  2. Use netstat parameters to filter connection information.
  3. Combining Netstat parameters.

Join me as we take a go through the above topics to help you better understand this tool and learn how to use it to troubleshoot your network issues.

1] How to use the netstat command

netstat command

Click on the Start button and search for Command Prompt. Open Command Prompt with elevated privileges by right-clicking on it and selecting the Run as administrator option.

You can open Netstat by typing the following command and pressing ENTER:


If you’re new to networking, you may not understand what the columns mean.

  • Proto: The network protocol. It could be either TCP or UDP.
  • Local Address: The IP addresses and ports of your computer’s network interfaces for the given connections.
  • Foreign Address: The IP addresses and port names of the remote devices.
  • StateIndicates the state of the connection. For example, find out active and closed connections.

The netstat command shows you your active connections and their details. However, you’d notice that the foreign address column prints the IP address and port names.

To show the connections’ port numbers instead of the port names, next to the IP addresses, use the following command:

netstat -n

Further, the system can disconnect or connect to networks, and the network details can change at intervals. Hence, we can use the following command to refresh the netstat network details at intervals using this command:

netstat -n 5

To stop the refreshing, press the CTRL + C key combination.

NOTE: The 5 in the command above refreshes the command every 5 seconds. You can modify this value if you wish to increase or shorten the time interval.

2] Use netstat parameters to filter connection information

The netstat command is a powerful command that can show you every detail about your device’s connections. Let’s explore the following most commonly used netstat parameters to find specific network details.

  • Display active and inactive connections

Show the networks that are active or inactive.

netstat -a
  • Display applications information

List all applications that are associated with the connections.

netstat -b
  • View network adapter stats

Show statistics on incoming and outgoing network packets.

netstat -e
  • Display foreign addresses’ fully qualified domain name (FQDNS)

If you don’t want to see the port numbers or names, the following netstat parameter will show your foreign addresses’ fully qualified domain names.

netstat -f
  • Show port numbers instead of names

Change the foreign address port names to port numbers.

netstat -n

Similar to netstat, and it has an extra column for every connection’s Process ID (PID).

netstat -o
  • Filter connections by protocol

Display the connections for the protocol you specify – UDP, TCP, tcpv6, or udpv6.

netstat -p udp

NOTE: You should change the udp part to the protocol whose connections you want to view.

  • View non-listening and listing port

Show connections and their listening and bound non-listening ports.

netstat -q

Categorize networks by available protocols – UDP, TCP, ICMP, IPv4, and IPv6.

netstat -s

Show the routing table of your current network. It lists every route to destination and matrix available on your system. Similar to the route print command.

netstat -r
  • Display offload state connections

Show a list of connection offload state of your current connection.

netstat -t
  • See NetworkDirect connections

Shows all NetworkDirect connections.

netstat -x
  • Display connection Templates

Show your networks’ TCP connections templates.

netstat -y

3] Combining Netstat parameters

You can further filter the Netstat parameters to show you information about your connections any way you want. From the above commands, you only have to add a second parameter to show a combined view.

For instance, you can combine the -s and -e parameters to view the statistics for every protocol. In this way, you can combine other parameters to get the results you want.

When mixing multiple Netstat parameters, you don’t need to include two dashes (-). You can use one dash (-) and append the parameter letters without a second one.

For example, instead of typing the following command:

netstat -s -e

You can write it as:

netstat - se

netstat se command

If you forget the parameters, a quick way to remember them is by asking netstat to help out. Simply run the following command:

netstat /?

To stop the netstat query process at any time, press the CTRL + C key combination.


netstat command

Source link


MORRIS is an impassioned technology writer. He always inspires technologists with his innovative thinking and practical approach. A go-to personality for every Technical problem, no doubt, the chief problem-solver!

Leave a Reply

Your email address will not be published.