Home > Blockchain >  how to get all the incoming connections in linux
how to get all the incoming connections in linux

Time:01-30

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

CodePudding user response:

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 internet, but a command to get you started would be tcpdump -Qin ....

CodePudding user response:

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.

  • Related