How to Check Network Statistics using Netstat in Windows

Network statistics play a key role in computer networking. We are going to see how to check network statistics using Netstat in Windows in this post.

But before we proceed further, we are going to learn a little bit about ports.

What are Ports?

How can we move ahead if we don’t understand this very concept first?

We are not talking about hardware ports here, but the software ones. The ones that you do not see. But the concept is very similar to the hardware ports like USB, Ethernet, HDMI port etc.

Just like how the above ports allow establishing connectivity, the software ports assist in establishing connectivity as well.

That brings us to the definition of ports.

Ports are nothing but software-based virtual communication endpoints. Each port is assigned a specific process or a network service.

Each port is identified by an address combination using a 16-bit unsigned number ranging from 0 to 65535. This number is called Port Number.

The most common transport protocols that use port numbers are:
TCP and UDP

If you are keen on learning more about which port numbers are assigned for what, here is a list of well-known ports of TCP and UDP.

Steps on How to Check Network Statistics using Netstat in Windows

Netstat or Network Statistics is a network utility that allows you to check incoming and outgoing network connections across various protocols, routing table, owning processes, statistics, etc.

We are going to learn how to leverage netstat from our command prompt in Windows 10.

Before we learn how to check which port number is free we will learn more about some ‘netstat’ commands.

It is advisable to be in an administrative mode because generally many port numbers are kept hidden from the guest users.

Step 1: Open cmd (command prompt) in your system as an administrator.

If you don’t know how to open it as an administrator here’s how to do that:

As shown above, you can simply type ‘cmd’ in the search bar at the left bottom of your screen. Then click on Run as administrator.

NOTE: If UAC (User Account Control) asks you for confirmation, just click on Yes.

Using Netstat to Check Network Statistics in Windows

Post this point remember to use the above-mentioned Step.

How to Check Active Connections

Perform Step 1 (going forward assume Step 1 has to be performed) and then in the opened command prompt window, type the following:

netstat

and press enter.

Doing so will list down the active connections in a tabular fashion with the first column specifying the Protocol. The second one tells the local address, the third foreign, and the last one tells you their current State.

How to Check Network Statistics using Netstat

In the example above, you can see in the local address column, that the first part 127.0.0.1 is your localhost or loopback address. The second bit i.e. 60804 is the port number of your local device which has established a connection.

NOTE: You can press Ctrl + C, if you do not want the search to continue at any point.

How to Check all Connections and Listening Ports

If you want to check all the connections of all the protocols you can use the following command:

netstat -a

where a means all sockets of all protocols like TCP, UDP etc.

Using netstat -a to Check Network Statistics in Windows

Understanding Port Messages

All the ‘Listening’ ports are available or the ‘Open’ ports that you can use. All the ports that say ‘Established’ are taken.

In other words, LISTENING means that a classic open port is listening for inbound connections.

ESTABLISHED, on the other hand, insinuates that there is an actual connection between your machine and the remote IP and its port.

Sometimes you also see other statuses like CLOSE_WAIT. It is a state in which the TCP goes while trying to end an established connection. The state means that the socket hasn’t been closed and that program is still in the process of running. But it has been closed from the other side.

TIME_WAIT is yet another state which you might see. It means that your system has terminated the connection.

How to Check Bound Non-Listening Ports

If you also want to check bound nonlistening ports, you could alternatively use:

netstat -q

and press Enter.

How to Check Executable files involved in Each Connection

The command to check the executable files in each connection is:

netstat -b
Check executable files in each connection tutorial How to Check Network Statistics using Netstat in Windows

As you can see in the image they are the executable files that have either established connection or are in waiting mode.

How to Display all Connections and Listening Ports and Executable Files

The above commands can be joined together as well, hence if you want to check all the connections and listening ports along with the executable file information, you can just type:

netstat -ab

and press enter where -a means all sockets of all protocols like TCP, UDP etc. and -b is used to display executable files.

How to Check Network Statistics using Netstat in Windows image 3

How to Display Addresses and Port Numbers in Numerical Form

If you want to display the addresses in numerical form type the following:

netstat -n

As you can see in the image below, even the foreign address has been converted into number format.

How to Display Routing Table

In order to display the routing table just use the following command:

netstat -r

and press Enter.

Apart from giving an Interface List, you will get a glimpse of how your IP connections are being routed.

How to Check Network Statistics using Netstat in Windows image 2

How to Check Connections for a specific Protocol

You can use the following command for that:

netstat -p proto

where replace the word proto with the protocol you want to check connections for and press enter.

Like this:

How to Get FQDNs for Foreign Addresses

If you want to get FQDN i.e. Fully Qualified Domain Names for foreign addresses, the command to use is:

netstat -f
How to Check Network Statistics using Netstat in Windows image

How to Check Owning Process Id

Adding just -o to netstat command will give you the owning process Id as well.

So punch in the following command and press enter:

netstat -o

How to Check Statistics for your Network using Netstat

Netstat gives you the ability to check per-protocol statistics which gives you a glimpse of how many packets were received, errors, discarded or delivered status etc.

You can obtain that using the following command:

netstat -s

Press Enter after you have typed the above.

How to Check Network Statistics using Netstat in Windows

By default, you get the statistics for the following protocols:
IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPv6

How to Check Statistics for a Specific Protocol

If you want to check statistics based on a specific protocol, you can type the following:

netstat -sp proto

where replace the word proto with the protocol you want the statistics for and then press enter.

for e.g.:

netstat -sp udp

One thing to note here is that what it also does is show you the active connections along with the statistical information.

How to Check Ethernet Statistics

In a similar fashion if you want to grab ethernet interface statistics, you can type the following:

netstat -e

and press Enter.

You can combine other flags for various results too.

For e.g.

netstat -es

or

netstat -se

will give you results for both ethernet and protocol statistics.

How to Check Offload State of Connections

The command to use in order to check the offload state of current connections is:

netstat -t

How to Display NetworkDirect connections, listeners, and shared Endpoints

The command that would help you grab Active, NetworkDirect Connections, Listeners and Shared Endpoints is:

netstat -x 

How to Display TCP Connection Template for Connections

The command that displays the TCP connection template is:

netstat -y

However, remember this cannot be clubbed with other commands.

Conclusion of How to Check Network Statistics using Netstat in Windows Article

Now that you know all sorts of port-related messages you might wonder how to find whether a specific port is open or not.

We will see that in another post.

If you liked our post on How to Check Network Statistics using Netstat in Windows, please let us know in the comments. Meanwhile, you can explore the site for such useful information.

Scottshak

Poet. Author. Blogger. Screenwriter. Director. Editor. Software Engineer. Author of "Songs of a Ruin" and proud owner of four websites and two production houses. Also, one of the geekiest Test Automation Engineers based in Ahmedabad.

You may also like...

Leave a Reply