简体   繁体   中英

how to get all the incoming connections in linux

netstat lists all the connections (incoming and outgoing) how do I filter out just the incoming connections

I have tried the.netstat command but it lists all the connections but j need only the incoming connections

Once sockets are created, there isn't really such thing as inbound and outbound, as connections go both ways. What you really care about are connections you started, vs connections others started. To do that, you have to monitor for new connections, and log them as they are created.

tcpdump is a great tool for this. There are tons of guides on the inte.net, but a command to get you started would be tcpdump -Qin... .

With.netstat you may identify the state of the socket but in many casesthere are no states in raw mode and usually no states used in UDP and UDPLite. You may try display listening state for incoming connections running.netstat with the following argument:

netstat --listening

As far I understood from you question it is better to use tcpdump tool as mentioned in other comments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM