Como poner trazas de red

Con este comando mandamos todo el trafico a un fichero:
<table class=»msgText»> <tr> <td class=»errorAlertIco»><img src=»res://instant-message.dll/#10/#2415″ /></td> <td class=»boxedMessageText»>It appears that you do not have JavaScript enabled, please contact your adminitrator.</td> </tr> </table>

tcpdump -ni  <intefaz> -s0 -w /tmp/prueba.pcap

Y este para limitar el puerto:

 

tcpdump -ni <intefaz> -s0 -A port 8081

Que luego podemos abrir con el wireshark

Cómo comprobar que un archivo de 64-bit

En linux existe el comando file que te permite saber las  características del fichero:

Con más detalle:

https://es.wikipedia.org/wiki/File_(Unix)

En nuestro caso queríamos saber si la librería libevent estaba compilada para 32 o para 64 bit

file libevent*

libevent-2.0.so.5: symbolic link to `/usr/local/lib/libevent-2.0.so.5.1.9'
libevent-2.0.so.5.1.9: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
libevent.a: current ar archive
libevent_core-2.0.so.5: symbolic link to `/usr/local/lib/libevent_core-2.0.so.5.1.9'
libevent_core-2.0.so.5.1.9: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
libevent_core.a: current ar archive

 

Cambiar las opciones de montaje de una partición

En este caso cambiamos la opciones de la partición mongodata sobre la que tenemos la base de datos de mongo

Editamos el fichero /etc/fstab

Añadimos las opciones necesarias, en este caso

/dev/xvdb1 /mongodata xfs defaults,noatime 0 0

Y lo volvemos a montar la partición, como root

mount -o remount /mongodata

Para ver las modificaicones:

[root@mvtv ~]# mount

 

Cómo comprobar porque interfaz escuha un puerto en Linux

ss -ant

State      Recv-Q Send-Q          Local Address:Port                   Peer Address:Port

LISTEN     0      50                                        *:2020                                       *:*

LISTEN     0      128                10.95.33.177:27017                                        *:*

LISTEN     0      128                                         *:22                                         *:*

ESTAB      0      0                    10.95.33.177:49873                      10.95.33.46:27017

ESTAB      0      0                          10.95.33.177:22                        10.95.0.14:55283

ESTAB      0      0                    10.95.33.177:27017                      10.95.33.47:64095

ESTAB      0      0                    10.95.33.177:38060                       10.95.33.47:27017

ESTAB      0      0                          10.95.33.177:22                         10.95.0.14:53391

TIME-WAIT  0      0                 10.95.33.177:49869                       10.95.33.46:27017

TIME-WAIT  0      0                 10.95.33.177:49871                       10.95.33.46:27017

ESTAB      0      0                    10.95.33.177:27017                       10.95.33.46:40626

TIME-WAIT  0      0                 10.95.33.177:38058                        10.95.33.47:27017

LISTEN     0      128                                        :::22

Como aumentar los valores de Ulimit en Redhat Linux?

Los shells como bash/csh/ksh son responsables de proporcionar al usuario control sobre varios recursos del sistema. Estos tienen limitado el uso de recursos para evitar que un solo usuario se coma todos los recursos. La manera de limitar estos recursos es a través de los límites soft, hard y wide

Estos son los límites

Options           Explanation
-a             All current limits are reported
-b             The maximum socket buffer size
-c             The maximum size of core files created
-d             The maximum size of a process data segment
-e             The maximum scheduling priority (“nice”)
-f             The maximum size of files written by the shell and its children
-i              The maximum number of pending signals
-l              The maximum size that may be locked into memory
-m            The maximum resident set size (many systems do not honor this limit)
-n             The maximum number of open file descriptors (most systems do not allow this value to be set)
-p             The pipe size in 512-byte blocks (this may not be set)
-q             The maximum number of bytes in POSIX message queues
-r             The maximum real-time scheduling priority
-s             The maximum stack size
-t              The maximum amount of cpu time in seconds
-u             The maximum number of processes available to a single user
-v             The maximum amount of virtual memory available to the shell
-x             The maximum number of file locks
-t              The maximum number of threads
  1. Cómo ver los soft límites del Shell para el usuario?
ulimit -Sa
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 66560
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 66560
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
  1. Cómo ver los hard límites del Shell para el usuario?
ulimit -Ha
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 66560
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 66560
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Un cliente puede cambiar sus limites soft hasta llegar al valor que tiene los hard limits. Los hard limits solo se pueden cambiar por root, Siendo un usuario normal se pueden reducir los hard límites pero no aumentarlos.

Para editar los hard limits de los usuarios se debe editar el fichero

“/etc/security/limits.conf” .

Un ejemplo de fichero

Después de codificarlo el usuario debe reconectarse para ver los cambios.

Para modificar los límites a nivel de sistema, se debe modificar /etc/sysctl.conf

Debemos modificar el fichero y recargar la configuración:

#sysctl- p

Activar servicio NTP en Linux:

Hacer respaldo del fichero de configuración:

mv /etc/ntp.conf  ntp.conf.ori

Crear un nuevo fichero de configuración con las siguientes líneas.

restrict 127.0.0.1
driftfile /var/lib/ntp/drift
restrict 10.44.79.13 nomodify notrap noquery
server 10.44.79.13 burst iburst

Agregar el servicio al arranque del sistema

chkconfig ntpd on

Iniciar el servicio:

service ntpd start

Comprobar que ha quedado bien configurado

ntpdc -c sysinfo
system peer:          10.44.79.13 –importante que aquí se vea al cliente
system peer mode:     client –Y que esto este relleno
leap indicator:       00
stratum:              3
precision:            -20
root distance:        0.00368 s
root dispersion:      0.09782 s
reference ID:         [10.44.79.13]
reference time:       d544bcb3.8344069d  Mon, May 20 2013 17:16:03.512
system flags:         auth monitor ntp kernel stats
jitter:               0.029282 s
stability:            0.000 ppm
broadcastdelay:       0.003998 s
authdelay:            0.000000 s

O también se puede utilizar:

ntpq -nc peers
  remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*10.44.79.13     192.168.32.1     2 u   18   64  177    0.788  -8779.6  64.825

Es importante que tiene un * delante.

Sin activar el servicio se puede utilizar este servicio para sincronizar de una manera rápida:

#ntpdate -u 10.44.79.13