Skip to content
MikroTik RouterOS Docs

Packet Sniffer

For the impatient: capture packets on an interface and save to file.

/tool sniffer set filter-interface=ether1 memory-limit=1000
/tool sniffer start

Wait for traffic, then:

/tool sniffer stop
/tool sniffer save file-name=capture.pcap

Download capture.pcap from Files and open in Wireshark.

What this does: Packet Sniffer captures network traffic passing through the router for analysis. It can filter by IP, MAC, port, protocol, or VLAN, save captures to PCAP files, and stream packets in real-time to Wireshark using TZSP protocol.

When to use this:

  • Troubleshooting network connectivity issues
  • Analyzing protocol behavior or application traffic
  • Diagnosing firewall rule problems
  • Investigating security incidents
  • Debugging VoIP/SIP issues
  • Verifying traffic flow through the router

Prerequisites:

  • Access to RouterOS via Winbox, SSH, or WebFig
  • Wireshark installed on workstation (for analysis)
  • Sufficient free memory for capture buffer

Set up the capture filter and memory allocation.

/tool sniffer set filter-interface=ether1 memory-limit=1000

Begin capturing packets.

/tool sniffer start

Check captured data in real-time.

/tool sniffer packet print

Expected output:

# INTERFACE TIME NUM DIR SRC-ADDRESS DST-ADDRESS PROTOCOL SIZE
0 ether1 00:00:01.234 1 rx 192.168.1.100:443 192.168.1.1:52341 tcp 1500
1 ether1 00:00:01.235 2 tx 192.168.1.1:52341 192.168.1.100:443 tcp 52

Stop the capture and save to file.

/tool sniffer stop
/tool sniffer save file-name=capture.pcap

Download the file from /file via Winbox, FTP, or WebFig and open in Wireshark.

Use the quick command for immediate filtered output:

/tool sniffer quick interface=ether1

Press Ctrl+C to stop. This shows packets in real-time without saving.

Capture traffic to/from specific hosts:

/tool sniffer set filter-interface=ether1 \
filter-ip-address=192.168.1.100,10.0.0.0/8 \
memory-limit=2000
/tool sniffer start

Capture web traffic only:

/tool sniffer set filter-interface=ether1 \
filter-port=80,443 \
memory-limit=2000
/tool sniffer start

Exclude SSH (useful when capturing over SSH):

/tool sniffer set filter-port=!22

Capture only ICMP (ping) traffic:

/tool sniffer set filter-interface=ether1 \
filter-ip-protocol=icmp
/tool sniffer start

Other protocols: tcp, udp, ospf, gre, ipsec-ah, ipsec-esp, igmp

Stream packets in real-time to Wireshark for live analysis:

/tool sniffer set streaming-enabled=yes \
streaming-server=192.168.1.100 \
streaming-port=37008 \
filter-interface=ether1 \
filter-stream=yes
/tool sniffer start

In Wireshark:

  1. Start capture on any interface
  2. Filter: udp.port == 37008
  3. Wireshark automatically decodes TZSP payload

Alternative: Use “UDP Listener” remote capture if available.

Reduce capture size by omitting payload:

/tool sniffer set only-headers=yes \
filter-interface=ether1 \
file-limit=10000
/tool sniffer start

Useful for high-traffic captures or when only interested in packet metadata.

Monitor traffic across all router interfaces:

/tool sniffer set filter-interface=all memory-limit=5000
/tool sniffer start

Analyze protocol distribution and active hosts:

# Protocol breakdown
/tool sniffer protocol print
# Active hosts
/tool sniffer host print
# Active connections
/tool sniffer connection print

Save directly to file for long-running captures:

/tool sniffer set file-name=longcapture.pcap \
file-limit=50000 \
filter-interface=ether1
/tool sniffer start

Capture stops automatically when file-limit is reached.

/tool sniffer print

Expected: Shows running=yes when active.

/tool sniffer packet print count-only

Expected: Shows number of captured packets.

/ping 192.168.1.100 count=3

Expected: Streaming server is reachable.

SymptomCauseSolution
No packets captured on bridgeHardware offloading bypasses CPUDisable hw-offload: /interface bridge set [find] hw=no
Traffic between bridge ports missingSwitch fabric handles trafficSniff on physical interfaces, not bridge; or use port mirroring
TZSP not decoded in WiresharkWireshark not decoding payloadUse “UDP Listener” capture or filter udp.port==37008
Capture includes streaming packetsfilter-stream=noSet filter-stream=yes to exclude TZSP traffic
Older packets lostMemory buffer overflowIncrease memory-limit or save to file
Router slow during captureHigh traffic volumeReduce capture scope with filters; use only-headers=yes
Wireless client traffic missingClient-to-client forwardingDisable forwarding or use wireless sniffer mode
Traffic generator packets missingFast-path enabledDisable fast-path on traffic generator
Captured data disappears10-minute memory timeoutSave to file or increase capture frequency

Common Mistakes

  • Don’t capture on bridge with hw-offload - Traffic switched in hardware bypasses the CPU and sniffer
  • Don’t forget filter-stream=yes - Without it, TZSP streaming creates feedback loop
  • Don’t set file-limit larger than free memory - Can cause router instability
  • Don’t capture unfiltered on busy interfaces - High CPU usage and buffer overflow
  • Don’t expect encrypted payloads - Sniffer captures packets as-is; encrypted traffic stays encrypted
PropertyDescription
filter-ip-addressMatch source or destination IPv4
filter-src-ip-addressMatch source IPv4 only
filter-dst-ip-addressMatch destination IPv4 only
filter-ipv6-addressMatch source or destination IPv6
PropertyDescription
filter-portMatch source or destination port
filter-src-portMatch source port only
filter-dst-portMatch destination port only

Prefix with ! to exclude (e.g., !22 excludes SSH).

PropertyValues
filter-ip-protocoltcp, udp, icmp, ospf, gre, ipsec-ah, ipsec-esp, igmp
filter-mac-protocolip, ipv6, arp, vlan, pppoe, mpls-unicast, lldp, lacp
PropertyTypeDefaultDescription
filter-interfacename/allallTarget interface(s)
filter-directionany/rx/txanyTraffic direction
memory-limitKiB100Buffer size for capture
memory-scrollyes/noyesOverwrite old data when full
file-namestring-Output file path
file-limitKiB1000Max file size before stop
only-headersyes/nonoCapture headers only
streaming-enabledyes/nonoEnable TZSP streaming
streaming-serverIP0.0.0.0TZSP receiver IP
streaming-portport37008TZSP destination port
filter-streamyes/noyesExclude streaming packets
CommandDescription
/tool sniffer startBegin capture
/tool sniffer stopStop capture
/tool sniffer save file-name=XSave to file
/tool sniffer quickReal-time filtered view
/tool sniffer packet printView captured packets
/tool sniffer protocol printView protocol statistics
/tool sniffer host printView participating hosts
/tool sniffer connection printView active connections
/tool sniffer printShow configuration
/tool sniffer setConfigure settings