Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

snmp - "get mac" OID

Can anyone please tell me how to find the OID that will give me the MAC address of a device connected to port (0-24)?

Thank you!

Sharon

1 ACCEPTED SOLUTION

Accepted Solutions
Bronze

Re: snmp - "get mac" OID

dot1dTpFdbEntry contains three entries and is indexed by dot1dTpFdbAddress.

dot1dTpFdbEntry OBJECT-TYPE

SYNTAX Dot1dTpFdbEntry

ACCESS not-accessible

STATUS mandatory

DESCRIPTION

"Information about a specific unicast MAC address

for which the bridge has some forwarding and/or

filtering information."

INDEX { dot1dTpFdbAddress } <--

::= { dot1dTpFdbTable 1 }

Dot1dTpFdbEntry ::=

SEQUENCE {

dot1dTpFdbAddress <--

MacAddress,

dot1dTpFdbPort <--

INTEGER,

dot1dTpFdbStatus <--

INTEGER

}

1) So you need to poll dot1dTpFdbPort to get the port index number.

nms-server2:/mibs> snmpwalk -c public@6 14.32.6.12 dot1dTpFdbPort

BRIDGE-MIB::dot1dTpFdbPort.0.1.66.69.224.255 = INTEGER: 2

BRIDGE-MIB::dot1dTpFdbPort.0.2.126.248.168.87 = INTEGER: 2

BRIDGE-MIB::dot1dTpFdbPort.0.2.185.144.76.102 = INTEGER: 385 <-- portIndex is 385

2) so port index is 385, what's the ifIndex for that port?

nms-server2:/mibs> snmpwalk -c public 14.32.6.12 dot1dBasePortIfIndex | grep 385

BRIDGE-MIB::dot1dBasePortIfIndex.385 = INTEGER: 101 <-- ah, ha, ifIndex is 101

3) now ifIndex is 101, what port is it?

nms-server2:/mibs> snmpwalk -c public 14.32.6.12 ifName | grep 101

IF-MIB::ifName.101 = STRING: 4/1 <-- it's port 4/1

4) verify from CLI

nms-6506a> (enable) show cam dynamic 4/1

* = Static Entry. + = Permanent Entry. # = System Entry. R = Router Entry.

X = Port Security Entry $ = Dot1x Security Entry

VLAN Dest MAC/Route Des [CoS] Destination Ports or VCs / [Protocol Type]

---- ------------------ ----- -------------------------------------------

6 00-02-b9-90-4c-66 4/1 [ALL]

<-- this mac matches 0.2.185.144.76.102

11 REPLIES
Bronze

Re: snmp - "get mac" OID

You need to poll dot1dTpFdbEntry (1.3.6.1.2.1.17.4.3.1.1) in BRIDGE-MIB

http://www.cisco.com/en/US/customer/products/sw/cscowork/ps563/products_tech_note09186a0080094949.shtml#mac

New Member

Re: snmp - "get mac" OID

Hi minie

I don’t have access to this page (yet….)

And I don’t have much knowledge in SNMP

I will be more then happy to get some more info on: dot1dTpFdbEntry

Do I need to send:

1.3.6.1.2.1.17.4.3.1.1

To get port 1 mac

And

1.3.6.1.2.1.17.4.3.1.n

To get port n mac ?

Thank you very much

Sharon .

New Member

Re: snmp - "get mac" OID

I was able to get the article from a friend,

The article describes problem finding MAC when using Cisco works or ANI ,

I am trying to write a piece of java code that will sample Cisco devices,

And I don’t know the correct OID to send , in order to receive the MAC from each port

Please advice.

Sharon.

Bronze

Re: snmp - "get mac" OID

As I mentioned earlier, the oid is 1.3.6.1.2.1.17.4.3.1.1, dot1dTpFdbAddress. To get more info on BRIDGE-MIB, you can either find the MIB.

ftp://ftp.cisco.com/pub/mibs/v2/

or use SNMP Object Navigator

http://www.cisco.com/go/mibs

New Member

Re: snmp - "get mac" OID

Hi minie

Thank you for the information,

I am able to receive the entire Mac addresses using 1.3.6.1.2.1.17.4.3.1.1, dot1dTpFdbAddress

My problem is how to attribute each Mac to its port.

I guess I have to dig in the mib file ...

Thank you.

Sharon

Bronze

Re: snmp - "get mac" OID

dot1dTpFdbEntry contains three entries and is indexed by dot1dTpFdbAddress.

dot1dTpFdbEntry OBJECT-TYPE

SYNTAX Dot1dTpFdbEntry

ACCESS not-accessible

STATUS mandatory

DESCRIPTION

"Information about a specific unicast MAC address

for which the bridge has some forwarding and/or

filtering information."

INDEX { dot1dTpFdbAddress } <--

::= { dot1dTpFdbTable 1 }

Dot1dTpFdbEntry ::=

SEQUENCE {

dot1dTpFdbAddress <--

MacAddress,

dot1dTpFdbPort <--

INTEGER,

dot1dTpFdbStatus <--

INTEGER

}

1) So you need to poll dot1dTpFdbPort to get the port index number.

nms-server2:/mibs> snmpwalk -c public@6 14.32.6.12 dot1dTpFdbPort

BRIDGE-MIB::dot1dTpFdbPort.0.1.66.69.224.255 = INTEGER: 2

BRIDGE-MIB::dot1dTpFdbPort.0.2.126.248.168.87 = INTEGER: 2

BRIDGE-MIB::dot1dTpFdbPort.0.2.185.144.76.102 = INTEGER: 385 <-- portIndex is 385

2) so port index is 385, what's the ifIndex for that port?

nms-server2:/mibs> snmpwalk -c public 14.32.6.12 dot1dBasePortIfIndex | grep 385

BRIDGE-MIB::dot1dBasePortIfIndex.385 = INTEGER: 101 <-- ah, ha, ifIndex is 101

3) now ifIndex is 101, what port is it?

nms-server2:/mibs> snmpwalk -c public 14.32.6.12 ifName | grep 101

IF-MIB::ifName.101 = STRING: 4/1 <-- it's port 4/1

4) verify from CLI

nms-6506a> (enable) show cam dynamic 4/1

* = Static Entry. + = Permanent Entry. # = System Entry. R = Router Entry.

X = Port Security Entry $ = Dot1x Security Entry

VLAN Dest MAC/Route Des [CoS] Destination Ports or VCs / [Protocol Type]

---- ------------------ ----- -------------------------------------------

6 00-02-b9-90-4c-66 4/1 [ALL]

<-- this mac matches 0.2.185.144.76.102

New Member

Re: snmp - "get mac" OID

Thank you very much minie

I will follow those steps today, and try to get the mac by port# .

I don't understand why is it so complicated

If I want to get :

Port description

Port speed

Port vlan

It's just sending single (OID + port# ) request and receiving back value

Simple as that

Thanks again

Sharon

New Member

Re: snmp - "get mac" OID

Hi

I am working in RT env , I'm trying to get the Mac as fast as I can

Is there anyway I can send SNMP command to the switch so it will refresh the dot1dTpFdbAddress table?

Thanks again

Sharon.

Bronze

Re: snmp - "get mac" OID

All the MIB objects are updated in real time. You can't "refresh" them.

New Member

Re: snmp - "get mac" OID

Hi minie

The problem started when the switch is sending a trap (link up), when a computer / Device is connecting to the network Through port n,

When the computer is connected I must do several things,

So I start by reading the Mac from port n , sometimes I am trying to read the Mac from: dot1dTpFdbAddress and I don’t receive it

But if I delay the execution a bit (1sec) I get a result (not always) …

I wonder how it can be possible.

The switch is sending a trap LINKUP trap before the dot1dTpFdbAddress is updated?!?!?!

Should I open new thread for this matter?

10x Thanks

Sharon

Bronze

Re: snmp - "get mac" OID

Sharon,

You have to keep in mind the spanning tree protocol. Linkup/linkdown trap is for layer 2 status. As soon as a device/host is connected to it, the trap will be sent. However, STP needs 30 seconds to go thru listening/learning/forwarding state, unless you configured "portfast" on that port.

Well, MIB objects supposed to be updated real time, but depending on implementation, I'm not surprised that it might be seconds delayed.

The bottom line is you can not "refresh" it. There's nothing you can do about it.

807
Views
5
Helpful
11
Replies