cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
35454
Views
13
Helpful
7
Replies

How to get IP address for the devices connected to a switch

JoLearns
Level 1
Level 1

                  

Hi All,

     Right now dot1dTpFdbPort(.1.3.6.1.2.1.17.4.3.1.2) OID is being used to find the mac address of the devices connected to a particular switch. It is being found out by passing the VLAN ID and dot1dTpFdbPort OID in the community string(A C# library sharpsnmp is used for this..). We get the list of Bridge port number connected to the switch from which we can get the associated ID which is MAC ID.

But in general, Is it possible to find the IP address of the devices connected to the switch in a similar manner?... Can specific OID be used for this purpose..

When we have the mac address we can use ARP method to get the device IP but then is it possible to get the IP address using OID?

Thanks in Advance.

1 Accepted Solution

Accepted Solutions

Michel Hegeraat
Level 7
Level 7

The switch does not know the IP of the connected device, since it is a layer 2 device. It only knows the mac address.

The default gateway of the connected device will be able to make the relation between the mac address and the IP address.

So on this device you can collect the ARP table via SNMP.

Cheers,

Michel

View solution in original post

7 Replies 7

Michel Hegeraat
Level 7
Level 7

The switch does not know the IP of the connected device, since it is a layer 2 device. It only knows the mac address.

The default gateway of the connected device will be able to make the relation between the mac address and the IP address.

So on this device you can collect the ARP table via SNMP.

Cheers,

Michel

Thank you Micheal Hegeraat. We'll try having the IP address retrived from the default gateway.

Damien Miller
VIP Alumni
VIP Alumni

Hello Joshua,


What model switch and which IOS is it running?  It is possible to see a listing of ip to mac to port associations if your switch is running ip device tracking.


You could attempt to use the "sh ip device tracking all" command however it may not be enabled or supported.

Indeed Damien,

C3750    IOS >= 12.2.52SE

And there is even a mib that could provide the interesting mac/IP details.

http://tools.cisco.com/Support/SNMP/do/BrowseMIB.do?local=en&step=2&mibName=CISCO-PAE-MIB

This might be kind of cutting edge, so careful for sharp edges and loose ends.  :-)

Cheers,

Michel

Thank you Damien Miller and Michel Hegeraat for your inputs.. seems like there is one more thread as well on this .. working on those inputs as well..

https://supportforums.cisco.com/thread/28369

Josh,

Getting the IP Address of devices connected to a Layer 2 switch has a new "twist".

Try this:

conf t

ip device tracking

interface range g1/0/1 - 24

ip device tracking max 10

end

---- Wait for approximately 10 seconds ----

sh ip device tracking max 10

-- or --

sh ip device tracking interface

Always learning something new :).

Works perfectly also in L2 switches - at least on 2960S switches with 15.0.2.SE.

Best regards

Isaac Alves

Review Cisco Networking for a $25 gift card