6

I have the following tcpdump -i eth0 -n tcp port 5000 to filter every packet flowing between 2 hosts. However, one of the hosts always sends an ACK.

How do I hide this ACK?

1
  • 3
    Do you mean a TCP packet with the "ACK" TCP flag set or an ACK in another protocol on top of TCP? Note that many TCP packets usually have the ACK flag set. Do you mean packets with only that flag and no data? Commented May 20, 2014 at 19:55

3 Answers 3

6

tcpdump -i eth0 -n 'tcp port 5000 and (tcp[tcpflags] & tcp-ack == 0)' should do what you want. It does bitwise and between TCP flags and ACK-only bitmask, so if there's no ACK, the result should equal to zero.

1
  • ACK is just a flag in a packet, one of many. By blindly skipping packets with the ACK bit set, you can lose data because a packet can carry data and have the ACK bit set. Commented Apr 25, 2016 at 8:46
2

you can hide it by piping the command to grep:

tcpdump -i eth0 -n tcp port 5000 | grep -e ACK -v -e option is to select a pattern (ACK in your case) -v (to invert the grep function : grep all except the defined pattern) 
2
  • 1
    I don't want to grep them. I want to filter them. Commented May 20, 2014 at 20:00
  • It won't work because packets often takes more than one line — i.e. when one using an option of tcpdump to print the content. Commented May 28, 2015 at 14:57
2

I copied this straight from man tcpdump filters example:

To print all IPv4 HTTP packets to and from port 80, i.e. print only packets that contain data, not, for example, SYN and FIN packets and ACK-only packets. (IPv6 is left as an exercise for the reader.)

tcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.