JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 1M: System Administration Commands     Oracle Solaris 10 1/13 Information Library
search filter icon
search icon

Document Information

Preface

Introduction

System Administration Commands - Part 1

System Administration Commands - Part 2

metahs(1M)

metaimport(1M)

metainit(1M)

metaoffline(1M)

metaonline(1M)

metaparam(1M)

metarecover(1M)

metarename(1M)

metareplace(1M)

metaroot(1M)

metaset(1M)

metassist(1M)

metastat(1M)

metasync(1M)

metattach(1M)

mib2c(1M)

mib2mof(1M)

mibiisa(1M)

mipagent(1M)

mipagentconfig(1M)

mipagentstat(1M)

mkbootmedia(1M)

mkdevalloc(1M)

mkdevmaps(1M)

mkfifo(1M)

mkfile(1M)

mkfs(1M)

mkfs_pcfs(1M)

mkfs_udfs(1M)

mkfs_ufs(1M)

mknod(1M)

mkpwdict(1M)

modinfo(1M)

modload(1M)

modunload(1M)

mofcomp(1M)

mofreg(1M)

monacct(1M)

monitor(1M)

mount(1M)

mountall(1M)

mount_cachefs(1M)

mountd(1M)

mount_hsfs(1M)

mount_nfs(1M)

mount_pcfs(1M)

mount_tmpfs(1M)

mount_udfs(1M)

mount_ufs(1M)

mount_xmemfs(1M)

mpathadm(1M)

mpstat(1M)

msgid(1M)

mvdir(1M)

named(1M)

named-checkconf(1M)

named-checkzone(1M)

named-compilezone(1M)

ncaconfd(1M)

ncheck(1M)

ncheck_ufs(1M)

ndd(1M)

netservices(1M)

netstat(1M)

netstrategy(1M)

newaliases(1M)

newfs(1M)

newkey(1M)

nfs4cbd(1M)

nfsd(1M)

nfslogd(1M)

nfsmapid(1M)

nfsstat(1M)

nisaddcred(1M)

nisaddent(1M)

nisauthconf(1M)

nisbackup(1M)

nis_cachemgr(1M)

nisclient(1M)

nisd(1M)

nisd_resolv(1M)

nisinit(1M)

nisldapmaptest(1M)

nislog(1M)

nispasswdd(1M)

nisping(1M)

nispopulate(1M)

nisprefadm(1M)

nisrestore(1M)

nisserver(1M)

nissetup(1M)

nisshowcache(1M)

nisstat(1M)

nisupdkeys(1M)

nlsadmin(1M)

nscd(1M)

nslookup(1M)

nsupdate(1M)

ntpdate(1M)

ntpq(1M)

ntptrace(1M)

nulladm(1M)

obpsym(1M)

ocfserv(1M)

oplhpd(1M)

parse_dynamic_clustertoc(1M)

passmgmt(1M)

patchadd(1M)

patchrm(1M)

pbind(1M)

pcitool(1M)

pcmciad(1M)

pfinstall(1M)

pginfo(1M)

pgstat(1M)

pgxconfig(1M)

picld(1M)

ping(1M)

pkg2du(1M)

pkgadd(1M)

pkgadm(1M)

pkgask(1M)

pkgchk(1M)

pkgcond(1M)

pkgdep(1M)

pkgrm(1M)

plockstat(1M)

pmadm(1M)

pmconfig(1M)

pntadm(1M)

pooladm(1M)

poolbind(1M)

poolcfg(1M)

poold(1M)

poolstat(1M)

ports(1M)

powerd(1M)

poweroff(1M)

ppdmgr(1M)

pppd(1M)

pppoec(1M)

pppoed(1M)

pppstats(1M)

pprosetup(1M)

pprosvc(1M)

praudit(1M)

prctmp(1M)

prdaily(1M)

printmgr(1M)

privatepw(1M)

prodreg(1M)

projadd(1M)

projdel(1M)

projmod(1M)

prstat(1M)

prtacct(1M)

prtconf(1M)

prtdiag(1M)

prtdscp(1M)

prtfru(1M)

prtpicl(1M)

prtvtoc(1M)

psradm(1M)

psrinfo(1M)

psrset(1M)

putdev(1M)

putdgrp(1M)

pwck(1M)

pwconv(1M)

quot(1M)

quota(1M)

quotacheck(1M)

quotaoff(1M)

quotaon(1M)

raidctl(1M)

ramdiskadm(1M)

rarpd(1M)

rcapadm(1M)

rcapd(1M)

rctladm(1M)

rdate(1M)

rdisc(1M)

reboot(1M)

regadm(1M)

reject(1M)

rem_drv(1M)

remove_allocatable(1M)

removef(1M)

repquota(1M)

re-preinstall(1M)

restricted_shell(1M)

rexd(1M)

rexecd(1M)

rlogind(1M)

rm_install_client(1M)

rmmount(1M)

rmt(1M)

rndc(1M)

rndc-confgen(1M)

roleadd(1M)

roledel(1M)

rolemod(1M)

root_archive(1M)

route(1M)

routeadm(1M)

routed(1M)

rpcbind(1M)

rpc.bootparamd(1M)

rpcinfo(1M)

rpc.mdcommd(1M)

rpc.metad(1M)

rpc.metamedd(1M)

rpc.metamhd(1M)

rpc.nisd(1M)

rpc.nisd_resolv(1M)

rpc.nispasswdd(1M)

rpc.rexd(1M)

rpc.rstatd(1M)

rpc.rusersd(1M)

rpc.rwalld(1M)

rpc.smserverd(1M)

rpc.sprayd(1M)

rpc.yppasswdd(1M)

rpc.ypupdated(1M)

rpld(1M)

rquotad(1M)

rsh(1M)

rshd(1M)

rstatd(1M)

rtc(1M)

rtquery(1M)

runacct(1M)

rusersd(1M)

rwall(1M)

rwalld(1M)

rwhod(1M)

sa1(1M)

sa2(1M)

sac(1M)

sacadm(1M)

sadc(1M)

saf(1M)

sar(1M)

savecore(1M)

scadm(1M)

sckmd(1M)

sconadm(1M)

sdpadm(1M)

sendmail(1M)

setuname(1M)

setup_install_server(1M)

sf880drd(1M)

sftp-server(1M)

share(1M)

shareall(1M)

share_nfs(1M)

showmount(1M)

showrev(1M)

shutacct(1M)

shutdown(1M)

slpd(1M)

smartcard(1M)

smattrpop(1M)

smbios(1M)

smc(1M)

smccompile(1M)

smcconf(1M)

smcregister(1M)

smcron(1M)

smcwebserver(1M)

smdiskless(1M)

smexec(1M)

smgroup(1M)

smlog(1M)

smmaillist(1M)

smmultiuser(1M)

smosservice(1M)

smpatch(1M)

smprofile(1M)

smreg(1M)

smrole(1M)

smrsh(1M)

smserialport(1M)

smtnrhdb(1M)

smtnrhtp(1M)

smtnzonecfg(1M)

smuser(1M)

snmpbulkget(1M)

snmpbulkwalk(1M)

snmpcmd(1M)

snmpconf(1M)

snmpd(1M)

snmpdelta(1M)

snmpdf(1M)

snmpdx(1M)

snmpget(1M)

snmpgetnext(1M)

snmpinform(1M)

snmpnetstat(1M)

snmpset(1M)

snmptable(1m)

snmptest(1M)

snmptranslate(1m)

snmptrap(1M)

snmptrapd(1M)

snmpusm(1M)

snmpvacm(1M)

snmpwalk(1M)

snmpXdmid(1M)

snmpXwbemd(1M)

snoop(1M)

soconfig(1M)

soladdapp(1M)

soldelapp(1M)

solstice(1M)

sppptun(1M)

spray(1M)

sprayd(1M)

sshd(1M)

ssh-keysign(1M)

startup(1M)

statd(1M)

stclient(1M)

stmsboot(1M)

strace(1M)

strclean(1M)

strerr(1M)

sttydefs(1M)

su(1M)

sulogin(1M)

suninstall(1M)

SUNWafb_config(1M)

SUNWffb_config(1M)

SUNWgfb_config(1M)

SUNWifb_config(1M)

SUNWjfb_config(1M)

SUNWkfb_config(1M)

SUNWm64_config(1M)

SUNWnfb_config(1M)

SUNWpfb_config(1M)

SUNWzulu_config(1M)

svcadm(1M)

svccfg(1M)

svc.configd(1M)

svc.startd(1M)

swap(1M)

sync(1M)

syncinit(1M)

syncloop(1M)

syncstat(1M)

sysdef(1M)

syseventadm(1M)

syseventconfd(1M)

syseventd(1M)

sysidconfig(1M)

sysidkbd(1M)

sysidnet(1M)

sysidnfs4(1M)

sysidns(1M)

sysidpm(1M)

sysidroot(1M)

sysidsys(1M)

sysidtool(1M)

syslogd(1M)

sys-unconfig(1M)

talkd(1M)

tapes(1M)

taskstat(1M)

telinit(1M)

telnetd(1M)

tftpd(1M)

System Administration Commands - Part 3

netstat

- show network status

Synopsis

netstat [-anvR] [-f address_family] [-P protocol]
netstat -g [-nv] [-f address_family]
netstat -p [-n] [-f address_family]
netstat -s [-f address_family] [-P protocol] 
     [interval [count]]
netstat -m [-v] [interval [count]]
netstat -i [-I interface] [-an] [-f address_family] 
     [interval [count]]
netstat -r [-anvR] [-f address_family | filter]
netstat -M [-ns] [-f address_family]
netstat -D [-I interface] [-f address_family]

Description

The netstat command displays the contents of certain network-related data structures in various formats, depending on the options you select.

The netstat command has the several forms shown in the SYNOPSIS section, above, listed as follows:

These forms are described in greater detail below.

With no arguments (the first form), netstat displays connected sockets for PF_INET, PF_INET6, and PF_UNIX, unless modified otherwise by the -f option.

Options

-a

Show the state of all sockets, all routing table entries, or all interfaces, both physical and logical. Normally, listener sockets used by server processes are not shown. Under most conditions, only interface, host, network, and default routes are shown and only the status of physical interfaces is shown.

-f address_family

Limit all displays to those of the specified address_family. The value of address_family can be one of the following:

inet

For the AF_INET address family showing IPv4 information.

inet6

For the AF_INET6 address family showing IPv6 information.

unix

For the AF_UNIX address family.

-f filter

With -r only, limit the display of routes to those matching the specified filter. A filter rule consists of a keyword:value pair. The known keywords and the value syntax are:

af:{inet|inet6|unix|number}

Selects an address family. This is identical to -f address_family and both syntaxes are supported.

{inif|outif}:{name|ifIndex|any|none}

Selects an input or output interface. You can specify the interface by name (such as hme0) or by ifIndex number (for example, 2). If any is used, the filter matches all routes having a specified interface (anything other than null). If none is used, the filter matches all routes having a null interface. Note that you can view the index number (ifIndex) for an interface with the -a option of ifconfig(1M).

{src|dst}:{ip-address[/mask]|any|none}

Selects a source or destination IP address. If specified with a mask length, then any routes with matching or longer (more specific) masks are selected. If any is used, then all but addresses but 0 are selected. If none is used, then address 0 is selected.

flags:[+ -]?[ABDGHLMSU]+

Selects routes tagged with the specified flags. By default, the flags as specified must be set in order to match. With a leading +, the flags specified must be set but others are ignored. With a leading -, the flags specified must not be set and others are permitted.

You can specify multiple instances of -f to specify multiple filters. For example:

% netstat -nr -f outif:hme0 -f outif:hme1 -f dst:10.0.0.0/8

The preceding command displays routes within network 10.0.0.0/8, with mask length 8 or greater, and an output interface of either hme0 or hme1, and excludes all other routes.

-g

Show the multicast group memberships for all interfaces. If the -v option is included, source-specific membership information is also displayed. See DISPLAYS, below.

-i

Show the state of the interfaces that are used for IP traffic. Normally this shows statistics for the physical interfaces. When combined with the -a option, this will also report information for the logical interfaces. See ifconfig(1M).

-m

Show the STREAMS memory statistics.

-n

Show network addresses as numbers. netstat normally displays addresses as symbols. This option may be used with any of the display formats.

-p

Show the net to media tables. See DISPLAYS, below.

-r

Show the routing tables. Normally, only interface, host, network, and default routes are shown, but when this option is combined with the -a option, all routes will be displayed, including cache.

-s

Show per-protocol statistics. When used with the -M option, show multicast routing statistics instead. When used with the -a option, per-interface statistics will be displayed, when available, in addition to statistics global to the system. See DISPLAYS, below.

-v

Verbose. Show additional information for the sockets, STREAMS memory statistics, routing table, and multicast group memberships.

-I interface

Show the state of a particular interface. interface can be any valid interface such as hme0 or eri0. Normally, the status and statistics for physical interfaces are displayed. When this option is combined with the -a option, information for the logical interfaces is also reported.

-M

Show the multicast routing tables. When used with the -s option, show multicast routing statistics instead.

-P protocol

Limit display of statistics or state of all sockets to those applicable to protocol. The protocol can be one of ip, ipv6, icmp, icmpv6, icmp, icmpv6, igmp, udp, tcp, rawip. rawip can also be specified as raw. The command accepts protocol options only as all lowercase.

-D

Show the status of DHCP configured interfaces.

-R

This modifier displays extended security attributes for sockets and routing table entries. The -R modifier is available only if the system is configured with the Solaris Trusted Extensions feature.

With -r only, this option displays the routing entries' gateway security attributes. See route(1M) for more information on security attributes.

When displaying socket information using the first form of the commmand, this option displays additional information for Multi-Level Port(MLP) sockets. This includes:

  • The label for the peer if the the socket is connected.

  • The following flags can be appended to the socket's “State” output:

    P

    The socket is a MLP on zone-private IP addresses.

    S

    The socket is a MLP on IP addresses shared between zones.

Operands

interval

Display statistics accumulated since last display every interval seconds, repeating forever, unless count is specified. When invoked with interval, the first row of netstat output shows statistics accumulated since last reboot.

The following options support interval: -i, -m, -s and -Ms. Some values are configuration parameters and are just redisplayed at each interval.

count

Display interface statistics the number of times specified by count, at the interval specified by interval.

DISPLAYS

Active Sockets (First Form)

The display for each active socket shows the local and remote address, the send and receive queue sizes (in bytes), the send and receive windows (in bytes), and the internal state of the protocol.

The symbolic format normally used to display socket addresses is either:

hostname.port

when the name of the host is specified, or

network.port

if a socket address specifies a network but no specific host.

The numeric host address or network number associated with the socket is used to look up the corresponding symbolic hostname or network name in the hosts or networks database.

If the network or hostname for an address is not known, or if the -n option is specified, the numerical network address is shown. Unspecified, or “wildcard”, addresses and ports appear as an asterisk (*). For more information regarding the Internet naming conventions, refer to inet(7P) and inet6(7P).

For SCTP sockets, because an endpoint can be represented by multiple addresses, the verbose option (-v) displays the list of all the local and remote addresses.

TCP Sockets

The possible state values for TCP sockets are as follows:

BOUND

Bound, ready to connect or listen.

CLOSED

Closed. The socket is not being used.

CLOSING

Closed, then remote shutdown; awaiting acknowledgment.

CLOSE_WAIT

Remote shutdown; waiting for the socket to close.

ESTABLISHED

Connection has been established.

FIN_WAIT_1

Socket closed; shutting down connection.

FIN_WAIT_2

Socket closed; waiting for shutdown from remote.

IDLE

Idle, opened but not bound.

LAST_ACK

Remote shutdown, then closed; awaiting acknowledgment.

LISTEN

Listening for incoming connections.

SYN_RECEIVED

Initial synchronization of the connection under way.

SYN_SENT

Actively trying to establish connection.

TIME_WAIT

Wait after close for remote shutdown retransmission.

SCTP Sockets

The possible state values for SCTP sockets are as follows:

CLOSED

Closed. The socket is not being used.

LISTEN

Listening for incoming associations.

ESTABLISHED

Association has been established.

COOKIE_WAIT

INIT has been sent to the peer, awaiting acknowledgment.

COOKIE_ECHOED

State cookie from the INIT-ACK has been sent to the peer, awaiting acknowledgement.

SHUTDOWN_PENDING

SHUTDOWN has been received from the upper layer, awaiting acknowledgement of all outstanding DATA from the peer.

SHUTDOWN_SENT

All outstanding data has been acknowledged in the SHUTDOWN_SENT state. SHUTDOWN has been sent to the peer, awaiting acknowledgement.

SHUTDOWN_RECEIVED

SHUTDOWN has been received from the peer, awaiting acknowledgement of all outstanding DATA.

SHUTDOWN_ACK_SENT

All outstanding data has been acknowledged in the SHUTDOWN_RECEIVED state. SHUTDOWN_ACK has been sent to the peer.

Network Data Structures (Second Through Fifth Forms)

The form of the display depends upon which of the -g, -m, -p, or -s options you select.

-g

Displays the list of multicast group membership.

-m

Displays the memory usage, for example, STREAMS mblks.

-p

Displays the net to media mapping table. For IPv4, the address resolution table is displayed. See arp(1M). For IPv6, the neighbor cache is displayed.

-s

Displays the statistics for the various protocol layers.

The statistics use the MIB specified variables. The defined values for ipForwarding are:

forwarding(1)

Acting as a gateway.

not-forwarding(2)

Not acting as a gateway.

The IPv6 and ICMPv6 protocol layers maintain per-interface statistics. If the -a option is specified with the -s option, then the per-interface statistics as well as the total sums are displayed. Otherwise, just the sum of the statistics are shown.

For the second, third, and fourth forms of the command, you must specify at least -g, -p, or -s. You can specify any combination of these options. You can also specify -m (the fifth form) with any set of the -g, -p, and -s options. If you specify more than one of these options, netstat displays the information for each one of them.

Interface Status (Sixth Form)

The interface status display lists information for all current interfaces, one interface per line. If an interface is specified using the -I option, it displays information for only the specified interface.

The list consists of the interface name, mtu (maximum transmission unit, or maximum packet size)(see ifconfig(1M)), the network to which the interface is attached, addresses for each interface, and counter associated with the interface. The counters show the number of input packets, input errors, output packets, output errors, and collisions, respectively. For Point-to-Point interfaces, the Net/Dest field is the name or address on the other side of the link.

If the -a option is specified with either the -i option or the -I option, then the output includes names of the physical interface(s), counts for input packets and output packets for each logical interface, plus additional information.

If the -n option is specified, the list displays the IP address instead of the interface name.

If an optional interval is specified, the output will be continually displayed in interval seconds until interrupted by the user or until count is reached. See OPERANDS.

The physical interface is specified using the -I option. When used with the interval operand, output for the -I option has the following format:

input    eri0          output        input          (Total)   output
packets  errs  packets errs  colls   packets  errs  packets  errs   colls
227681   0     659471  1     502     261331   0     99597    1      502
10       0     0       0     0       10       0     0        0      0 
8        0     0       0     0       8        0     0        0      0 
10       0     2       0     0       10       0     2        0      0

If the input interface is not specified, the first interface of address family inet or inet6 will be displayed.

Routing Table (Seventh Form)

The routing table display lists the available routes and the status of each. Each route consists of a destination host or network, and a gateway to use in forwarding packets. The flags column shows the status of the route. These flags are as follows:

U

Indicates route is up.

G

Route is to a gateway.

H

Route is to a host and not a network.

M

Redundant route established with the -multirt option.

S

Route was established using the -setsrc option.

D

Route was created dynamically by a redirect.

If the -a option is specified, there will be routing entries with the following flags:

A

Combined routing and address resolution entries.

B

Broadcast addresses.

L

Local addresses for the host.

Interface routes are created for each interface attached to the local host; the gateway field for such entries shows the address of the outgoing interface.

The use column displays the number of packets sent using a combined routing and address resolution (A) or a broadcast (B) route. For a local (L) route, this count is the number of packets received, and for all other routes it is the number of times the routing entry has been used to create a new combined route and address resolution entry.

The interface entry indicates the network interface utilized for the route.

Multicast Routing Tables (Eighth Form)

The multicast routing table consists of the virtual interface table and the actual routing table.

DHCP Interface Information (Ninth Form)

The DHCP interface information consists of the interface name, its current state, lease information, packet counts, and a list of flags.

The states correlate with the specifications set forth in RFC 2131.

Lease information includes:

The flags currently defined include:

BOOTP

The interface has a lease obtained through BOOTP (IPv4 only).

BUSY

The interface is busy with a DHCP transaction.

PRIMARY

The interface is the primary interface. See dhcpinfo(1) and ifconfig(1M).

FAILED

The interface is in failure state and must be manually restarted.

Packet counts are maintained for the number of packets sent, the number of packets received, and the number of lease offers declined by the DHCP client. All three counters are initialized to zero and then incremented while obtaining a lease. The counters are reset when the period of lease renewal begins for the interface. Thus, the counters represent either the number of packets sent, received, and declined while obtaining the current lease, or the number of packets sent, received, and declined while attempting to obtain a future lease.

Files

/etc/default/inet_type

DEFAULT_IP setting

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
SUNWcsu

See Also

arp(1M), dhcpinfo(1), dhcpagent(1M), ifconfig(1M), iostat(1M), kstat(1M), mibiisa(1M), savecore(1M), vmstat(1M), hosts(4), inet_type(4), networks(4), protocols(4), services(4), attributes(5), dhcp(5), kstat(7D), inet(7P), inet6(7P)

Droms, R., RFC 2131, Dynamic Host Configuration Protocol, Network Working Group, March 1997.

Droms, R. RFC 3315, Dynamic Host Configuration Protocol for IPv6 (DHCPv6). Cisco Systems. July 2003.

Notes

When displaying interface information, netstat honors the DEFAULT_IP setting in /etc/default/inet_type. If it is set to IP_VERSION4, then netstat will omit information relating to IPv6 interfaces, statistics, connections, routes and the like.

However, you can override the DEFAULT_IP setting in /etc/default/inet_type on the command-line. For example, if you have used the command-line to explicitly request IPv6 information by using the inet6 address family or one of the IPv6 protocols, it will override the DEFAULT_IP setting.

If you need to examine network status information following a kernel crash, use the mdb(1) utility on the savecore(1M) output.

The netstat utility obtains TCP statistics from the system by opening /dev/tcp and issuing queries. Because of this, netstat might display an extra, unused connection in IDLE state when reporting connection status.

Previous versions of netstat had undocumented methods for reporting kernel statistics published using the kstat(7D) facility. This functionality has been removed. Use kstat(1M) instead.

netstat restricts its output to information that is relevant to the zone in which netstat runs. (This is true for both shared-IP and exclusive-IP zones.)