Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Since the wall jack is typically always connected to the same port on the switch I would like to be able to know which device is connected at a specific location. In my case I am talking about printers. I have code to go out on the network and find the IP Address of all of my printers, but would like to be able to update a server based on a printer being swapped out of a location for maintenance or repair. Is there a method for determining a port connection?

share|improve this question
    
Doesn't your switch give you that information? –  Nikolai N Fetissov May 26 '10 at 12:53
    
Only higher end switches give this information Nikolai. Knowing the switch manufacturer and model would help us answer the question. –  Chris S May 26 '10 at 13:26
    
I would like a generic solution as I would like to provide this for customers of our printers. We may need to focus on a few major switch providers as this does appear to be switch specific. –  banno May 26 '10 at 15:24
add comment

migrated from stackoverflow.com May 26 '10 at 12:57

This question came from our site for professional and enthusiast programmers.

3 Answers

To do this manually you would use arp to get a map of MACs to IPs, then use the switch's MAC (or bridge) table to get a map of ports to MACs. put the two tables together and you have a map of IPs to ports. Bump that up against your list of IPs->printers, and there you go - a list of printers and the ports their on.

Here's an example where I can cheat a little because it's an L3 switch - I can do the arp and mac steps from the same device. Say I want to find what port 172.19.1.6 is on:

tc-3750-1#sh arp | inc 172.19.1.6
Internet  172.19.1.6              6   0013.7269.075d  ARPA   Vlan2
Internet  172.19.1.68            23   0026.b931.ce28  ARPA   Vlan2
tc-3750-1#sh mac-
tc-3750-1#sh mac-address-table | inc 0013.7269.075d
   2    0013.7269.075d    STATIC      Gi2/0/3

et voila, 172.19.1.6 is on port g2/0/3. This is IOS, I think in Dell switches the MAC step is "show bridge" or something similar. This becomes harder when you have a multi-switch L2 network, but the principal is the same.

I don't have extensive experience, but it sounds like you might want to play with something like NetDisco, which offers what you're asking and also stuff like change control (as I understand it you could, for instance, track the port a MAC was connected to over time across multiple devices)

share|improve this answer
add comment

If it is a managed switch, you should be able to use SNMP to see the state of physical ports on a switch, if that is what you mean. Easier, would be to just ping the ip periodically.

share|improve this answer
add comment

you could use an application like nedi which can help you with documenting your network topology

http://www.nedi.ch/

share|improve this answer
    
+1 for mentioning NeDi. New to me. –  Henk Mar 16 '12 at 14:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.