netstat

1、

netstat -ano

netstat -a    ZC: 有时,不带参数 看的更简洁一点

  1.1、 Active Internet connections 的 UDP 信息

    netstat -au

    netstat -anu

  1.2、Active Internet connections 的 TCP 信息

    netstat -at

    netstat -ant

 

2、参数:

  参考网址:http://www.cnblogs.com/peida/archive/2013/03/08/2949194.html

       http://man.linuxde.net/netstat

-a或--all:显示所有连线中的Socket;
-A<网络类型>或--<网络类型>:列出该网络类型连线中的相关地址;
-c或--continuous:持续列出网络状态;
-C或--cache:显示路由器配置的快取信息;
-e或--extend:显示网络其他相关信息;
-F或--fib:显示FIB;
-g或--groups:显示多重广播功能群组组员名单;
-h或--help:在线帮助;
-i或--interfaces:显示网络界面信息表单;
-l或--listening:显示监控中的服务器的Socket;
-M或--masquerade:显示伪装的网络连线;
-n或--numeric:直接使用ip地址,而不通过域名服务器;
-N或--netlink或--symbolic:显示网络硬件外围设备的符号连接名称;
-o或--timers:显示计时器;
-p或--programs:显示正在使用Socket的程序识别码和程序名称;
-r或--route:显示Routing Table;
-s或--statistice:显示网络工作信息统计表;
-t或--tcp:显示TCP传输协议的连线状况;
-u或--udp:显示UDP传输协议的连线状况;
-v或--verbose:显示指令执行过程;
-V或--version:显示版本信息;
-w或--raw:显示RAW传输协议的连线状况;
-x或--unix:此参数的效果和指定"-A unix"参数相同;
--ip或--inet:此参数的效果和指定"-A inet"参数相同。

 

 

3、

“Active UNIX domain sockets” 就是 由 的教程 说的 域套接字

 

4、http://bbs.chinaunix.net/thread-4159374-1-1.html

Recv-Q Send-Q分别表示网络接收队列,发送队列。Q是Queue的缩写。

这两个值通常应该为0,如果不为0可能是有问题的。packets在两个队列里都不应该有堆积状态。可接受短暂的非0情况。如文中的示例,短暂的Send-Q队列发送pakets非0是正常状态。
如果接收队列Recv-Q一直处于阻塞状态,可能是遭受了拒绝服务 denial-of-service 攻击。
如果发送队列Send-Q不能很快的清零,可能是有应用向外发送数据包过快,或者是对方接收数据包不够快。

Recv-Q:表示收到的数据已经在本地接收缓冲,但是还有多少没有被进程取走,recv()
Send-Q:对方没有收到的数据或者说没有Ack的,还是本地缓冲区.

通过netstat的这两个值就可以简单判断程序收不到包到底是包没到还是包没有被进程recv。

 

5、命令行输入 "man netstat",可以看到 关于 “Active UNIX domain Sockets”列出的信息的每一列的含义的解释为:

Active UNIX domain Sockets
   Proto
       The protocol (usually unix) used by the socket.
   RefCnt
       The reference count (i.e. attached processes via this socket).
   Flags
       The flags displayed is SO_ACCEPTON (displayed as ACC), SO_WAITDATA (W) or SO_NOSPACE (N).  SO_ACCECPTON is used on unconnected sockets if their  corresponding  pro-
       cesses are waiting for a connect request. The other flags are not of normal interest.
   Type
       There are several types of socket access:

       SOCK_DGRAM
              The socket is used in Datagram (connectionless) mode.
       SOCK_STREAM
              This is a stream (connection) socket.
       SOCK_RAW
              The socket is used as a raw socket.
       SOCK_RDM
              This one serves reliably-delivered messages.
       SOCK_SEQPACKET
              This is a sequential packet socket.
       SOCK_PACKET
              Raw interface access socket.
       UNKNOWN
              Who ever knows what the future will bring us - just fill in here :-)

   State
       This field will contain one of the following Keywords:

       FREE
              The socket is not allocated
       LISTENING
              The socket is listening for a connection request.  Such sockets are only included in the output if you specify the --listening (-l) or --all (-a) option.
       CONNECTING
              The socket is about to establish a connection.
       CONNECTED
              The socket is connected.
       DISCONNECTING
              The socket is disconnecting.
       (empty)
              The socket is not connected to another one.
       UNKNOWN
              This state should never happen.

   PID/Program name
       Process ID (PID) and process name of the process that has the socket open.  More info available in Active Internet connections section written above.
   Path
       This is the path name as which the corresponding processes attached to the socket.
   Active IPX sockets
       (this needs to be done by somebody who knows it)
   Active NET/ROM sockets
       (this needs to be done by somebody who knows it)
   Active AX.25 sockets
       (this needs to be done by somebody who knows it)

 

6、

7、

8、

 

posted @ 2016-08-25 16:44  OsSkill  阅读(220)  评论(0编辑  收藏  举报