Search The Site

How To Use The Netstat Command

Using the netstat command. The Netstat (Network Statistics) tool can be used to monitor connections to a remote host, displaying protocol stats for active connections, and monitoring IP addresses or the domain names of hosts with established connections. To display the parameters used for netstat, open a command prompt with admin priviledges and type netstat /?

Accepted parameters for Netstat are as follows:

  • -a : Shows all the connections and the listening ports by hostname.
  • -b : Shows the executable involved in creation of all the connections.
  • -e : Shows the Ethernet packets and bytes to and from the host.
  • -n : Shows the address and port numbers by does not resolve the address to the hostname.
  • -o : Shows TCP connections and also includes the relevant process ID (PID). This can be used in with –a, -n, and –p. This is unavailable in Windows versions prior to 2008 R2.
  • -p protocol : Shows the statistics based on protocol specified. The protocols which can be specified are TCP, UDP, TCPv6 and UDPv6. This can be used with the –s parameter to show TCP, UDP, ICMP, IP, TCPv6, UDPv6, ICMPv6, or IPv6.
  • -s : Shows the statistics on a an individual protocol basis. This can be used with an –p parameter to define a set of protocols.
  • -t : Shows the current connection offload state.
  • -r : Shows the route table, the information shown includes the network destination, gateway, netmask, interface, and metric (ie number of hops).
  • [Parameter] Interval : Shows the info at every specified interval, the interval is in seconds. Hit Ctrl+C to stop the intervals.