"Steven Satelle (Service Desk)" <[EMAIL PROTECTED]> writes:

> What I would like to do is have each pc on boot, check which switch
> it is connected to. If it changes prompt the user for his new
> location. I've been looking into using snmp for this but all the
> stuff I've found needs to know hostname or ip address of the switch
> (I think, I dont really know much about Cisco). What I want is for
> the host to detect the switch change automatically, not have to
> manually tell it what switch it is on. Does anyone know if this is
> possible?          

As far as I know, this is not trivial.  The whole point of a switch is
to be transparent to network traffic.

What you can do is use SNMP to query the "forwarding database" (FDB)
of each switch.  The FDB on the switch maps Ethernet (MAC) addresses
to port numbers.  If you know which ports on each switch connect to
other switches, you can eventually locate the port which corresponds
to a particular MAC address.

The process would go like this:

  1) Determine your MAC address.

  2) Ping each "core" switch (i.e., those at the root of your
     topology) to guarantee your MAC address is in the FDB of each
     switch between yourself and the core.

  3) Use SNMP to query each "core" switch's FDB to learn where (i.e.,
     out which port) it forwards packets with your MAC address.  The
     table you want is the dot1dTpFdbTable; see
     http://www.faqs.org/rfcs/rfc1493.html and/or do a Google search.

  4) If that port goes to another switch, query that switch's FDB.
     Repeat until you find the leaf switch and port to where your
     packets are forwarded.

If you are interested in working by IP address instead of MAC address,
you need to use the ipNetToMediaTable (the ARP table, essentially);
see http://www.faqs.org/rfcs/rfc1213.html and/or do a Google search.

I wrote a Perl script to do all this a while ago, but it was very
messy and only ran on Linux, so it is not worth sharing.

Good luck!

 - Pat
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to