Viewing Network Services and Connections

At times you may wish to see what network services are “listening” on your Freedom server or see information about any “live” connections being made to or from your server. The netstat command can produce a report about your network services for this purpose.

To use the netstat command in this way, type:

> netstat -a

This produces a report that looks similar to the following:

Active Internet connections (including servers)

Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)

tcp4       0     20  domain.ssh           209.95.99.202.1490   ESTABLISHED

tcp4       0      0  localhost.ftp-data   nat-0-73.light.2608  TIME_WAIT

tcp4       0      0  localhost.ftp        nat-0-73.light.2607  ESTABLISHED

tcp4       0      0  localhost.ssh        nat-0-73.light.2487  ESTABLISHED

tcp4       0      0  domain.submission    *.*                  LISTEN

tcp4       0      0  domain.smtp          *.*                  LISTEN

tcp4       0      0  domain.imap          *.*                  LISTEN

tcp4       0      0  domain.http          *.*                  LISTEN

tcp4       0      0  domain.https         *.*                  LISTEN

tcp4       0      0  domain.ssh           *.*                  LISTEN

tcp4       0      0  domain.domain        *.*                  LISTEN

tcp4       0      0  domain.3306          *.*                  LISTEN

tcp4       0      0  domain.pop3          *.*                  LISTEN

tcp4       0      0  domain.netbios-ssn   *.*                  LISTEN

tcp4       0      0  domain.pop3s         *.*                  LISTEN

tcp4       0      0  domain.imaps         *.*                  LISTEN

tcp4       0      0  domain.ftp           *.*                  LISTEN

udp4       0      0  domain.domain        *.*                    

udp4       0      0  domain.syslog        *.*                    

Active UNIX domain sockets

Address  Type   Recv-Q Send-Q    Inode     Conn     Refs  Nextref Addr

e536fd80 stream      0      0        0 e536fd40        0        0 /virtual/home/ip.add.re.ss/var/run/servers

e536fd40 stream      0      0        0 e536fd80        0        0

e536fd00 stream      0      0 e5455440        0        0        0 /tmp/mysql.sock

e536fe00 dgram       0      0        0 e536fe80        0 e536fdc0

e536fdc0 dgram       0      0        0 e536fe80        0 e536fe40

e536fe40 dgram       0      0        0 e536fe80        0        0

e536fe80 dgram       0      0 e542be00        0 e536fe00        0 /var/run/log

The first section of this report, which is entitled “Active Internet Connections,” displays the services that are being provided by your server and shows the remote computers that are currently connected to those services. This section of the report is divided into the following columns:

Proto - The protocol used by the application. Transmission Control Protocol (TCP) is used to ensure reliability and data integrity; User Datagram Protocol (UDP) is used when speed and performance are more important than reliability, as with audio and video streaming.

Recv-Q and Send-Q - The size of the queue for incoming and outgoing data packets, in bytes.

Local Address - The hostname and port that the service is connected to, using the format hostname.port.

Foreign Address - The address and port from which the connection is being made.

State - The current status of the connection. The most common values are listed below:

ESTABLISHED - A connection is currently established for the associated service.

LISTEN - The server is on standby, awaiting a connection to the associated service.

TIME_WAIT - The server is waiting for a specified time interval to elapse before closing an open connection.

The second half of the report, entitled “Active UNIX domain sockets,” deals with a different type of service available only to your server itself. These services include the system logging facility and a connection that is used to increase the efficiency of local connections to the MySQL database server.

For more information on the netstat command, type man netstat at your server’s command prompt.