Deriving information from MAC address

Discussion in 'Hardware' started by trp, Apr 22, 2009.

  1. trp

    trp Private E-2

    I am trying to write a bit of code for a small website to make managing a small office network easier, they utilise a Cisco Catalyst 4506 switch for their distribution. Utilising some C code to interact with the switch I can obtain the connected MAC addresses of devices ('show mac-address') but it would be great if I could work out host names of client pc's from that somehow without a LOAD of manual data entry.

    So to clarify; what I want to be able to see is the MAC, the Hostname and the IP of a client pc.. anyone know of methods of doing this?

    (I had tried 'show arp' but that doesn't show the client PC's only the other network devices on the switch..)

    Thanks in advance.
     
  2. jconstan

    jconstan MajorGeek

    I am assuming these commands you are issuing with your c program are Cisco IOS commands to the switch? If so, I would imagine that the ARP command would need to be issued to each port of the switch. I'm sure one of the Cisco guru's could answer this.
     
  3. trp

    trp Private E-2

    I tried 'show arp' but it didn't show me client PC's only stuff in my management VLAN - other network devices such as the internet router and wireless stuff :(

    I had assumed if nothing else I could do a translation between MAC and IP / Hotsname under Windows but it appears I am utterly wrong on that front!
     
  4. jconstan

    jconstan MajorGeek

    That's what I was trying to say. You need to "direct" the SHOW ARP command to each VLAN not just the one you are connected to.
     
  5. trp

    trp Private E-2

    Ah ok, I see what you mean and agree. What I have discovered is that this access switch reports only the stuff on the management VLAN but the device handling the routing reports all of the MAC addresses on site under a 'show ip arp' command, I would say however that the access switch should still be aware of this information so it knows where to send packets.. thoughts or suggestions on how I can prompt this out of the access switch then?
     
  6. jconstan

    jconstan MajorGeek

    We'll probably need some Cisco tech help here. You see MAC addresses are utilized on the physical layer and not "reflected" to the routing level. Your switch is a level 3 switch and has "routing" capability and each VLAN acts like a little router. So, that said you need to effectively do an ARP command on each VLAN. I'm going out on a limb here, but perhaps a macro could be written for the switch that would gather the information and present it to your C program. Again, this is speculation on my part and someone with a more extensive knowledge of Cisco should be able to provide an answer.
     
  7. trp

    trp Private E-2

    OOOK, mite have found a workaround on this. 'sh ip dhcp snooping binding' shows me what I need to see for now and I can filter it by VLAN which is very helpful. I can then do the compare to the 'sh mac-address' results to find the port on which a device is connected, annoyingly Cisco use different formats for their results but I am sure I can work around this :)

    This method obviously relies on dhcp snooping being enabled.

    Thanks for your help with brainstorming on this!
     
  8. trp

    trp Private E-2

    Actually, just noticed (cmd.exe text wrapping meant I didn't see at first) that it tells you the port anyway, awesome!
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds