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

switchwalk

Created by dave. Last edited by dave, 9 years and 27 days ago. Viewed 2,115 times. #1
[edit] [rdf]
labels
attachments
(2015-03-04)

Example switchwalk script. This script takes the passed MAC address then feeds it to findmac.pl for each switch.

I wrap the "like-typed" switches together in a for-&-wait loop because otherwise you have to sit through each switch sequentially, which can get long.

#!/bin/bash

FINDMAC=~dave/projects/findmac.pl/findmac.pl

if [ -z "$1" ] ; then echo target? exit 1 fi echo Core $FINDMAC -c mycomm sa4-39 $1 & $FINDMAC -c mycomm sa4-38 $1 & wait echo Edge for i in sa1-41 sa2-39 sa3-37 sa3-41 sa4-42 sa5-41 sa6-41 sa7-41 sb5-41; do $FINDMAC -c mycomm $i $1 & done | sort | uniq wait echo Front for i in sa4-16 sa4-19 sa4-20 ; do $FINDMAC -c mycomm $i $1 & done | sort | uniq wait

Example output:

$ switchwalk 00:1C:23:65:B9:20
Core
sa4-38: port 6(ae5.0)
sa4-39: port 528(ge-0/0/15.0)
Edge
sa1-41: port 560(ge-0/0/47.0)
sa2-39: port 560
sa3-37: port 21(ae20.0)
sa3-41: port 560(ge-0/0/47.0)
sa4-42: port 27(Slot0/27)
sa5-41: port 560(ge-0/0/47.0)
sa6-41: port 560(ge-0/0/47.0)
sa7-41: port 560(ge-0/0/47.0)
sb5-41: port 1(ae0.0)
Front
sa4-16: port 24(g24)
sa4-19: port 23(g23)
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