The netstat command is available from within the Command Prompt in most versions of Windows including Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server operating systems, and some older versions of Windows too.
Netstat allows you to display statistics about your Ethernet interface. If any errors are indicated in the display, you might have problems with your network connection that are slowing the network down. If the error packets approach 1% of the total number of packets, something is probably wrong with your NIC or physical interface.
- In the command prompt or DOS prompt.
- Type in netstat to list all current network connections, not just inbound but outbound as well.
- You should see a list of connections listed. Useful again for finding live attacks.
- Type in netstat -? to see options with this command. You should see -a, -e and others.
- Now type in netstat -a
- Type in netstat -e. These statistics include the number of bytes and packets received and sent through the Ethernet interface.
- Type in netstat -f. This show statistics for all active connections.
- To see statistics for all protocols, type netstat -s and press Enter.
- To limit the display to just IP statistics, type netstat -ps IP and press Enter.
- To see your active network statistics updated every 5 seconds, type netstat -e -t 5 and press
Enter. Press Ctrl+C to stop the program.
- Type netstat -o. This shows active TCP connections, but it also displays the corresponding process identifier [-o] for each connection so you can determine which program on your computer initiated each one.
- Pay attention to the PID column. In somes cases, the PIDs are all the same, meaning that the same program on your computer opened these connections. However, to determine what program is represented by the PID of say 2948 on your computer, all you have to do is open Task Manager, click on the Processes tab, and note the Image Name listed next to the PID your are looking for in the PID column. Go ahead and try this....
Also, please be aware that using the netstat command with the -o option can be very helpful when tracking down which program is using too big a share of your bandwidth. It can also help locate the destination where some kind of malware, or even an otherwise legitimate piece of software, might be sending information without your permission.
Note: While this and the previous example were both run on the same computer, and within just a minute of each other, you can see that the list of active TCP connections is considerably different. This is because your computer is constantly connecting to, and disconnecting from, various other devices on your network and over the Internet.
- To display ICMP information, type netstat -ps ICMP and press Enter. A variety of
ICMP message types are displayed along with how many of each type of message were received and sent. Most, if not all, will be Echo and Echo Reply messages.
- Ask a fellow student for their IP address. Then use that e.g. Type ping 184.108.40.206 and press Enter. This command should generate ICMP Destination
- To see whether the number of Destination Unreachable messages has increased, type netstat -ps ICMP and press Enter. The ICMP TTL-Expired messages used in Tracert are called Time Exceeded messages in Netstat.
- Type tracert www.ulster.ac.uk and press Enter.
- To see whether the number of Time Exceeded messages has increased, type netstat -ps ICMP and press Enter.
- To display your computerís routing table, type netstat -r and press Enter. Every computer has a routing table it uses to decide which interface to send packets to. The first entry lists the network destination as 0.0.0.0, which is the entry for your default gateway.
- Finally, type netstat -s -p tcp -f. Here we wish to see protocol specific statistics [-s] but not all of them, just TCP stats [-p tcp]. We also want the foreign addresses displayed in FQDN format [-f]. Please scroll up in the command windows to see TCP stats displayed before the list of active connections was created.