I'm trying to capture only TCP SYN-ACK packets, i.e. with both SYN and ACK bits set with:
tcpdump -vvvni eth0 tcp[tcpflags] == tcp-syn and tcp[tcpflags] == tcp-ack
but it gives such error:
tcpdump: expression rejects all packets
I still can't figure out if there is a way to do it through the tcpdump
.
By the way, I tried to capture packets with just SYN flag set expecting there will be SYN-ACKs too (because there is no contradiction here), but there were only pure SYN packets (with only SYN bit set). So I need some way to see only SYN-ACKs, or SYNs and SYN-ACKs.
P.S. it is about regular TCP over IPv4.
tcpdump
is a packet sniffer too. I don't see any complexity about logical filtering packets by bits set in header.