In a Win2K network, is there a windows cscript/wscript that can be run against my catalyst 3548XL switches that will tell me what PC is connected to which switch port? Either by IP address or by MAC address.
i.e. PC1 is connected to Switch1 port 3 or 192.168.0.1 -> INT 0/3 or something to that effect. I would like to create a report (maybe spreadsheet) with this info.
Thank for any and all help.
I have not seen one available. I have seen various snmp perl scripts that will pull from arp table's and mac-address-tables. But for this purpose I have not yet seen anything. A good way to map your ports is telnet to the switch, issue the command show mac-address-table int fa0/1 (or whatever port), next telnet to your router and issue the command "show arp | indluce 000a.8acd.0765" (or mac address returned by the previous command). You now have the IP address of the machine, issue the windows command prompt command "nbtstat -a X.X.X.X" and that will give you the machine name and logged on user. Now thats alot of work for many ports to map but you can grab the entire mac table, dump it in excel, pull the arp table, dump it in another excel and start stripping what you dont want. Than run the command. I have SoloarWinds and I dont believe it provides the functionality you want.
SolarWinds Switch Port Mapper works exactly the way you described.
But I've got an inverse problem:
Does anybody know a simple tool which would find a switch and port in my network to which a particular PC (IP address) is connected?
There is a nice L2trace CatOS command but it's not supported in IOS.
CiscoWorks provide UserTracking function but it's not satisfactory - doesn't provide the IP info. The only way I know is using Campus Manager Path Analysis but it's slow and not 100% reliable again.
I use an application called NetDisco which would provide the information you are looking for. Setting it up is not all that easy, but once it is up and running it works smoothly. www.netdisco.org
Cisco has a tool called CiscoWorksUserTrackingUtility1.0.exe look for it under Ciscoworks Campus Manager Patches.
This tool definitely runs on WinXP (all I've tried to run it on is XP Pro). It runs on your task bar and integrates with user tracking. Just enter the IP address you are looking for and it queries CW2K User Tracking database and returns lots of good information, such as IP address, MAC address, network of the device, plus the switch IP, Port, and vlan name.
I wrote an expect script to do, but it is very environment dependent. If you have a standard for the default gateway for a particular subnet, you can do it.
1. Take in the requested IP address, query the default gateway for that subnet for the ARP entry on the IP address to get the MAC address.
2. Go to the CDP neighboring switch to the router, and do a "show mac-address-table | in [MAC Address]" or "show cam [MAC Address]" or similar SNMP query to get the port the switch associated with that MAC addres.
3. Check to see if port is a neighboring switch. If so, repeat 2. If not, that is port the device is attached to.
I'd also apriciate to get a copy of this script.
I'm planning to write it myself for a long time, but still have not time enough to do it (I'm not a programmer anymore, so it would take me a long time, I'm afraid).
If I could just tune your script, it could save me a lot of time.
Thanks for the response. I have SolarWinds Engineers edition. It does not provide this kind of information. I was looking for a script that I could incorporate into a program to give me this info. If you ever run across anything like this, I'd would appreciate an email.
I am attaching the script. In order to use it, you need to do a few things.
1. Write a logon function that logs into a router or switch device and returns whether it is a catos or ios device (I just look at the prompt to tell). You should also have a logoff function, but you could probably get away with just a blank proc.
2. Set your domain list for DNS look ups.
3. On or around line 75, you have to figure out what the default gateway address is from the workstation IP. If you use /24s and your default gateway is .1 on every subnet, you can leave it as is.
It also requires the TCLLIB DNS package to handle hostnames. Good luck!