Linux性能监控-netstat

netstat - 显示网络连接,路由表,接口状态,伪装连接,网络链路信息和组播成员组。

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 显示pid和程序名

-c, --continuous continuous listing

 

-l, --listening display listening server sockets 显示监听状态的socket

-a, --all, --listening display all sockets (default: connected) 显示所有socket(默认只显示连接的,不显示listen的)

-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)

[root@node0 ~]#

netstat解析

Active Internet connections,称为有源TCP连接

Active UNIX domain sockets,称为有源Unix域套接口(和网络套接字一样,但是只能用于本机通信,性能可以提高一倍)

netstat –rn 显示路由

结果同route -n

netstat –ie 显示网卡信息

结果同ifconfig

netstat –tulnp

显示所有tcp与udp连接,包括listen状态的连接,n不解析主机名,p显示pid和程序名

一般都用这个

原文地址:https://www.cnblogs.com/jeancheng/p/13055142.html