zoukankan      html  css  js  c++  java
  • netstat总结

    @http://www.cnblogs.com/ggjucheng/archive/2012/01/08/2316661.html

    命令: netstat -h 

    显示:

    usage: netstat [-veenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}
    netstat [-vnNcaeol] [<Socket> ...]
    netstat { [-veenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s } [delay]

    -r, --route display routing table
    -I, --interfaces=<Iface> display interface table for <Iface>
    -i, --interfaces display interface table
    -g, --groups display multicast group memberships
    -s, --statistics display networking statistics (like SNMP)
    -M, --masquerade display masqueraded connections

    -v, --verbose be verbose
    -n, --numeric don't resolve names
    --numeric-hosts don't resolve host names
    --numeric-ports don't resolve port names
    --numeric-users don't resolve user names
    -N, --symbolic resolve hardware names
    -e, --extend display other/more information
    -p, --programs display PID/Program name for sockets
    -c, --continuous continuous listing

    -l, --listening display listening server sockets
    -a, --all, --listening display all sockets (default: connected)
    -o, --timers display timers
    -F, --fib display Forwarding Information Base (default)
    -C, --cache display routing cache instead of FIB
    -T, --notrim stop trimming long addresses
    -Z, --context display SELinux security context for sockets

    <Iface>: Name of interface to monitor/list.
    <Socket>={-t|--tcp} {-u|--udp} {-S|--sctp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom
    <AF>=Use '-A <af>' or '--<af>'; default: inet
    List of possible address families (which support routing):
    inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25)
    netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)
    x25 (CCITT X.25)

    简介

    Netstat 命令用于显示各种网络相关信息,如网络连接,路由表,接口状态 (Interface Statistics),masquerade 连接,多播成员 (Multicast Memberships) 等等。

    输出信息含义

    执行netstat后,其输出结果为

    Active Internet connections (w/o servers)
    Proto Recv-Q Send-Q Local Address               Foreign Address             State
    tcp        0      0 vm-trade-001.ali.momo:51720 profile-onestore-a007.:8190 ESTABLISHED
    tcp        0      0 vm-trade-001.ali.momo:12554 profile-onestore-a007.:8290 ESTABLISHED
    tcp        0      0 vm-trade-001.ali.momo:27918 redis_node_6589.mom:bmc-grx ESTABLISHED
    tcp        0      0 vm-trade-001.ali.momo:57208 onestore-proxy-064.m6.:8390 ESTABLISHED
    tcp        0      0 vm-trade-001.ali.momo:36952 onestore-proxy-061.m6.:8190 ESTABLISHED
    tcp        0      0 vm-trade-001.ali.momo:49618 profile-onestore-a011.:8390 ESTABLISHED
    。。。。。。
    Active UNIX domain sockets (w/o servers)
    Proto RefCnt Flags       Type       State         I-Node Path
    unix  4      [ ]         DGRAM                    9009   /dev/log
    unix  2      [ ]         DGRAM                    7712   @/org/kernel/udev/udevd
    unix  3      [ ]         STREAM     CONNECTED     43396067
    unix  3      [ ]         STREAM     CONNECTED     43396066
    unix  3      [ ]         STREAM     CONNECTED     43396063 /dev/log
    。。。。。。

    netstat的输出结果可以分为两个部分:

    一个是Active Internet connections,称为有源TCP连接,其中"Recv-Q"和"Send-Q"指%0A的是接收队列和发送队列。这些数字一般都应该是0。如果不是则表示软件包正在队列中堆积。这种情况只能在非常少的情况见到。

    另一个是Active UNIX domain sockets,称为有源Unix域套接口(和网络套接字一样,但是只能用于本机通信,性能可以提高一倍)。
    Proto显示连接使用的协议,RefCnt表示连接到本套接口上的进程号,Types显示套接口的类型,State显示套接口当前的状态,Path表示连接到套接口的其它进程使用的路径名。

    常见参数

    -a (all)显示所有选项,默认不显示LISTEN相关
    -t (tcp)仅显示tcp相关选项
    -u (udp)仅显示udp相关选项
    -n 拒绝显示别名,能显示数字的全部转化成数字。
    -l 仅列出有在 Listen (监听) 的服務状态

    -p 显示建立相关链接的程序名
    -r 显示路由信息,路由表
    -e 显示扩展信息,例如uid等
    -s 按各个协议进行统计
    -c 每隔一个固定时间,执行该netstat命令。

    提示:LISTEN和LISTENING的状态只有用-a或者-l才能看到

  • 相关阅读:
    转载:configure生成的文件(1.5.3)《深入理解Nginx》(陶辉)
    现场管理
    02 表扫描
    01 成本的含义
    16 计划稳定性与控制
    14 事务处理
    13 SELECT 以外的内容
    12 索引
    11 半联结 & 反联结
    08 分析函数
  • 原文地址:https://www.cnblogs.com/Jaxlinda/p/7070464.html
Copyright © 2011-2022 走看看