1

I want to retrieve host's mac addressed which connected to cisco switch. And I see a lot of people say that "snmpbulkwalk -v2c -cpublic@vlan hostname BRIDGE-MIB::dot1dTpFdbTable" can get the host's mac address, but when I added the "@vlan" like "-c harvey@10". The command will return "Timeout: No response from XX.XX.XX.XX" my snmp config is "snmp-server community harvey RW". I don't know how they can get information and I can't.

1 Answer 1

3

Chances are that the given switch does not understand SNMP Community String Indexing and thus discards your SNMP request because of a "wrong" community string.

Still, your attempt at snmpwalk with an indexed snmp community string seems to be technically correct, according to the examples given at https://www.cisco.com/c/en/us/support/docs/ip/simple-network-management-protocol-snmp/40367-camsnmp40367.html. However, that document is almost 15 years old, and seems to refer to CatOS, and that very old networking software is rarely seen these days.

What kind of Cisco switch are you trying this with?

As an alternative, some suggest to define one SNMPv3 context per VLAN, and to submit SNMPv3 username, passwort and context when issuing the GET or WALK request:

https://community.cisco.com/t5/network-management/snmpv3-community-string-indexing/td-p/751936

Here is an example config that will give userv3 access to the default branch as well as contexts vlan-1 and vlan-100. See "show snmp context" for a list of all available contexts:

snmp-server group v3group v3 auth

snmp-server group v3group v3 auth context vlan-1

snmp-server group v3group v3 auth context vlan-100

snmp-server user userv3 groupv3 v3 auth md5 userv3pw123

Then you would specify the context name (e.g. vlan-1, vlan-100, etc.) along with the SNMPv3 username and password when querying the dot1dTpFdbTable objects in MG-Soft.

2
  • You're very smart. SNMP v3 does have such abilities, but after I configure "snmp-server group testv3group v3 auth context vlan- match prefix" or "snmp-server group testv3group v3 auth context vlan-30". I still got nothing from "show snmp context". But command like "snmp-server context test" can successfully show "test". I'm a network hobby, I don't have real switch, I use GNS3 and I tried on two images:"c3725-adventerprisek9-mz.124-25d.bin" and "viosl2-adventerprisek9-m.SSA.high_iron_20180619", I think maybe the problem comes from GNS3.
    – user65135
    Commented Feb 18, 2020 at 3:22
  • I found out if I use vlan1, can get mac info, it's a GNS3 issue, thanks brezular.com/2015/11/29/…
    – user65135
    Commented Feb 19, 2020 at 1:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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