312-50V11 · Question #322
What is the correct PCAP filter to capture all TCP traffic going to or from host 192.168.0.125 on port 25?
The correct answer is D. tcp.port == 25 and ip.host == 192.168.0.125. Wireshark display filters use a structured field-based syntax requiring valid field names and comparison operators to isolate traffic by protocol, port, and IP address.
Question
What is the correct PCAP filter to capture all TCP traffic going to or from host 192.168.0.125 on port 25?
Options
- Atcp.src == 25 and ip.host == 192.168.0.125
- Bhost 192.168.0.125:25
- Cport 25 and host 192.168.0.125
- Dtcp.port == 25 and ip.host == 192.168.0.125
How the community answered
(57 responses)- A4% (2)
- B2% (1)
- C2% (1)
- D93% (53)
Why each option
Wireshark display filters use a structured field-based syntax requiring valid field names and comparison operators to isolate traffic by protocol, port, and IP address.
tcp.src == 25 is not a valid Wireshark display filter field (the correct field is tcp.srcport), and it would only match traffic originating from port 25, missing traffic destined for port 25.
The syntax host 192.168.0.125:25 is not valid in either BPF capture filter or Wireshark display filter syntax; host and port must be declared as separate filter primitives joined by a logical operator.
port 25 and host 192.168.0.125 is valid BPF/libpcap capture filter syntax used by tcpdump, not Wireshark display filter syntax, so it cannot be entered in the Wireshark display filter bar.
In Wireshark display filter syntax, tcp.port == 25 matches TCP segments where either the source or destination port equals 25, and ip.host == 192.168.0.125 matches packets where that address appears as either source or destination. Combining both with 'and' correctly captures all TCP port 25 traffic flowing to or from the specified host.
Concept tested: Wireshark display filter syntax for host and port
Source: https://www.wireshark.org/docs/wsug_html_chunked/ChWorkBuildDisplayFilterSection.html
Topics
Community Discussion
No community discussion yet for this question.