How to continuously run Wireshark without eating up all of the RAM

memorywireshark

I need to run Wireshark all night to capture packets from a certain IP address. I notice the longer Wireshark runs, the more RAM it takes up because it stores all of the packets found during the run. There are 3 possible solutions for me, but I couldn't find any answers online:

  1. Configure Wireshark to only save in RAM the packets the packets that appear through the filter (not ALL packets). I'm not sure if this is possible.
  2. Configure Wireshark to automatically save packets to a file every hour and free its memory after storing to file.
  3. Use an alternative to Wireshark that is designed to run for a while.

Best Answer

For Windows environments (like mine where it is a big deal to install wireshark on a server), ever since Win7/2008R2 there has been built in packet capture available.

This will capture everything until you tell it to stop: netsh trace start capture=yes persistent=yes tracefile=c:\temp\results.etl

Monitor the trace: netsh trace show status

Stop the trace: netsh trace stop

It does support all the usual: Filtering, circular logging and even can persist across reboots. Another plus is the command help: try netsh trace ? or netsh trace show ? You do need to install Microsoft Message Analyzer to view/export the results.

It seems like for your situation you'd be set with the below command:

netsh trace start capture=yes persistent=yes tracefile=c:\temp\results.etl maxSize=500

That will give you circular logging with 500MB files, and persist across reboots.