This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

how to ignore traffic from more then one host.

0

I am trying to capture data but am getting a flood of data from a replicating server that i need to filter out. Basically i would like to filter out any traffic between 192.168.1.1 and 192.168.1.2 as well as ignore traffic that has a source address of 192.168.1.3 to either 192.168.1.1 and 192.168.1.2.

I have tried these captures and the only one that seems to work the way i need it is the first one:

tshark not host 192.168.1.1 and not host 192.168.1.2

When I have tried to filter out the src ip to the dst ip I noticed i was filtering all traffic:

tshark not src 192.168.1.3 and not dst 192.168.1.1

Also, how would I join the filters into one line?

tshark not host 192.168.1.1 and not host 192.168.1.2 and not src 192.168.1.3 and not dst 192.168.1.1

Any help would be appreciated.

asked 20 Jan '15, 14:34

dhorse's gravatar image

dhorse
5113
accept rate: 0%


One Answer:

1

From your post:

any traffic between 192.168.1.1 and 192.168.1.2

This would create a filter like:

host 192.168.1.1 and host 192.168.1.2

And:

a source address of 192.168.1.3 to either 192.168.1.1 and 192.168.1.2.

This would create a filter like:

src host 192.168.1.3 and (dst host 192.168.1.1 or 192.168.1.2)

Combined it makes:

(host 192.168.1.1 and host 192.168.1.2) or (src host 192.168.1.3 and (dst host 192.168.1.1 or 192.168.1.2))

And then you don't want to see this traffic, so it becomes:

not ( (host 192.168.1.1 and host 192.168.1.2) or (src host 192.168.1.3 and (dst host 192.168.1.1 or 192.168.1.2)) )

answered 21 Jan '15, 00:59

SYN-bit's gravatar image

SYN-bit ♦♦
17.1k957245
accept rate: 20%

Thanks for the quick reply, but when ever i try to add the parenthesis, I get a message saying, "-bash: syntax error near unexpected token `('"

(21 Jan '15, 12:13) dhorse

(I converted your "answer" to a "comment", please see the FAQ)

That is because the parenthesis are also used by bash, to make sure they are not interpreted by bash, you need to put the whole capture filter in quotes so that bash sees it as a string and passes the whole filter to tshark.

(21 Jan '15, 12:27) SYN-bit ♦♦

That works great, thanks for the help.

(21 Jan '15, 12:32) dhorse