netstat.8
来自「Linux下网络相关工具源代码。」· 8 代码 · 共 500 行
8
500 行
.\".\" netstat.8 .\".\" Original: (mdw@tc.cornell.edu & dc6iq@insu1.etec.uni-karlsruhe.de).\".\" Modified: Bernd.Eckenfels@inka.de.\" Modified: Andi Kleen ak@muc.de .\" Modified: Tuan Hoang tqhoang@bigfoot.com .\".\".TH NETSTAT 8 "20 April 1999" "net-tools" "Linux Programmer's Manual".SH NAMEnetstat \- Display network connections, routing tables, interface statistics, masquerade connections, netlink messages, and multicast memberships.SH SYNOPSIS.B netstat .RB [ \-venaoc ].RB [ \-\-tcp | \-t ].RB [ \-\-udp | \-u ].RB [ \-\-raw | \-w ].RB [ \-\-groups | \-g ].RB [ \-\-unix | \-x ] .RB [ \-\-inet | \-\-ip ].RB [ \-\-ax25 ].RB [ \-\-ipx ] .RB [ \-\-netrom ].PP.B netstat .RB [ \-veenc ].RB [ \-\-inet ] .RB [ \-\-ipx ].RB [ \-\-netrom ] .RB [ \-\-ddp ].RB [ \-\-ax25 ].RB { \-\-route | \-r }.PP.B netstat.RB [ \-veenpac ].RB { \-\-interfaces | \-i }.RI [ iface ].PP.B netstat.RB [ \-enc ].RB { \-\-masquerade | \-M }.PP.B netstat .RB [ \-cn ].RB { \-\-netlink | \-N }.PP.B netstat .RB { \-V | \-\-version }.RB { \-h | \-\-help }.PP.SH DESCRIPTION.B Netstatdisplays information of the Linux networking subsystem..SS "(no option)"You can view thestatus of network connections by listing the open sockets. This is thedefault operation: If you don't specify any address families, then theactive sockets of all configured address families will be printed. With.B -eyou get some additional informations (userid). With the.B -vswitch you can make netstat complain about known address families which arenot supported by the kernel. The.B -ooption displays some additional information on networking timers. Enabling the.B -pwill show you the process PID and name of the program holding the socket..B -aprint all sockets, including the listening server sockets. The addressfamily.B inetwill display raw, udp and tcp sockets..SS "\-r, \-\-route"With the.BR \-r ", " \-\-routeoption, you get the kernel routing tables in the same format as.B "route -e" use..B "netstat -er" will use the output format of.BR route .Please see.BR route (8)for details..SS "\-g, \-\-groups"With the.BR \-g ", " \-\-groups option, IGMP multicast group membership information for IPv4 and IPv6 is displayed..SS "\-i, \-\-interface \fIiface\fI"If you use the.BR -i ", " --interfacesoption, a table of all (or the specified .IR iface ) networking interfaces will be printed. The output uses the.B "ifconfig -e"format, and is described in.BR ifconfig (8)..B "netstat -ei" will print a table or a single interface entry just like.B ifconfigdoes. With the.B -aswitch, you can include interfaces which are not configured (i.e. don't havethe .BR U = UPflag set)..SS "\-M, \-\-masquerade"A list of all masqueraded sessions can be viewed, too. With the.B -e switch you can include some more informations about sequenze numbering anddeltas, caused by data rewrites on FTP sessions (PORTcommand). Masquerade support is used to hide hosts with unofficial networkaddresses from the outside world, as described in.BR ipfw (4), ipfwadm "(8) and " ipfw (8)..SS "\-N, \-\-netlink"Recent kernels have a kernel/user communication support called netlink. Youcan get messages about creation or deletion of interfaces or routes from.I /dev/route(36,0)..PP.SH OPTIONS.SS "\-v, \-\-verbose"Tell the user what is going on by being verbose. Especially print someusefull informations about unconfigured address families..SS "\-n, \-\-numeric"shows numerical addresses instead of trying to determine symbolic host, portor user names..SS "\-p, \-\-programs"displays process name and PID of the owner of each socket it dumps. Youhave to be the owner of such process to have all it's sockets matched to itor generally.B rootuser will see all the necessary information in place..SS "\-A, \-\-af \fIfamily\fI"use a different method to set the address families..I family is a comma (',') seperated list of address family keywords like.BR inet , .BR unix , .BR ipx , .BR ax25 , .B netrom and.BR ddp .This is has the same effect as using the long options.BR \-\-inet ,.BR \-\-unix ,.BR \-\-ipx ,.BR \-\-ax25 ,.B \-\-netromand.BR \-\-ddp..SS "\-c, \-\-continous"This will cause.B netstatto print the selected table every second continously on the screen until youinterrupt it..PP.SH OUTPUT.PP.SS Active Internet connections \fR(TCP, UDP, RAW)\fR.SS "Proto" The protocol (tcp, udp, raw) used by the socket. .SS "Recv-Q"The count of bytes not copied by the user program connected to this socket..SS "Send-Q"The count of bytes not acknoledged by the remote host..SS "Local Address" The local address (local hostname) and port number of the socket. Unlessthe.B -nswitch is given, the socket address is resolved to its canonicalhostname, and the port number is translated into the corresponding servicename. .SS "Foreign Address"The remote address (remote hostname) and port number of he socket. Aswith the local address:port, the.B -nswitch turns off hostname and service name resolution..SS "State"The state of the socket. Since there are no states in RAW and usually nostates used in UDP, this row may be left blank. Normally this can be oneof several values:.TP.IESTABLISHEDThe socket has an established connection..TP.ISYN_SENTThe socket is actively attempting to establish a connection..TP.ISYN_RECVA connection request has been received from the network..TP.IFIN_WAIT1The socket is closed, and the connection is shutting down..TP.IFIN_WAIT2Connection is closed, and the socket is waiting for a shutdown from theremote end..TP.ITIME_WAITThe socket is waiting after close to handle packets still in the network..TP.ICLOSEDThe socket is not being used..TP.ICLOSE_WAITThe remote end has shut down, waiting for the socket to close..TP.ILAST_ACKThe remote end shut down, and the socket is closed. Waiting foracknowledgement..TP.ILISTENThe socket is listening for incoming connections. Those sockets are onlydisplayed if the.BR -a , --listeningswitch is set..TP.ICLOSINGBoth sockets are shut down but we still don't have all our datasent..TP.IUNKNOWNThe state of the socket is unknown..SS "User"The name or the UID of the owner of the socket..SS "PID/Program name"Slash-separated pair of the PID and process name of the program holdingthis socket. Option.B -penables display of this column. You will also need.B rootprivileges as you have to have access rights to process to be able to seethe program's sockets matched up to it. This identification informationis not yet available for IPX sockets..SS "Timer"(this needs to be written).PP.SS Active UNIX domain Sockets.SS "Proto" The protocol (usually unix) used by the socket..SS "RefCnt"The reference count (i.e. attached processes via this socket)..SS "Flags"The flags displayed is SO_ACCEPTON (displayed as .BR ACC ),SO_WAITDATA .RB ( W )or SO_NOSPACE .RB ( N ). SO_ACCECPTON is used on unconnected sockets if their correspondingprocesses are waiting for a connect request. The other flags are notof normal interest..SS "Type"There are several types of socket access:.TP.ISOCK_DGRAMThe socket is used in Datagram (connectionless) mode..TP.ISOCK_STREAMThis is a stream (connection) socket..TP.ISOCK_RAWThe socket is used as a raw socket..TP.ISOCK_RDMThis one serves reliably-delivered messages..TP.ISOCK_SEQPACKETThis is a sequential packet socket..TP.ISOCK_PACKETRAW interface access socket..TP.IUNKNOWNWho ever knows, what the future will bring us - just fill in here :-).PP.SS "State"This field will contain one of the following Keywords:.TP.IFREEThe socket is not allocated.TP.ILISTENINGThe socket is listening for a connection request. Those sockets are onlydisplayed if the.BR -a , --listeningswitch is set..TP.ICONNECTINGThe socket is about to establish a connection..TP.ICONNECTEDThe socket is connected..TP.IDISCONNECTINGThe socket is disconnecting..TP.I(empty)The socket is not connected to another one..TP.IUNKNOWNThis state should never happen..SS "PID/Program name"PID and process name of the program holding this socket. More info available in.B "Active Internet connections"section written above..SS "Path"This displays the path name as which the corresponding processes attachedto the socket..PP.SS Active IPX sockets(this needs to be done by somebody who knows it).PP.SS Active NET/ROM sockets(this needs to be done by somebody who knows it).PP.SS Active AX.25 sockets(this needs to be done by somebody who knows it).PP.SH NOTESSince kernel release 2.2 netstat -i does not display interface statistics foralias interfaces anymore. To get per alias interface counters you need tosetup explicit rules using the .BR ipchains(8) command. .SH FILES.ta.I /etc/services-- The services translation file.I /proc/net/dev-- devices information.I /proc/net/raw-- RAW socket information.I /proc/net/tcp-- TCP socket information.I /proc/net/udp-- UDP socket information.I /proc/net/igmp-- IGMP multicast information.I /proc/net/unix-- Unix domain socket information.I /proc/net/ipx-- IPX socket information.I /proc/net/ax25-- AX25 socket information.I /proc/net/appletalk-- DDP (appletalk) socket information.I /proc/net/nr-- NET/ROM socket information.I /proc/net/route-- Kernel IP routing information.I /proc/net/ax25_route-- Kernel AX25 routing information.I /proc/net/ipx_route-- Kernel IPX routing information.I /proc/net/nr_nodes-- Kernel NET/ROM nodelist.I /proc/net/nr_neigh-- Kernel NET/ROM neighbours.I /proc/net/ip_masquerade-- Kernel masqueraded connections.fi.PP.SH SEE ALSO.BR route (8), .BR ifconfig (8), .BR ipfw (4), .BR ipfw (8), .BR ipfwadm (8).BR ipchains (8).PP.SH BUGSOccasionally strange information may appear if a socket changesas it is viewed. This is unlikely to occur..brThe.B netstat -ioptions is described as it should work after some code cleanup of the BETArelease of the net-tools package..PP.SH AUTHORSThe netstat user interface was written by Fred Baumgarten<dc6iq@insu1.etec.uni-karlsruhe.de> the man page basicallyby Matt Welsh <mdw@tc.cornell.edu>. It was updated byAlan Cox <Alan.Cox@linux.org> but could do with a bit morework. It was updated again by Tuan Hoang<tqhoang@bigfoot.com>..brThe man page and the command included in the net-toolspackage is totally rewritten from Bernd Eckenfels <ecki@linux.de>.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?