[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

¡Esta es una revisión vieja del documento!


Monitoreo de red con Arpwatch

Arpwatch permite que un sistema rastree IP pares de direcciones. Mapea las MAC Addresses en una red al rastrear ARP a cada una dispositivo en LAN y registra la respuesta en una base de datos. Todas las tarjetas de red se fabrican con una dirección MAC única y esto permite que Arpwatch identifique cada dispositivo. El objetivo principal de mapear una red como esta es para que el administrador del sistema pueda realizar un seguimiento de los dispositivos en una red e identificar cuándo hay problemas de red. Arpwatch se usa comúnmente para identificar cuándo se está llevando a cabo un ARP Man in the Middle attack notificando al administrador del sistema cuando se usa una dirección MAC duplicada en el red. Arpwatch se ejecuta más comúnmente en enrutadores, pero también puede ser útil en un conmutador de red administrado.

Instalar

Arpwatch no es aparte de la distribución estándar de Slackware Linux. Se puede obtener descargando SlackBuild de SlackBuilds.org para la versión de Slackware que desee. SlackBuilds.org tiene un excelente HOWTO que trata cómo instalar un SlackBuild. Las SlackBuilds.org FAQ también son muy útiles para los usuarios de Slackware que quieren instalar un SlackBuild.

Configuración

El script de inicio incluido permite al administrador configurar Arpwatch para una o más tarjetas de red. También es donde el administrador puede configurar los ajustes del tiempo de ejecución para Arpwatch. Abra /etc/rc.d/rc.arpwatch en su sistema y edite la variable OPTIONS para su necesidades. Por defecto, la cuenta root recibe todos los correos electrónicos de Arpwatch. Cambie la cuenta de correo electrónico que Arpwatch usará para las notificaciones por correo electrónico. Asegúrese de utilizar una cuenta de usuario o una dirección de correo electrónico que exista o Arpwatch no le enviará notificaciones.

La línea que estás buscando es:

OPTIONS="-i $IFACE -f $ARPDIR/arp-$IFACE.dat -u root -e root -s root"

La página del manual de Arpwatch indica que el interruptor - e administra la cuenta de correo electrónico. Cambiemoslo al usuario darkstar .

OPTIONS="-i $IFACE -f $ARPDIR/arp-$IFACE.dat -u root -e darkstar -s root"

O podemos usar una dirección de correo electrónico remota si sendmail está configurado para hacerlo:

OPTIONS="-i $IFACE -f $ARPDIR/arp-$IFACE.dat -u root -e user@randomdomain.com -s root"

Update MAC Address Database

The README.ethercodes installed with the Arpwatch SlackBuild indicates that the MAC Address database that comes with the source tarball can be outdated. This database is only updated when there is a new release of Arpwatch, which has not happened in quite a while.

These steps are covered in greater detail if you read /usr/doc/arpwatch-$VERSION/README.ethercodes

su -
cd /var/lib/arpwatch
wget http://standards-oui.ieee.org/oui.txt
./massagevendor oui.txt > ethercodes.dat
rm -f oui.txt

Start and Stop at Boot

The file /etc/rc.d/rc.arpwatch controls start up and shut down of Arpwatch. In order to use this script you need to add a few lines to /etc/rc.d/rc.local and /etc/rc.d/rc.local_shutdown. Be sure to use the appropriate order if you have any other network services starting or stopping in these scripts. As an example, you should start Arpwatch before you bring up hostapd if you are running a Wireless Access Point, and shutdown Arpwatch after hostapd exits. Using such ordering assures that Arpwatch identifies all ARP requests on your network.

Continuing with the above example lets assume you are running a wireless access point. Add this to /etc/rc.d/rc.local

if [ -x /etc/rc.d/rc.arpwatch ]; then
  /etc/rc.d/rc.arpwatch start wlan0
fi

If you wish to run Arpwatch on multiple network cards adjust /etc/rc.d/rc.local like this:

# Change eth0 and wlan0 to match your configuration
if [ -x /etc/rc.d/rc.arpwatch ]; then
  /etc/rc.d/rc.arpwatch start eth0
  /etc/rc.d/rc.arpwatch start wlan0
fi

It's important that Arpwatch is stopped cleanly when your system is shutdown or rebooted. If you haven't already done so, create /etc/rc.d/rc.local_shutdown as root:

touch /etc/rc.d/rc.local_shutdown

Next you need to edit rc.local_shutdown like so:

if [ -x /etc/rc.d/rc.arpwatch ]; then
  /etc/rc.d/rc.arpwatch stop
fi

Finally, mark rc.local and rc.local_shutdown as executable. This tells Slackware to automatically execute these scripts during the boot process.

chmod +x /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local_shutdown

Wrap Up

Assuming all steps were followed you should have received an email for each device Arpwatch discovered on your network. If you opted to use the root user for notifications, you can view them by using the mail command as root user.

mail -f /var/spool/mail/root

Here is an example of what you may find in your inbox:

            hostname: <unknown>
          ip address: 192.168.151.170
    ethernet address: XX:XX:XX:XX:XX:XX
    ethernet address: XX:XX:XX:XX:XX:XX
     ethernet vendor: <unknown>
           timestamp: Monday, April 9, 2018 12:01:39 -0600

Sources

 es:howtos:software:arpwatch ()
Esta traducción es más antigua que la página original y podría estar obsoleta. Ver lo que ha cambiado.