How to filter by IP address in Wireshark?
Asked Answered
J

8

298

I tried dst==192.168.1.101 but only get :

Neither "dst" nor "192.168.1.101" are field or protocol names.

The following display filter isn't a valid display filter:
dst==192.168.1.101
Jongjongleur answered 28/10, 2010 at 13:34 Comment(0)
S
544

Match destination: ip.dst == x.x.x.x

Match source: ip.src == x.x.x.x

Match either: ip.addr == x.x.x.x

Surovy answered 28/10, 2010 at 13:59 Comment(1)
ip.host have the same effect with ip.addr.Algerian
S
42

Filtering IP Address in Wireshark:

(1)single IP filtering:

ip.addr==X.X.X.X

ip.src==X.X.X.X

ip.dst==X.X.X.X

(2)Multiple IP filtering based on logical conditions:

OR condition:

(ip.src==192.168.2.25)||(ip.dst==192.168.2.25)

AND condition:

(ip.src==192.168.2.25) && (ip.dst==74.125.236.16)

Superhighway answered 4/5, 2013 at 4:47 Comment(0)
S
40

You can also limit the filter to only part of the ip address.

E.G. To filter 123.*.*.* you can use ip.addr == 123.0.0.0/8. Similar effects can be achieved with /16 and /24.

See WireShark man pages (filters) and look for Classless InterDomain Routing (CIDR) notation.

... the number after the slash represents the number of bits used to represent the network.

Sun answered 19/3, 2013 at 14:21 Comment(0)
I
19

If you only care about that particular machine's traffic, use a capture filter instead, which you can set under Capture -> Options.

host 192.168.1.101

Wireshark will only capture packet sent to or received by 192.168.1.101. This has the benefit of requiring less processing, which lowers the chances of important packets being dropped (missed).

Ignoramus answered 14/9, 2012 at 2:26 Comment(4)
I saw that on my friends computer as well. The capture filters may have been moved elsewhere in the newer versions of Wireshark.Ignoramus
Maybe because Im running the trial version... >_<Marquita
Capture filters can only be built when the capture is stopped. They have to be pre-compiled. Stop the capture and the menu "Capture... Options..." option will be re-enabled.Bend
I tried this and was not able to capture packets from a different device connected to the same router. Is there any other way to capture packets of another device connected to the same router using my own laptop?Mile
A
11

Try

ip.dst == 172.16.3.255
Arduous answered 28/10, 2010 at 13:38 Comment(0)
B
11

Actually for some reason wireshark uses two different kind of filter syntax one on display filter and other on capture filter. Display filter is only useful to find certain traffic just for display purpose only. its like you are interested in all trafic but for now you just want to see specific.

but if you are interested only in certian traffic and does not care about other at all then you use the capture filter.

The Syntax for display filter is (as mentioned earlier)

ip.addr = x.x.x.x or ip.src = x.x.x.x or ip.dst = x.x.x.x

but above syntax won't work in capture filters, following are the filters

host x.x.x.x

see more example on wireshark wiki page

Bethina answered 25/3, 2015 at 4:59 Comment(2)
This took me a very long time to get used to. It also makes half the advice you can find irrelevant, which is a barrier to entry. :(Cephalic
The reason the capture filter uses a different syntax is that it is looking for a pcap filtering expression, which it passes to the underling libpcap library. Libpcap originated out of tcpdump. With Wireshark's more rich understanding of protocols it needed a more rich expression language, so it came up with its own language.Malva
D
1

in our use we have to capture with host x.x.x.x. or (vlan and host x.x.x.x)

anything less will not capture? I am not sure why but that is the way it works!

Dugald answered 28/5, 2014 at 12:9 Comment(1)
Because 1) libpcap/WinPcap filters (Wireshark capture filtering is done by libpcap/WinPcap) have limited capabilities and don't check for both VLAN-encapsulated and non-VLAN-encapsulated packets and 2) your network uses VLANs. Unfortunate, but that's the case.Regelate
T
-2

Other answers already cover how to filter by an address, but if you would like to exclude an address use

ip.addr < 192.168.0.11

Tuberculous answered 30/1, 2018 at 21:25 Comment(1)
ip.addr != 192.168.0.11 is the correct way.Sutter

© 2022 - 2024 — McMap. All rights reserved.