#!/usr/bin/perl -w # # $Id: mac-port,v 1.1 2001-04-11 14:31:29 hjp Exp $ # # find the port of a baystack 350 T switch to which a given # mac address is connected. # use strict; sub usage { print STDERR "Usage: $0 switch mac-address\n"; exit(1); } if (@ARGV != 2) {usage();} my @hmac = split(/:/, $ARGV[1]); my $switch = $ARGV[0]; my @dmac = map { hex } @hmac; my $object = "17.4.3.1.2." . join(".", @dmac); system("snmpget", $switch, "public", $object); # $Log: mac-port,v $ # Revision 1.1 2001-04-11 14:31:29 hjp # mac-port: convert mac address to switch port using snmp. #