7 netstat Command Usage on Windows with Example

netstat is a command line networking device that turns out to be useful command for troubleshooting. Due to its cross-platform utility, you should use it on Linux, macOS or Home windows.

netstat may be very helpful within the following.

  • View incoming and outgoing community connections
  • View routing tables
  • Show variety of community interfaces
  • View community protocol statistics

Let’s begin…

Present all connections

To begin with netstat, let’s take a look at the command that lists all connections.

netstat -a

Sort the above command and hit enter. You will notice all energetic connections from completely different states as proven under.

C:Windowssystem32>netstat -a

Energetic Connections

Proto Native Handle International Handle State
TCP 192.168.43.15:139 DESKTOP-A0PM5GD:0 LISTENING
TCP 192.168.43.15:52484 153:https ESTABLISHED
TCP 192.168.43.15:52532 ec2-13-228-49-204:https TIME_WAIT
UDP [fe80::998c:d2d:17df:65d9%12]:58903 *:*

You see a header with Proto, native handle, international handle and state. Let’s have a look at temporary details about them.

  • Proto – outlined the protocol kind (TCP, UDP, and so on.) of the socket.
  • Native Handle – reveals your laptop’s IP handle and port, which is the native finish of the socket.
  • International Handle – Shows the distant laptop your laptop is related to, the distant finish of the socket.
  • State – defines the state of the socket (LISTENING, ESTABLISHED, CLOSE_WAIT, TIME_WAIT).

We are able to filter the connections in several methods. Let’s have a look at them.

Solely present current connection

We’ve seen the standing within the connection info. You should use the syntax under to view all established connections to/out of your Home windows server.

netstat | findstr ESTABLISHED
C:Windowssystem32>netstat | findstr ESTABLISHED
 TCP 172.16.179.128:49375 a23-77-202-113:http ESTABLISHED
C:Windowssystem32>

Comment: to view LISTEN, CLOSE_WAIT, TIME_WAIT, you should use it as follows.

To see which connections can be found LISTEN state change ESTABLISHED key phrase within the earlier to command LISTEN. This is get details about connections which can be in listening state.

netstat | findstr LISTENING
C:Windowssystem32>netstat | findstr LISTENING
  TCP 192.168.43.15:139 DESKTOP-A0PM5GD:0 LISTENING

Equally, run the next command to see all of the connections which can be current CLOSE_WAIT stands.

netstat | findstr CLOSE_WAIT
C:Windowssystem32>netstat | findstr CLOSE_WAIT
  TCP 192.168.43.15:52581 ec2-52-1-183-160:https CLOSE_WAIT
  TCP 192.168.43.15:52584 ec2-34-227-121-63:https CLOSE_WAIT

Lastly, use the TIME WAIT flag to get details about all connections current TIME WAIT stands.

netstat | findstr TIME_WAIT
C:Windowssystem32>netstat | findstr TIME_WAIT
 TCP 192.168.43.15:52590 server-13-33-179-97:https TIME_WAIT

Present PID utilized by port quantity

Every connection is an inner course of. And every course of has an ID and known as PID. We are able to see the PID of every socket connection utilizing the next command.

netstat -o

The above command lists all connections with PID. Let’s run the command and see how we get the outcome.

C:Windowssystem32>netstat -o

Energetic Connections

Proto Native Handle International Handle State PID
TCP 192.168.43.15:50664 40.90.189.152:https ESTABLISHED 3676
TCP 192.168.43.15:50733 40.90.189.152:https ESTABLISHED 10556

We referred to as an extra column PID. And it is the course of identification.

Very helpful if you wish to know which PID makes use of the port quantity in query.

netstat –o | findstr $portnumber

You may see the next info when you use the above command.

C:Windowssystem32>netstat -o | findstr 50664
  TCP 192.168.43.15:50664 40.90.189.152:https ESTABLISHED 3676

Present statistics of all protocols

Helpful if you must search for acquired header errors, acquired handle errors, dropped packets, and so on. It shows statistics of IPv4, IPv6, ICMPv4, ICMPv6, TCP, UDP, and so on.

netstat –s

You will notice the statistics of all protocols as proven under.

C:Windowssystem32>netstat -s
IPv4 Statistics

Packets Acquired = 1097370
Acquired Header Errors = 0
Acquired Handle Errors = 9
Datagrams Forwarded = 0
Unknown Protocols Acquired = 0
Acquired Packets Discarded = 1425
Acquired Packets Delivered = 1098173
Output Requests = 743601
Routing Discards = 0
Discarded Output Packets = 43
Output Packet No Route = 23
Reassembly Required = 0
Reassembly Profitable = 0
Reassembly Failures = 0
Datagrams Efficiently Fragmented = 0
Datagrams Failing Fragmentation = 0
Fragments Created = 0

IPv6 Statistics

Packets Acquired = 24
Acquired Header Errors = 0
Acquired Handle Errors = 0
Datagrams Forwarded = 0
Unknown Protocols Acquired = 0
Acquired Packets Discarded = 208
Acquired Packets Delivered = 519
Output Requests = 1507
Routing Discards = 0
Discarded Output Packets = 0
Output Packet No Route = 0
Reassembly Required = 0
Reassembly Profitable = 0
Reassembly Failures = 0
Datagrams Efficiently Fragmented = 0
Datagrams Failing Fragmentation = 0
Fragments Created = 0

ICMPv4 Statistics

Acquired Despatched
Messages 52 143
Errors 0 0
Vacation spot Unreachable 52 143
Time Exceeded 0 0
Parameter Issues 0 0
Supply Quenches 0 0
Redirects 0 0
Echo Replies 0 0
Echos 0 0
Timestamps 0 0
Timestamp Replies 0 0
Handle Masks 0 0
Handle Masks Replies 0 0
Router Solicitations 0 0
Router Ads 0 0

ICMPv6 Statistics

Acquired Despatched
Messages 0 25
Errors 0 0
Vacation spot Unreachable 0 0
Packet Too Large 0 0
Time Exceeded 0 0
Parameter Issues 0 0
Echos 0 0
Echo Replies 0 0
MLD Queries 0 0
MLD Studies 0 0
MLD Dones 0 0
Router Solicitations 0 15
Router Ads 0 0
Neighbor Solicitations 0 5
Neighbor Ads 0 5
Redirects 0 0
Router Renumberings 0 0

TCP Statistics for IPv4

Energetic Opens = 4405
Passive Opens = 5
Failed Connection Makes an attempt = 164
Reset Connections = 347
Present Connections = 19
Segments Acquired = 980542
Segments Despatched = 674787
Segments Retransmitted = 5759

TCP Statistics for IPv6

Energetic Opens = 48
Passive Opens = 10
Failed Connection Makes an attempt = 38
Reset Connections = 2
Present Connections = 0
Segments Acquired = 680
Segments Despatched = 552
Segments Retransmitted = 128

UDP Statistics for IPv4

Datagrams Acquired = 117977
No Ports = 1385
Obtain Errors = 1
Datagrams Despatched = 54516

UDP Statistics for IPv6

Datagrams Acquired = 1036
No Ports = 208
Obtain Errors = 0
Datagrams Despatched = 1131

To shortly discover out any errors, you should use syntax.

netstat -s | findstr Errors
C:Windowssystem32>netstat -s | findstr Errors
 Acquired Header Errors = 0
 Acquired Handle Errors = 0
 Acquired Header Errors = 0
 Acquired Handle Errors = 0
 Errors 0 0
 Errors 0 0
 Obtain Errors = 0
 Obtain Errors = 0
C:Windowssystem32>

The above command filters all errors from the statistics of all protocols.

Present route info

To show the route desk, you should use the syntax under. The next syntax additionally lists all interfaces.

netstat –r

In case you use the command above, you will notice the routing info as proven under.

C:Windowssystem32>netstat -r
===========================================================================
Interface Record
4...8c 16 45 32 4d 3c ......Realtek PCIe GBE Household Controller
16...d4 6d 6d 27 8a 9a ......Microsoft Wi-Fi Direct Digital Adapter
5...d6 6d 6d 27 8a 99 ......Microsoft Wi-Fi Direct Digital Adapter #2
12...d4 6d 6d 27 8a 99 ......Intel(R) Twin Band Wi-fi-AC 3165
10...d4 6d 6d 27 8a 9d ......Bluetooth Machine (Private Space Community)
1...........................Software program Loopback Interface 1
===========================================================================

IPv4 Route Desk
===========================================================================
Energetic Routes:
Community Vacation spot Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.43.1 192.168.43.15 55
127.0.0.0 255.0.0.0 On-link 127.0.0.1 331
127.0.0.1 255.255.255.255 On-link 127.0.0.1 331
127.255.255.255 255.255.255.255 On-link 127.0.0.1 331
192.168.43.0 255.255.255.0 On-link 192.168.43.15 311
192.168.43.15 255.255.255.255 On-link 192.168.43.15 311
192.168.43.255 255.255.255.255 On-link 192.168.43.15 311
224.0.0.0 240.0.0.0 On-link 127.0.0.1 331
224.0.0.0 240.0.0.0 On-link 192.168.43.15 311
255.255.255.255 255.255.255.255 On-link 127.0.0.1 331
255.255.255.255 255.255.255.255 On-link 192.168.43.15 311
===========================================================================
Persistent Routes:
Community Handle Netmask Gateway Handle Metric
0.0.0.0 0.0.0.0 10.30.28.1 Default
===========================================================================

IPv6 Route Desk
===========================================================================
Energetic Routes:
If Metric Community Vacation spot Gateway
1 331 ::1/128 On-link
12 311 fe80::/64 On-link
12 311 fe80::998c:d2d:17df:65d9/128
On-link
1 331 ff00::/8 On-link
12 311 ff00::/8 On-link
===========================================================================
Persistent Routes:
None

Present interface statistics

To view the standing of all interfaces, you should use the next syntax. This shows the acquired and despatched particulars.

netstat -e
C:Windowssystem32>netstat -e
Interface Statistics
 Acquired Despatched
Bytes 8988576 2105244
Unicast packets 12972 11880
Non-unicast packets 0 0
Discards 0 0
Errors 0 0
Unknown protocols 0
C:Windowssystem32>

Show totally certified area title of international handle (distant host)

If you’re monitoring some points and wish to know the FQDN of the distant host, you should use the next syntax.

netstat –f

In case you run the above command, you will notice an identical outcome as follows.

C:Windowssystem32>netstat -f
Proto Native Handle International Handle State
TCP 192.168.43.15:50664 40.90.189.152:https LISTENING
TCP 192.168.43.15:51437 104.27.119.115:https ESTABLISHED

Comment: you’ll be able to mix findstr syntax to show correct outcomes as under.

netstat –f | findstr ESTABLISHED

The above command will filter the connections and present solely current connections. Let’s have a look at an instance.

C:Windowssystem32>netstat -f | findstr ESTABLISHED
TCP 192.168.43.15:51437 104.27.119.115:https ESTABLISHED

We are able to filter the connections utilizing the area with the next command.

netstat –f | findstr $domainnameifyouknow

Specify the area within the command and you will notice the filtered connections as follows.

C:Windowssystem32>netstat -f | findstr ec2-52-202-6-97.compute-1.amazonaws.com
TCP 192.168.43.15:52573 ec2-52-202-6-97.compute-1.amazonaws.com:https ESTABLISHED

I hope this helps you change into conversant in utilizing netstat instructions on Home windows. If you’re excited about studying Home windows administration, I like to recommend taking this course.

Rate this post
porno izle altyazılı porno porno