0

I can get the switch status by using oid : .1.3.6.1.2.1.2.2.1.8

This displays all the ports with status up or down.

However, I want an oid to check the particular port, e.g. to check whether the 5th port is up or down.

Also, I want an oid to get the MAC Address & IP which is connected to a port, e.g. the MAC Address & IP of a PC which is connected to port 5.

Andy Hayden
  • 359,921
  • 101
  • 625
  • 535
Rohith
  • 1
  • 2
  • 1
    There is an answer on ServerFault that may help you: http://serverfault.com/questions/207768/dell-switch-6248-port-and-mac-mapping-using-snmp – raz3r Jun 06 '12 at 08:51

1 Answers1

0

The data about ports is stored in a MIB table. The table OID is .1.3.6.1.2.1.2.2.1, which means, that to get a specific piece of data you must query:

.1.3.6.1.2.1.2.2.1.X.Y

where X is the item index, and Y is the port index. For example the oid for the description of port 10101 is .1.3.6.1.2.1.2.2.1.2.10101:

$ snmpget -mall -v1 -c public <switch_ip> .1.3.6.1.2.1.2.2.1.2.10101    
IF-MIB::ifDescr.10101 = STRING: GigabitEthernet0/1

To get all the data in the ports table you can query it like this:

$ snmpwalk -mall -v1 -c public <switch_ip> .1.3.6.1.2.1.2.2.1

To get MAC addresses on a specific port you can query the FDB in BRIDGE-MIB:

$ snmpwalk -mall -v1 -c public <switch_ip> .1.3.6.1.2.1.17.4.3.1.2

Since switching on 2960 is mostly a layer 2 operation, there is no way to get the corresponding IP addresses, unless you set it up as router.

wroniasty
  • 7,884
  • 2
  • 32
  • 24
  • at wroniasty, i have tried `snmpwalk -mall -v1 -c public .1.3.6.1.2.1.17.4.3.1.2`, but still am not getting any results, please help me i have doubt that, where i am specifying my port no. ? – Rohith Jun 06 '12 at 08:54
  • are you replacing `` and `public` with the right values? are there any entries in the FDB on the switch? – wroniasty Jun 06 '12 at 09:26
  • yes, i am changing `` to my switch ip, i have entries like his `SNMPv2-SMI::mib-2.17.4.3.1.2.232.57.53.88.249.158 = INTEGER: 5` still more entries, i am running this query in Red Hat Terminal, – Rohith Jun 06 '12 at 09:44
  • this is the FDB, the last 6 numbers in the OID is the MAC, the `INTEGER: 5` is the port number where the MAC was last seen. – wroniasty Jun 06 '12 at 10:02
  • you mean to say `249.158` is the MAC ??? i have connected a PC to port 2,5,7 am getting the result only for the port 5, what about the rest....? – Rohith Jun 06 '12 at 10:32
  • `232.57.53.88.249.158` is actually `e8:39:35:58:f9:9e`. is there any traffic on ports 2,7? FDB entries usually timeout and are removed after a while of inactivity – wroniasty Jun 06 '12 at 10:41
  • i am using Cisco Catalyst 2960 Switch Series SI, there no traffic at all on ports 2,7 this system are not inactivity, i am using them..... i have swing front end, with a button, when a 1st button is clicked,i want to show a mac of a specific port, how to convert `232.57.53.88.249.158` to `e8:39:35:58:f9:9e`, such a way that when a button is clicked, `e8:39:35:58:f9:9e` is displayed......? – Rohith Jun 06 '12 at 10:48