[英]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 netstat 列出所有连接(传入和传出)如何过滤掉传入连接
I have tried the.netstat command but it lists all the connections but j need only the incoming connections我试过 .netstat 命令,但它列出了所有连接,但 j 只需要传入连接
Once sockets are created, there isn't really such thing as inbound and outbound, as connections go both ways.创建 sockets 后,实际上并没有入站和出站之类的东西,因为双向连接 go。 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. tcpdump
是一个很好的工具。 There are tons of guides on the inte.net, but a command to get you started would be tcpdump -Qin...
. inte.net 上有大量指南,但让您入门的命令是
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.使用 .netstat,您可以识别套接字的 state,但在许多情况下,在原始模式下没有任何状态,并且通常没有在 UDP 和 UDPLite 中使用的状态。 You may try display listening state for incoming connections running.netstat with the following argument:
您可以尝试使用以下参数显示监听 state 传入连接 running.netstat:
netstat --listening
As far I understood from you question it is better to use tcpdump tool as mentioned in other comments.据我从你的问题中了解到,最好使用其他评论中提到的 tcpdump 工具。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.