I have written a script to search for mac address on a cisco network – findmac 1.3b2
findmac is a utility written in Perl that helps administrators find out exactly which switch and which port a host is patched into. Only CISCO equipment with CDP enabled is currently supported. It is a very useful tool for administrators of large scale CISCO networks.
You can download it from here –
http://www.vicosys.com.hk/findmac/findmac.v13b2.tar.gz
# ./findmac.pl -h pigeon
Quote: |
findmac 1.0 by Terence Chan (26 Feb 2003)pigeon Mac Address is 08:00:20:A9:C3:E0 08:00:20:A9:C3:E0 is found on 172.16.188.155 port FastEthernet0/1 |
# ./findmac.pl -m 00-00-0c-07-ac-10
Quote: |
findmac 1.0 by Terence Chan (26 Feb 2003)This is a router. 00-00-0c-07-ac-10 is found on 172.16.2.1 port 3/1 |
#./findmac.pl -i -p -h pigeon
Quote: |
findmac.pl 1.3b by Terence Chan (6 March 2003)pigeon MAC Address is 08:00:20:A9:C3:E0 12F17.HF.SWT-A (172.16.2.1) port 3/6 => (172.16.188.155) sw-mcr-backbone-02 (172.16.188.155) port FastEthernet0/19 => (172.16.188.150) sw-mcr-backbone-01 (172.16.188.150) port FastEthernet0/1 => 08:00:20:A9:C3:E0 |
FAQ
Question:
1. Password has a $ character
2. –host option not working
3. Switch Prompt must end with ‘#’
Answer:
1. Password contains ‘$’ dollar sign character Escape the ‘$’ character with a \
eg $password=”!@#\$%^”;
2. –host option not working when using –host,
findmac will first use TCP ping to the host. I have noticed in some cases – host does not response to TCP ping.
You can change the $PINGPROT in the initParameters section from “tcp” to “icmp”.
Please note – Root privileges is required for ICMP ping.
3. Switch Prompt must end with ‘#’
Looks like it is a bug in Net-Telnet-Cisco. You will need to make sure the switch prompt end with # in order to have the script to work properly.
Bob,
Unforunately, the current version of FindMac does not allow the use of the username. This will be changed in the next version.
-=Terence=-