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?
feedback
|
migrated from stackoverflow.com May 26 '10 at 12:57
This question came from our site for professional and enthusiast programmers.
|
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:
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) | |||
|
feedback
|
|
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. | |||
|
feedback
|
|
you could use an application like nedi which can help you with documenting your network topology | |||
|
feedback
|