netstat - Display network connections, routing tables, interface statistics, masquerade connections and netlink messages
netstat [-venaoc] [--tcp|-t] [--udp|-u] [--raw|-w] [--unix|-u] [--inet|--ip] [--ax25] [--ipx] [--netrom]
netstat [-veenc] [--inet] [--ipx] [--netrom] [--ddp] [--ax25] {--route|-r}
netstat [-veenac] {--interfaces|-i} [iface]
netstat [-enc] {--masquerade|-M}
netstat [-cn] {--netlink|-N}
netstat {-V|--version} {-h|--help}
Netstat displays information of the Linux networking subsystem.
You can view the status of network connections by listing the open sockets. This is the default operation: If you don't specify any address families, then the active sockets of all configured address families will be printed. With -e you get some additional informations (userid). With the -v switch you can make netstat complain about known address families which are not supported by the kernel. The -o option displays some additional information on networking timers. -a print all sockets, including the listening server sockets. The address family inet will display raw, udp and tcp sockets.
With the -r, --route option, you get the kernel routing tables in the same format as route -e use. netstat -er will use the output format of route. Please see route(8) for details.
If you use the -i, --interfaces option, a table of all (or the specified iface) networking interfaces will be printed. The output uses the ifconfig -e format, and is described in ifconfig(8) . netstat -ei will print a table or a single interface entry just like ifconfig does. With the -a switch, you can include interfaces which are not configured (i.e. don't have the U=UP flag set).
A list of all masqueraded sessions can be viewed, too. With the -e switch you can include some more informations about sequenze numbering and deltas, caused by data rewrites on FTP sessions (PORT command). Masquerade support is used to hide hosts with unofficial network addresses from the outside world, as described in ipfw(4) ,ipfwadm(8) and ipfw(8) .
Recent kernels have a kernel/user communication support called netlink. You can get messages about creation or deletion of interfaces or routes from /dev/route (36,0).
Tell the user what is going on by being verbose. Especially print some usefull informations about unconfigured address families.
shows numerical addresses instead of trying to determine symbolic host, port or user names.
use a different method to set the address families. fam_ily is a comma (',') seperated list of address family keywords like inet, unix, ipx, ax25, netrom and ddp. This is has the same effect as using the long options --inet, --unix, --ipx, --ax25, --netrom and --ddp.
This will cause netstat to print the selected table every second continously on the screen until you interrupt it.
Proto
The protocol (tcp, udp, raw) used by the socket.
The count of bytes not copied by the user program connected to this socket.
The count of bytes not acknoledged by the remote host.
The local address (local hostname) and port number of the socket. Unless the -n switch is given, the socket address is resolved to its canonical hostname, and the port number is translated into the corresponding service name.
The remote address (remote hostname) and port number of he socket. As with the local address:port, the -n switch turns off hostname and service name resolution.
The state of the socket. Since there are no states in RAW and usually no states used in UDP, this row may be left blank. Normally this can be one of several values:
CLOSED The socket is not being used.
LISTEN The socket is listening for incoming connections. Those sockets are only displayed if the -a,--listening switch is set.
The name or the UID of the owner of the socket.
(this needs to be written)
Proto
The protocol (usually unix) used by the socket.
The reference count (i.e. attached processes via this socket).
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 processes are waiting for a connect request. The other flags are not of normal interest.
There are several types of socket access:
This field will contain one of the following Keywords:
(empty)
The socket is not connected to another one.
This displays the path name as which the corresponding processes attached to the socket.
(this needs to be done by somebody who knows it)
(this needs to be done by somebody who knows it)
(this needs to be done by somebody who knows it)
/etc/services -- The services translation file
/proc/net/dev -- devices information
/proc/net/raw -- RAW socket information
/proc/net/tcp -- TCP socket information
/proc/net/udp -- UDP socket information
/proc/net/unix -- Unix domain socket information
/proc/net/ipx -- IPX socket information
/proc/net/ax25 -- AX25 socket information
/proc/net/appeltalk -- DDP (appeltalk) socket information
/proc/net/nr -- NET/ROM socket information
/proc/net/route -- Kernel IP routing information
/proc/net/ax25_route -- Kernel AX25 routing information
/proc/net/ipx_route -- Kernel IPX routing information
/proc/net/nr_nodes -- Kernel NET/ROM nodelist
/proc/net/nr_neigh -- Kernel NET/ROM neighbours
/proc/net/ip_masquerade -- Kernel masqueraded connections
route(8) , ifconfig(8) , ipfw(4) , ipfw(8) , ipfwadm(8)
Occasionally strange information may appear if a socket changes as it is viewed. This is unlikely to occur. The netstat -i options is described as it should work after some code cleanup of the BETA release of the nettools package.
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.
The man page and the command included in the net-tools
package is totally rewritten from Bernd Eckenfels
<ecki@linux.de>.