现在的位置: 首页 > 综合 > 正文

man netstat(8) (中文翻译缩略版)

2014年02月26日 ⁄ 综合 ⁄ 共 5746字 ⁄ 字号 评论关闭
文章目录
 

netstat(8) - Linux man page(中文翻译)

 

名称

netstat - 输出网络连接, 路由表, 接口统计数据, 伪连接,及多播成员

 

大纲

netstat [address_family_options] [--tcp|-t] [--udp|-u] [--raw|-w] [--listening|-l] [--all|-a] [--numeric|-n] [--numeric-hosts][--numeric-ports][--numeric-ports] [--symbolic|-N] [--extend|-e[--extend|-e]] [--timers|-o] [--program|-p] [--verbose|-v] [--continuous|-c] [delay]

netstat {--route|-r} [address_family_options] [--extend|-e[--extend|-e]] [--verbose|-v] [--numeric|-n] [--numeric-hosts][--numeric-ports][--numeric-ports] [--continuous|-c] [delay]

netstat {--interfaces|-i} [iface] [--all|-a] [--extend|-e[--extend|-e]] [--verbose|-v] [--program|-p] [--numeric|-n] [--numeric-hosts][--numeric-ports][--numeric-ports] [--continuous|-c] [delay]

netstat {--groups|-g} [--numeric|-n] [--numeric-hosts][--numeric-ports][--numeric-ports] [--continuous|-c] [delay]

netstat {--masquerade|-M} [--extend|-e] [--numeric|-n] [--numeric-hosts][--numeric-ports][--numeric-ports] [--continuous|-c] [delay]

netstat {--statistics|-s} [--tcp|-t] [--udp|-u] [--raw|-w] [delay]

netstat {--version|-V}

netstat {--help|-h}

address_family_options:

[--protocol={inet,unix,ipx,ax25,netrom,ddp}[,...]] [--unix|-x] [--inet|--ip] [--ax25] [--ipx] [--netrom] [--ddp]

 

描述

Netstat 命令输出linux网络子系统的信息。 输出的信息类型由其后的第一个参数决定,如下:

(none)

默认情况下,该命令显示系统打开的socket列表。如果没有给定特定的地址族,那么所有被配置的地址族的活动socket信息会被全部打印出来。

--route , -r

显示内核路由表。 

--groups , -g

显示IPV4及IPV6的多播组成员信息。 

--interface=iface , -i

显示网络接口表或者某个特定的接口信息。 

--masquerade , -M

显示伪连接列表。 

--statistics , -s

显示每个协议的概要统计数据。 

 

选项

--verbose , -v

输出尽可能多的信息,其中包括一些未被配置的地址族信息。

--numeric , -n

输出数字化的IP地址,而非主机名或用户名。 

--numeric-hosts

输出数字化的主机地址,而不影响端口名和用户名的解析。 

--numeric-ports

输出数字化的端口号,而不影响主机名和用户名的解析。.

--numeric-users

输出数字化的用户ID,而不影响主机名和端口名的解析。 

--protocol=family , -A

指定将要输出的地址族。 家族用逗号隔开,例如: inet, unix, ipx, ax25, netrom, ddp。 

这和适用以下这种指定家族的方式相同: --inet, --unix (-x), --ipx, --ax25, --netrom, and --ddp options.

inet 家族包括 raw, udp 和 tcp 协议 sockets.

-c, --continuous

这会使得该命令持续输出网络状态,每隔一小段时间就重新输出。

-e, --extend

显示额外信息,连用两个可以显示最多的信息。 

-o, --timers

包含网络计时器相关的信息。 

-p, --program

显示 socket 所归属的 PID 以及程序名。

-l, --listening

只显示处于监听状态的socket。 

-a, --all

显示所有处于监听或非监听状态的socket。 在用 --interfaces 指定端口的情况下, 同样会显示非指定的端口信息。

-f

从 FIB 打印路由信息。 

-c

从路由缓冲区打印路由信息。

-Z --context

如果 SELinux 允许输出 SELinux 上下文。

-T --notrim

停止整理长地址。 

delay

该命令会每隔 delay 长的时间循环打印所有数据。 

输出

活动的网络连接 (TCP, UDP, raw)

Proto

socket 所适用的协议 (tcp, udp, raw)  。

Recv-Q

未被连接到 socket 的用户程序所复制的字节数。

Send-Q

未被远程主机确认的字节数。 

Local Address

socket 本地端的地址及端口号。除非 --numeric (-n)  选项被指定, 否则 socket 地址会被解析成其权威的主机名 (FQDN), 同时端口号被翻译成通信服务名。

Foreign Address

socket 远程端的地址及端口号。相对于本地地址而言的。

State

socket 的状态。由于在 raw 模式下无状态,同时在 udp 模式下一般也无状态, 所以该栏在大多情况下都是空白的。通常状态值可以为以下几种:

ESTABLISHED
socket 拥有已建立的连接。 
SYN_SENT
socket 正在尝试建立连接。 
SYN_RECV
已从网络获得一个连接请求。 
FIN_WAIT1
socket 被关闭, 连接被停止。 
FIN_WAIT2
连接被关闭, socket 在等待远端关闭。
TIME_WAIT
socket 被关闭后仍在等待, 以处理仍然存在在网络中的包。 
CLOSED
socket 未被使用。 
CLOSE_WAIT
远端已关闭, 在等待 socket 的关闭。 
LAST_ACK
远端及 socket 都已关闭, 等待最后的确认。 
LISTEN
socket 正在监听传入的连接。这些 socket 不会被输出, 除非使用了 -l 或 -a 选项。 
CLOSING
两端的 socket 都已关闭, 但是仍未将本端数据传输完毕。
UNKNOWN
socket 状态未知。

User

socket 拥有者的用户名或用户ID。 

PID/Program name

拥有 socket 的进程的进程ID及进程名, 用斜杠分割。 --program 使得这一栏被包含进来。你需要超级用户的权限才可以看到非你所拥有的进程的 socket 信息。IPX socket 无此项。 

Timer

(this needs to be written)

活动的Unix域名Socket

Proto

socket 使用的协议。

RefCnt

引用计数。

Flags

显示的标志是:SO_ACCEPTON (displayed as ACC), SO_WAITDATA (W) 或者 SO_NOSPACE (N). SO_ACCECPTON 用于正等待连接请求的未连接 socket。

Type

下列几种 socket 使用权: 

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

这个域会包括以下几种之一的关键词: 

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

开启 socket 的PID和进程名。更多的信息在 Active Internet connections 部分。

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)

Notes

Starting with Linux release 2.2 netstat -i does not show interface statistics for alias interfaces. To get per alias interface counters you need to setup explicit rules using the ipchains(8) command.

Files

/etc/services -- The services translation

file

/proc -- Mount point for the proc filesystem, which gives access to kernel status information via the following files.

/proc/net/dev -- device

information

/proc/net/raw -- raw socket information

/proc/net/tcp -- TCP

socket information

/proc/net/udp -- UDP socket information

/proc/net/igmp -- IGMP multicast information

/proc/net/unix -- Unix domain socket information

/proc/net/ipx -- IPX socket information

/proc/net/ax25 -- AX25 socket information

/proc/net/appletalk -- DDP (appletalk) socket information

/proc/net/nr -- NET/ROM socket information

/proc/net/route -- IP routing information

/proc/net/ax25_route -- AX25 routing information

/proc/net/ipx_route -- IPX routing information

/proc/net/nr_nodes -- NET/ROM nodelist

/proc/net/nr_neigh -- NET/ROM neighbours

/proc/net/ip_masquerade -- masqueraded connections

/proc/net/snmp -- statistics

See Also

route(8), ifconfig(8), ipchains(8), iptables(8), proc(5)

Bugs

Occasionally strange information may appear if a socket changes as it is viewed. This is unlikely to occur.

Authors

The netstat user interface was written by Fred Baumgarten <dc6iq@insu1.etec.uni-karlsruhe.de> the man page basically by Matt Welsh <mdw@tc.cornell.edu>. It was updated by Alan Cox <Alan.Cox@linux.org> but could do with a bit more work. It was updated again by Tuan Hoang <tqhoang@bigfoot.com>.
The man page and the command included in the net-tools package is totally rewritten by Bernd Eckenfels <ecki@linux.de>.

Referenced By

arp(8), icmp(7), ifinfo(8), inndstart(8), ipsec_look(8), netmask(1), socklist(8), traceroute(8)

抱歉!评论已关闭.