312-50V10 · 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 field-based syntax where tcp.port matches traffic on either source or destination port, and ip.host resolves to the target IP.
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
(25 responses)- A4% (1)
- B12% (3)
- C4% (1)
- D80% (20)
Why each option
Wireshark display filters use a field-based syntax where tcp.port matches traffic on either source or destination port, and ip.host resolves to the target IP.
tcp.src == 25 only matches packets where port 25 is the source port, missing all inbound traffic destined for port 25 and therefore failing to capture all traffic 'to or from' the host.
The syntax host 192.168.0.125:25 is not valid in either BPF capture filter or Wireshark display filter format and will produce a parse error.
port 25 and host 192.168.0.125 is valid BPF capture filter syntax but does not restrict results to TCP-only traffic, potentially including UDP port 25 traffic.
The display filter tcp.port == 25 correctly matches TCP segments where port 25 appears in either the source or destination field, capturing traffic both to and from that port. Combined with ip.host == 192.168.0.125, the full filter isolates all TCP port 25 traffic for that specific host using valid Wireshark display filter syntax, which is the correct approach for this type of targeted capture.
Concept tested: Wireshark display filter syntax for TCP host and port
Source: https://www.wireshark.org/docs/man-pages/wireshark-filter.html
Topics
Community Discussion
No community discussion yet for this question.