We use ssh to connect to cisco switches through linux box.it prompts for a password and then we are logged in.I was just wondering if i could find out a way to list out all the cisco switches connected to the linux machine.Approximately there are around 3000 switches that i can ssh to from the linux machine.
You did not specify which Linux distribution. If it is one with a package manager then add the nmap package. If it has no package manager or if you want to compile it yourself go to http://nmap.org and get the tarball.
Compile it and test it on a few known host (a few so initial tests are quick).
In your case you might want the flags
nmap -sn 192.168.1.252 Starting Nmap 5.51 ( http://nmap.org ) at 2013-04-11 07:22 W. Europe Daylight Time Nmap scan report for 192.168.1.252 Host is up (0.00s latency). MAC Address: 00:1E:E5:7A:47:5B (Cisco-Linksys) Nmap done: 1 IP address (1 host up) scanned in 0.39 seconds
Use these to scan your entire own network amdlog the results to a file. Then sort that on the brand name or MAC and you have your desired list.
Nmap supports arp-scan which would be effective in a LAN. Since all you need is the MAC, TCP port scan can be omitted. It's important to run nmap as the superuser (sudo works too):
You can also discover recently contacted MACs with ip(1), but then you would have to manually correlate the results with the mac-prefixes from /usr/share/nmap/nmap-mac-prefixes.