I would like to view TCP
requests (syn packets) initiated by my PC/server to other hosts. More specifically, I would like to view the outgoing connection requests
. How can I accomplish this?
Also, I don't want to see any connection attempts that are coming to my PC/server.
The following iptables
command works but it's clunky to use as it logs everything while I just want to see everything on the screen:
iptables -I OUTPUT 1 -o eth0 -p tcp -m state --state NEW -j LOG
Best Answer
If you want to see outgoing TCP connections originating from your host you can use the switch
src host <ip>
as an argument totcpdump
:Example
Simulated outgoing traffic:
Watching with
tcpdump
:Filtering on syn packets
To capture just the outgoing syn packets you'll need to analyze the tcpflags, specifically looking for the
tcp-syn
flag. Again using the samecurl
command from above, but now invokingtcpdump
like so:tcpflags
From thetcpdump
man page:References