Fecha de última modificación:

4 Abril, 2014 - 05:04

netstat

Muestra conexiones de red, tablas de ruteo, estadísticas de interfaces, etc.

netstat --inet muestra solo las conexiones activas TCP/IP.

netstat -p trata de identificar el proceso que esta manejando esta conexión

netstat -l lista los puertos que están abiertos (conexiones establecidas).

netstat -atpn lista los puestos pero de una forma más resumida y mejor que ejecutando netstat -l es similar a ejecutar el comando ss -ant

netstat -r muestra las rutas (similar a ejecutar route -r)

netstat -lnp64 forma abreviada de salida

Ejemplo de la salida del comando netstat --inet

# netstat --inet
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0    304 192.168.1.8:ssh         192.168.1.4:6045        ESTABLISHED

Ejemplo de la salida del comando netstat --inet

# netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 localhost:50505         *:*                     LISTEN
tcp        0      0 *:3790                  *:*                     LISTEN
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp        0      0 localhost:postgresql    *:*                     LISTEN
tcp        0      0 localhost:3001          *:*                     LISTEN
tcp        0      0 localhost:6010          *:*                     LISTEN
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN
tcp6       0      0 localhost:postgresql    [::]:*                  LISTEN
tcp6       0      0 localhost:6010          [::]:*                  LISTEN
udp        0      0 *:bootpc                *:*
udp        0      0 *:52926                 *:*
udp6       0      0 [::]:33281              [::]:*
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  2      [ ACC ]     STREAM     LISTENING     9479     /var/run/pcscd/pcscd.comm
unix  2      [ ACC ]     STREAM     LISTENING     11811    @/tmp/dbus-i4lKoIcA8l
unix  2      [ ACC ]     STREAM     LISTENING     12878    @/tmp/gdm-session-EjQBrqPb
unix  2      [ ACC ]     STREAM     LISTENING     13663    /tmp/pulse-f31zAjbVRTLp/dbus-socket
unix  2      [ ACC ]     STREAM     LISTENING     9574     @/tmp/.X11-unix/X0
unix  2      [ ACC ]     SEQPACKET  LISTENING     4460     /run/udev/control
unix  2      [ ACC ]     STREAM     LISTENING     13135    @/tmp/dbus-dcSnR9MOjD
unix  2      [ ACC ]     STREAM     LISTENING     9575     /tmp/.X11-unix/X0
unix  2      [ ACC ]     STREAM     LISTENING     12936    /root/.cache/keyring-VivsX4/control
unix  2      [ ACC ]     STREAM     LISTENING     11843    /tmp/ssh-kUDa5rbfBZf6/agent.3339
unix  2      [ ACC ]     STREAM     LISTENING     11848    /tmp/.ICE-unix/3339
unix  2      [ ACC ]     STREAM     LISTENING     11907    /root/.cache/keyring-VivsX4/ssh
unix  2      [ ACC ]     STREAM     LISTENING     13201    /root/.cache/keyring-VivsX4/gpg
unix  2      [ ACC ]     STREAM     LISTENING     13202    /root/.cache/keyring-VivsX4/pkcs11
unix  2      [ ACC ]     STREAM     LISTENING     13650    /tmp/pulse-f31zAjbVRTLp/native
unix  2      [ ACC ]     STREAM     LISTENING     9652     /run/pulse/native
unix  2      [ ACC ]     STREAM     LISTENING     9654     /var/run/pulse/dbus-socket
unix  2      [ ACC ]     STREAM     LISTENING     10702    /var/run/postgresql/.s.PGSQL.5432
unix  2      [ ACC ]     STREAM     LISTENING     8693     /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     11847    @/tmp/.ICE-unix/3339

Ejemplo de la salida del comando netstat -atpn

# netstat -atpn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:50505         0.0.0.0:*               LISTEN      2903/prosvc
tcp        0      0 0.0.0.0:3790            0.0.0.0:*               LISTEN      3568/nginx.conf
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      3097/sshd
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      2545/postgres
tcp        0      0 127.0.0.1:3001          0.0.0.0:*               LISTEN      3112/thin server (1
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      3542/0
tcp        0    272 192.168.1.8:22          192.168.1.4:6045        ESTABLISHED 3542/0
tcp6       0      0 :::22                   :::*                    LISTEN      3097/sshd
tcp6       0      0 ::1:5432                :::*                    LISTEN      2545/postgres
tcp6       0      0 ::1:6010                :::*                    LISTEN      3542/0
tcp6       0      0 ::1:42121               ::1:5432                ESTABLISHED 2903/prosvc
tcp6       0      0 ::1:5432                ::1:42123               ESTABLISHED 3717/postgres: msf3
tcp6       0      0 ::1:42123               ::1:5432                ESTABLISHED 3710/delayed_job
tcp6       0      0 ::1:42118               ::1:5432                ESTABLISHED 2903/prosvc
tcp6       0      0 ::1:42120               ::1:5432                ESTABLISHED 2903/prosvc
tcp6       0      0 ::1:5432                ::1:42121               ESTABLISHED 3696/postgres: msf3
tcp6       0      0 ::1:5432                ::1:42007               ESTABLISHED 3228/postgres: msf3
tcp6       0      0 ::1:42119               ::1:5432                ESTABLISHED 2903/prosvc
tcp6       0      0 ::1:5432                ::1:42119               ESTABLISHED 3686/postgres: msf3
tcp6       0      0 ::1:5432                ::1:42118               ESTABLISHED 3684/postgres: msf3
tcp6       0      0 ::1:5432                ::1:42120               ESTABLISHED 3687/postgres: msf3
tcp6       0      0 ::1:42007               ::1:5432                ESTABLISHED 3112/thin server (1

Ejemplo de la salida del comando netstat -lnp64

# netstat -lnp64
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:50505         0.0.0.0:*               LISTEN      2903/prosvc
tcp        0      0 0.0.0.0:3790            0.0.0.0:*               LISTEN      3568/nginx.conf
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      3097/sshd
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      2545/postgres
tcp        0      0 127.0.0.1:3001          0.0.0.0:*               LISTEN      3112/thin server (1
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      3542/0
tcp6       0      0 :::22                   :::*                    LISTEN      3097/sshd
tcp6       0      0 ::1:5432                :::*                    LISTEN      2545/postgres
tcp6       0      0 ::1:6010                :::*                    LISTEN      3542/0
udp        0      0 0.0.0.0:68              0.0.0.0:*                           2627/dhclient
udp        0      0 0.0.0.0:52926           0.0.0.0:*                           2627/dhclient
udp6       0      0 :::33281                :::*                                2627/dhclient

Ver también el comando lsof por ejemplo lsof -i tcp o lsof -i udp los cuales listaran las conexiones abiertas TCP y UDP respectivamente. También se puede usar el comando ss por ejemplo como ss -ant

Ejemplo de la salida del comando lsof -i tcp

#lsof -i tcp
COMMAND   PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
postgres 2545 postgres    3u  IPv6   9821      0t0  TCP localhost:postgresql (LISTEN)
postgres 2545 postgres    6u  IPv4   9822      0t0  TCP localhost:postgresql (LISTEN)
ruby     2903     root    7u  IPv6  13880      0t0  TCP localhost:42118->localhost:postgresql (ESTABLISHED)
ruby     2903     root    8u  IPv6  13886      0t0  TCP localhost:42119->localhost:postgresql (ESTABLISHED)
ruby     2903     root    9u  IPv6  13891      0t0  TCP localhost:42120->localhost:postgresql (ESTABLISHED)
ruby     2903     root   10u  IPv4  13898      0t0  TCP localhost:50505 (LISTEN)
ruby     2903     root   11u  IPv6  14681      0t0  TCP localhost:42121->localhost:postgresql (ESTABLISHED)
sshd     3097     root    3u  IPv4  12298      0t0  TCP *:ssh (LISTEN)
sshd     3097     root    4u  IPv6  12300      0t0  TCP *:ssh (LISTEN)
ruby     3112   daemon    6u  IPv6  12539      0t0  TCP localhost:42007->localhost:postgresql (ESTABLISHED)
ruby     3112   daemon   10u  IPv4  12782      0t0  TCP localhost:3001 (LISTEN)
postgres 3228 postgres    9u  IPv6  12540      0t0  TCP localhost:postgresql->localhost:42007 (ESTABLISHED)
sshd     3542     root    3u  IPv4  13659      0t0  TCP 192.168.1.8:ssh->192.168.1.4:6045 (ESTABLISHED)
sshd     3542     root    8u  IPv6  13857      0t0  TCP localhost:6010 (LISTEN)
sshd     3542     root    9u  IPv4  13858      0t0  TCP localhost:6010 (LISTEN)
nginx    3568     root    9u  IPv4  14526      0t0  TCP *:3790 (LISTEN)
nginx    3569   daemon    9u  IPv4  14526      0t0  TCP *:3790 (LISTEN)
nginx    3570   daemon    9u  IPv4  14526      0t0  TCP *:3790 (LISTEN)
nginx    3571   daemon    9u  IPv4  14526      0t0  TCP *:3790 (LISTEN)
nginx    3572   daemon    9u  IPv4  14526      0t0  TCP *:3790 (LISTEN)
postgres 3684 postgres    9u  IPv6  14655      0t0  TCP localhost:postgresql->localhost:42118 (ESTABLISHED)
postgres 3686 postgres    9u  IPv6  13887      0t0  TCP localhost:postgresql->localhost:42119 (ESTABLISHED)
postgres 3687 postgres    9u  IPv6  13892      0t0  TCP localhost:postgresql->localhost:42120 (ESTABLISHED)
postgres 3696 postgres    9u  IPv6  14682      0t0  TCP localhost:postgresql->localhost:42121 (ESTABLISHED)
ruby     3710   daemon    7u  IPv6  14723      0t0  TCP localhost:42123->localhost:postgresql (ESTABLISHED)
postgres 3717 postgres    9u  IPv6  13916      0t0  TCP localhost:postgresql->localhost:42123 (ESTABLISHED)

Ejemplo de la salida del comando ss -ant

# ss -ant
State       Recv-Q Send-Q                    Local Address:Port                      Peer Address:Port
LISTEN      0      128                           127.0.0.1:50505                                *:*
LISTEN      0      128                                   *:3790                                 *:*
LISTEN      0      128                                  :::22                                  :::*
LISTEN      0      128                                   *:22                                   *:*
LISTEN      0      128                           127.0.0.1:5432                                 *:*
LISTEN      0      128                                 ::1:5432                                :::*
LISTEN      0      100                           127.0.0.1:3001                                 *:*
LISTEN      0      128                           127.0.0.1:6010                                 *:*
LISTEN      0      128                                 ::1:6010                                :::*
ESTAB       0      0                                   ::1:42121                              ::1:5432
ESTAB       0      160                         192.168.1.8:22                         192.168.1.4:6045
ESTAB       0      0                                   ::1:5432                               ::1:42123
ESTAB       0      0                                   ::1:42123                              ::1:5432
ESTAB       0      0                                   ::1:42118                              ::1:5432
ESTAB       0      0                                   ::1:42120                              ::1:5432
ESTAB       0      0                                   ::1:5432                               ::1:42121
ESTAB       0      0                                   ::1:5432                               ::1:42007
ESTAB       0      0                                   ::1:42119                              ::1:5432
ESTAB       0      90                                  ::1:5432                               ::1:42119
ESTAB       0      0                                   ::1:5432                               ::1:42118
ESTAB       0      0                                   ::1:5432                               ::1:42120
ESTAB       0      0                                   ::1:42007                              ::1:5432

Leer más sobre: 

¿Te resulto útil?: 

1

Envíanos tús preguntas, comentarios o sugerencias

 

Solicita Asistencia

Llámenos al:+54-9-11-32788353

Envíenos un e-mail: consultas@ ---Para enviar el SPAM--- francisconi.org

Skype Status for francisconi.hugo.adrian
 

Suscríbete

Suscríbete y recibe las últimas actualizaciones, noticias y más ...
Zircon - This is a contributing Drupal Theme
Design by WeebPal.