http://www.linuxplanet.com/linuxplanet/tutorials/5633/1
Keep an Eye on Your Linux Systems with NetstatUsing Netstat For Surveillance And TroubleshootingNovember 4, 2004 Two of the
fundamental aspects of Linux system security and troubleshooting are
knowing what services are running, and what connections and services
are available. We're all familiar with $ ps ax | grep -E 'telnet|inetd' 520 ? Ss 0:00 /usr/sbin/inetd But $ netstat --inet -a | grep telnet tcp 0 0 *:telnet *:* LISTEN This $ netstat -a Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 *:telnet *:* LISTEN tcp 0 0 *:ipp *:* LISTEN tcp 0 0 *:smtp *:* LISTEN tcp 0 0 192.168.1.5:32851 nest.anthill.echid:ircd ESTABLISHED udp 0 0 *:ipp *:* Active UNIX domain sockets (servers and established) Proto RefCnt Flags Type State I-Node Path unix 2 [ ACC ] STREAM LISTENING 1065 /tmp/ksocket-carla/klaunchertDCh2b.slave-socket unix 2 [ ACC ] STREAM LISTENING 1002 /tmp/ssh-OoMGfFm666/agent.666 unix 2 [ ACC ] STREAM LISTENING 819 private/smtp Your total output will probably run to a couple hundred lines. (A fun and quick way to count lines of output is $ netstat --inet -a This will display only network connections, both listening and established. Already How do you know what
services you want running? That is a mondo subject for another day, and
an important one. For example, if your system has been compromised,
this is one place to find evidence of a Trojan horse or other malware
phoning home. In this example, ipp is Internet Printing
Protocol, which belongs to CUPS (Common Unix Printing System.) If you
want your printer to work, this needs to be here. The connection on
192.168.1.5:32851 is my active IRC (Internet Relay Chat) connection.
Refer to your |