views:

155

answers:

6

I wanted to know if we could find out what type of switch our machine is directly connected to ..

For instance if I am connected to a Cisco,Brocade,foundry and Force10 switch .

  1. Is it possible to write a perl script to find out the management address of the switch [without logging in]
  2. Is it possible to write a perl script to find out the switch vendor and model number ...

Thanks for your suggestions.

EDIT: Wanted to add that I am directly connected to the switch .. I can disable the firewall on my machine ...

A: 

Not really. In the modern world of firewalled, packet-modifying, NATed subnetworks, you really can't do anything reliably to inspect a network from a client machine.

That said, trying nmap on your router might tell you something interesting. Or it might not. The results are entirely up to the admins of your network.

Andy Ross
+2  A: 

nmap is what you want. If that doesn't do it, the answer is probably "no". If you need the IP address of the switch, run traceroute/tracert to see what the next hop is.

Dean J
A: 

You can ping it to get its Ethernet address, and then look it up in one of the vendor code lists.

Zed
If you are using Perl, you can use my Net::MAC::Vendor module to look up the OUI. That only tells you the vendor however, which might not be the same as the log on the outside.
brian d foy
A: 

follow the wire

gtx
+1  A: 

There is no guaranteed way of being able to achieve this. It depends very much on how your switch has been configured and how open your network admins have made it.

If everything is completely open then the best way of finding out the type of switch is to use snmp. The net-snmp library for perl (see docs here) is a good place to start. But that assumes that the management interface is exposed to your box.

There is no guarantee that it will be.

If it is then nmap (as suggested by others) may work. At least it might tell you if the management interface is accessible at which point you can use snmp to tell you the rest. Traceroute might yield some more information, but only if the address used for it's routing is the same as the management address. (and assuming that your "switch" is really a "router". If not then this won't yield any useful information.)

ping might yield some information about the manufacturer, but only if it hasn't been configured to proxy-arp.

Andrew Edgecombe
+1  A: 

On Cisco switchs if CDP is activated you should be able to see CDP traffic on your wire which will indicate switch model, name and switch port you are connected to.

Don't know for other brands.

snip