For When You Can't Have The Real Thing
[ start | index | login ]
start > macwatch

macwatch

Created by dave. Last edited by dave, 3 years and 227 days ago. Viewed 1,185 times. #1
[edit] [rdf]
labels
attachments
(2020-08-04)

Watching For Changes In The Mac Forwarding Table

#!/bin/bash

touch .macwatch while [ -e .macwatch ] ; do sleep 10 NOW=`date '+%s'` echo $NOW for i in 251 252 253 ; do ~/findmac.pl -c public sg250-$i | egrep '08:5b:0e:43:29:7c|00:0c:29:eb:14:c8' > $NOW.ssg250-$i diff $NOW.ssg250-$i ref.ssg250-$i if [ $? == 0 ]; then rm $NOW.ssg250-$i fi done done

Notes:

  • obviously you need the findmac.pl script I've never released anywhere because I'm embarrassed by it.
  • this loops over a fragment of switch names; change to suit.
  • change the mac address(es) you want to watch accordingly.
  • ...and you'll have to set up the .ref files.
  • You can make the script stop by removing the .macwatch file.
no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt