Module 39 - Network Capture¶
Historical miniclass
This lesson was recovered from the former Sandia minimega site. It is preserved for reference and may describe obsolete software, operating systems, commands, or external resources. Consult the current documentation before applying it.
Introduction¶
You can capture network traffic using minimega.
PCAP¶
PCAPs contain a recording of every byte sent across the wire.
The syntax for PCAP capture is as follows:
capture
capture <pcap,>
capture <pcap,> bridge <bridge> <filename>
capture <pcap,> vm <vm id or name> <interface index> <filename>
capture <pcap,> <delete,> <id or all>
To capture PCAP on bridge foo to file foo.pcap:
To capture PCAP on VM foo to file foo.pcap, using the 2nd interface on that VM:
When run without arguments, capture prints all running captures. To stop a capture, use the delete command:
To stop all captures of a particular kind, replace <id> with all. To stop all capture of all types, use clear capture.
You can clear the capture state using
Netflow¶
Netflow summarizes the network traffic by IP address and quantity of traffic.
It can be written to a socket or file. It can be compressed with gzip. It can be saved as a binary file or ASCII.
capture
capture <netflow,>
capture <netflow,> <timeout,> [timeout]
capture <netflow,> <bridge,> <bridge>
capture <netflow,> <bridge,> <bridge> <file,> <filename>
capture <netflow,> <bridge,> <bridge> <file,> <filename> <raw,ascii> [gzip]
capture <netflow,> <bridge,> <bridge> <socket,> <tcp,udp> <hostname:port> <raw,ascii>
capture <netflow,> <delete,> <id or all>
For example, to capture netflow data on bridge mega_bridge to file in ASCII mode and with gzip compression:
You can change the active flow timeout with:
With <timeout> in seconds.
You can stop netflow captures with delete
You can clear the capture state using
Netflow Conversion¶
minimega netflow when saved as a binary format can be converted to ASCII using nfcat.