简体   繁体   English

如何获取 linux 中的所有传入连接

[英]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.

相关问题 如何在Linux中获取所有TCP连接的min / avg / var rtt? - How do I get min/avg/var rtt for all TCP connections in Linux? 使用Python列出Linux中的所有传入连接 - Using Python to list all incoming connection in Linux Linux SIP客户端仅用于获取传入号码 - Linux SIP Client just to get incoming number 如何在Linux中接收传入的SMS通知? - How to receive incoming SMS notification in linux? Linux:如何模拟接口上的传入数据包? - Linux: How to simulate incoming packets on an interface? LINUX:如何限制传入(并发)连接数? - LINUX : How to LIMIT incoming (concurrent) connection COUNT? 如何将套接字文件描述符放在缓冲区中并继续接受传入的连接? - How to put socket file descriptor in a buffer and continue accepting incoming connections? 如何知道Linux上的Node子进程正在使用的所有资源,连接,套接字等 - How to know all the resources, connections, sockets, etc. in use by a Node child-process on Linux 将所有传入的qmail / vpopmail电子邮件转发到Linux上的程序 - forward all incoming qmail / vpopmail emails to a program on linux 使用 eBPF 拦截 Linux 上的所有传出/传入流量 - Intercept all outgoing/incoming traffic on Linux using eBPF
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM