Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We use ssh to connect to cisco switches through linux 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.

share|improve this question
Are you allowed to run nmap or other port scanning software? That would give you a list of devices which are connected to your network which you can then filter by MAC. (Cisco MACs: See ). Or use ZenMap (a GUI frontend) to do the same. – Hennes Apr 11 '13 at 5:04
yes i am allowed – munish Apr 11 '13 at 5:10
up vote 1 down vote accepted

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 and get the tarball.

Compile it and test it on a few known host (a few so initial tests are quick).

nmap -v (-v is verbose)

nmap (One way to scan a large range)

nmap (an other way to specify a range)

In your case you might want the flags s and n.

nmap -sn

Starting Nmap 5.51 ( ) at 2013-04-11 07:22 W. Europe Daylight Time
Nmap scan report for
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.

share|improve this answer

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):

 $ su -c 'nmap -PR -oN arp-scan.txt'


 $ grep '^[NM][Am]' arp-scan.txt
 Nmap scan report for tryggve.lan (
 MAC Address: 00:16:17:6D:AC:3A (MSI)
 Nmap scan report for
 MAC Address: 00:19:DB:F6:EB:B6 (Micro-star International CO.)
 Nmap scan report for deeebian.lan (

 $ awk '/MSI|Micro/ {print $3}' arp-scan.txt


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.

# ip neighbor
share|improve this answer
hi @Pax how can i use this ip neighbbor – munish Apr 11 '13 at 11:09
Install the equivalent package of sys-apps/iproute2 on your system, but nmap is the better option for this task. – Ярослав Рахматуллин Apr 11 '13 at 12:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .