Querying Dynamic MAC Addresses on S Series Switches Through MIB
- Introduction
- Rules for Setting MIB Table Indexes
- Prerequisites
- Querying Dynamic MAC Address on S Series Switches Based on a VLAN ID
- Querying Dynamic MAC Address on S Series Switches Based on an Interface Name
- Querying Dynamic MAC Address on S Series Switches Based on a VLAN ID and an Interface Name
- Related Information
Introduction
This document describes how to use MIB to query dynamic MAC addresses learned by S series switches. This document uses the MIB browser as the NMS software to illustrate the operations. If you use other NMS software, refer to documentation of the specified software. Please download and install the MIB Browser tool yourself.
The operations described in this document are performed in the lab environment and apply to all versions of S series switches.
Rules for Setting MIB Table Indexes
hwDynMacAddrQueryTable in the Huawei-specific MIB HUAWEI-L2MAM-MIB allows users to query dynamic MAC address entries on switches based on specified conditions. The first 11 objects are table indexes, and the remaining objects specify information about a MAC address table in hwDynMacAddrQueryTable.
Table 1-1 describes the rules for setting the values in hwDynMacAddrQueryConditionMode.
hwDynMacAddrQueryConditionMode |
hwDynMacAddrQueryConditionStringA |
hwDynMacAddrQueryConditionStringB |
hwDynMacAddrQueryConditionDigitA |
hwDynMacAddrQueryConditionDigitB |
hwDynMacAddrQueryConditionDigitC |
---|---|---|---|---|---|
showall(1) |
- |
- |
- |
- |
- |
showbymac(2) |
- |
mac |
- |
- |
- |
showbymacvlan(3) |
- |
mac |
vlan |
- |
- |
showbytype(4) |
- |
type |
- |
- |
- |
showbytypevlan(5) |
- |
type |
vlan |
- |
- |
showbytypeport(6) |
- |
type |
- |
port |
- |
showbytypeportvlan(7) |
- |
type |
vlan |
port |
- |
showbyvlan(8) |
- |
- |
vlan |
- |
- |
showbyport(9) |
- |
- |
- |
port |
- |
showbyportvlan(10) |
- |
- |
vlan |
port |
- |
showbymacvsi(11) |
vsi |
mac |
- |
- |
- |
showbytypevsi(12) |
vsi |
type |
- |
- |
- |
showbytypeportvsi(13) |
vsi |
type |
- |
port |
- |
showbyvsi(14) |
vsi |
- |
- |
- |
- |
showbyportvsi(15) |
vsi |
- |
- |
port |
- |
showbyvsipw(16) |
vsi |
- |
peer |
pw-id |
- |
showbytypeslot(17) |
- |
type |
- |
- |
slot |
showbytypeslotsourceslot(18) |
- |
type |
- |
sourceslot |
slot |
showbytypeslotvlan(19) |
- |
type |
vlan |
- |
slot |
showbytypeslotport(20) |
- |
type |
- |
port |
slot |
showbytypeslotportvlan(21) |
- |
type |
vlan |
port |
slot |
showbytypeslotvsi(22) |
vsi |
type |
- |
- |
slot |
showbytypeslotportvsi(23) |
vsi |
type |
- |
- |
slot |
showbytypeslotvsipw(24) |
vsi |
type |
peer |
pw-id |
slot |
Prerequisites
- MIB Browser has been installed and the compiled HUAWEI-L2MAM-MIB file has been loaded.
- MIB Browser has been connected to an S series switch which uses SNMPv2c or SNMPv3.
- When MIB Browser is used to connect to an S series switch, Get Bulk parameters have been set according to Figure 1-1. Among the Get Bulk parameters, Non repeaters has been set to 0, and Max repetitions has been set to 1, indicating that one MAC address entry can be obtained in a Get Bulk operation. To query multiple MAC address entries at a time, set this parameter to a larger value. For example, to obtain 10 MAC address entries at a time, set Max repetitions to 10.
Querying Dynamic MAC Address on S Series Switches Based on a VLAN ID
- Right-click hwDynMacAddrQueryEntry and choose Multiple Variable Bindings > Prompt For Instance... from the shortcut menu, as shown in Figure 1-2.
- In the displayed dialog box, set the index for querying dynamic MAC address entries based on the VLAN ID 107, that is 0.1.48.1.48.0.0.0.0.0.0.0.8.1.48.1.48.107.0.0, as shown in Figure 1-3.
The following describes the index from the leftmost digit to the rightmost digit:
- 0: indicates the hwDynMacAddrQueryVlanId object, which is not used. The value is set to the default value 0 of the integer type.
- 1.48: indicates the hwDynMacAddrQueryVsiName object, which is not used. The value is set to the default value 0 of the character string type, which is expressed as 1.48 in the index. The value 1 indicates the length of the character string, and the value 48 indicates the ASCII code of the character string 0.
- 1.48: indicates the hwDynMacAddrQuerySiName object, which is not used. The value is set to the default value 0 of the character string type, which is expressed as 1.48 in the index. The value 1 indicates the length of the character string, and the value 48 indicates the ASCII code of character string 0.
- 0: indicates the hwDynMacAddrQueryBridgeId object, which is not used. The value is set to the default value 0 of the integer type.
- 0.0.0.0.0.0: indicates the hwDynMacAddrQueryMacAddr object, which is not used. The value is set to the default value 0 of the integer type.
- 8: indicates the hwDynMacAddrQueryConditionMode object. The value is set to 8, indicating showbyvlan.
- 1.48 indicates the hwDynMacAddrQueryConditionStringA object, which is not used. The value is set to the default value 0 of the character string type, which is expressed as 1.48 in the index. The value 1 indicates the length of the character string, and the value 48 indicates the ASCII code of character string 0.
- 1.48: indicates the hwDynMacAddrQueryConditionStringB object, which is not used. The value is set to the default value 0 of the character string type, which is expressed as 1.48 in the index. The value 1 indicates the length of the character string, and the value 48 indicates the ASCII code of character string 0.
- 107: indicates the hwDynMacAddrQueryConditionDigitA object. The value is set to 107, indicating VLAN 107.
- 0.0: indicates the hwDynMacAddrQueryConditionDigitB and hwDynMacAddrQueryConditionDigitC objects, respectively. They are not used and are set to the default value 0 of the integer type.
- Click OK. A query dialog box is displayed, as shown in Figure 1-4.
- Modify the objects in Figure 1-4 as follows:
- Change the operation from Get to Get Bulk.
- Delete the 11 index objects because they cannot be queried.
- Delete unnecessary objects. For example, if only the type and interface index of the MAC address table need to be queried, delete objects other than hwDynMacAddrQueryType and hwDynMacAddrQueryIfIndex in the dialog box.
The objects after modification are shown in Figure 1-5. - Click Get Bulk to query the dynamic MAC address entry with the VLAN ID 107. Figure 1-6 shows a dynamic MAC address entry. The VLAN ID of the dynamic MAC address entry is 107, the MAC address is 0.0.0.0.1.2 (0000-0000-0102), the type is dynamic, and the interface index is 4899.To obtain the interface name based on the interface index, see step 6.
The number of MAC address entries obtained each time by clicking Get Bulk is determined by the Max repetitions parameter. For details, see Figure 1-1.
Click Get Bulk multiple times to query all dynamic MAC entries with the VLAN ID 107. When information about other objects is displayed in the query result, the query of dynamic MAC address entries based on a VLAN ID is complete.
- Perform the following operations to obtain an interface name specified in a MAC address entry based on an interface index using ifTable in IF-MIB.
- Right-click ifDescr and choose Multiple Variable Bindings > Prompt For Instance... from the shortcut menu, as shown in Figure 1-7.
- In the displayed dialog box, set the interface index 4899, as shown in Figure 1-8.
- Click OK. A query dialog box is displayed, as shown in Figure 1-9.
- Click Get to query the interface name corresponding to the interface index 4899, as shown in Figure 1-10. According to the query result, the interface name corresponding to the interface index 4899 is GigabitEthernet1/0/12.
Querying Dynamic MAC Address on S Series Switches Based on an Interface Name
The procedure for querying dynamic MAC addresses learned by an S series switch based on an interface name is similar to that for querying dynamic MAC addresses learned by an S series switch based on a VLAN ID. You only need to change the index entered in step 2.
The following describes how to query the dynamic MAC addresses learned by GE1/0/12.
- Obtain the interface index corresponding to the interface according to ifTable in IF-MIB.Right-click ifDescr and choose Walk from the shortcut menu to obtain all interface names on a switch, as shown in Figure 1-11. The command output shows that the interface index of GE1/0/12 is 4899.
- Change the index value to be entered in step 2 based on the index format. The index for querying dynamic MAC address learned by GE1/0/12 is 0.1.48.1.48.0.0.0.0.0.0.0.9.1.48.1.48.0.4899.0. as shown in Figure 1-12.
The following describes the index from the leftmost digit to the rightmost digit:
- 0: indicates the hwDynMacAddrQueryVlanId object, which is not used. The value is set to the default value 0 of the integer type.
- 1.48: indicates the hwDynMacAddrQueryVsiName object, which is not used. The value is set to the default value 0 of the character string type, which is expressed as 1.48 in the index. The value 1 indicates the length of the character string, and the value 48 indicates the ASCII code of the character string 0.
- 1.48: indicates the hwDynMacAddrQuerySiName object, which is not used. The value is set to the default value 0 of the character string type, which is expressed as 1.48 in the index. The value 1 indicates the length of the character string, and the value 48 indicates the ASCII code of character string 0.
- 0: indicates the hwDynMacAddrQueryBridgeId object, which is not used. The value is set to the default value 0 of the integer type.
- 0.0.0.0.0.0: indicates the hwDynMacAddrQueryMacAddr object, which is not used. The value is set to the default value 0 of the integer type.
- 9: indicates the hwDynMacAddrQueryConditionMode object. The value is set to 9, indicating showbyport.
- 1.48 indicates the hwDynMacAddrQueryConditionStringA object, which is not used. The value is set to the default value 0 of the character string type, which is expressed as 1.48 in the index. The value 1 indicates the length of the character string, and the value 48 indicates the ASCII code of character string 0.
- 1.48: indicates the hwDynMacAddrQueryConditionStringB object, which is not used. The value is set to the default value 0 of the character string type, which is expressed as 1.48 in the index. The value 1 indicates the length of the character string, and the value 48 indicates the ASCII code of character string 0.
- 0: indicates the hwDynMacAddrQueryConditionDigitA object, which is not used. The value is set to the default value 0 of the integer type.
- 4899: indicates the hwDynMacAddrQueryConditionDigitB object. The value is set to 4899, indicating the interface index.
- 0: indicates the hwDynMacAddrQueryConditionDigitC object, which is not used. The value is set to the default value 0 of the integer type.
Querying Dynamic MAC Address on S Series Switches Based on a VLAN ID and an Interface Name
The procedure for querying dynamic MAC addresses learned by an S series switch based on a VLAN ID and an interface name is similar to that for querying dynamic MAC addresses learned by an S series switch based on a VLAN ID. You only need to change the index entered in step 2.
The following describes how to query dynamic MAC address entries learned by GE1/0/12 in VLAN 107.
- Obtain the interface index corresponding to the interface according to ifTable in IF-MIB.Right-click ifDescr and choose Walk from the shortcut menu to obtain all interface names on a switch, as shown in Figure 1-13. The command output shows that the interface index of GE1/0/12 is 4899.
- Change the index value to be entered in step 2 based on the index format. The index for querying dynamic MAC address entries learned by GE1/0/12 in VLAN 107 is 0.1.48.1.48.0.0.0.0.0.0.0.10.1.48.1.48.107.4899.0, as shown in Figure 1-14.
The following describes the index from the leftmost digit to the rightmost digit:
- 0: indicates the hwDynMacAddrQueryVlanId object, which is not used. The value is set to the default value 0 of the integer type.
- 1.48: indicates the hwDynMacAddrQueryVsiName object, which is not used. The value is set to the default value 0 of the character string type, which is expressed as 1.48 in the index. The value 1 indicates the length of the character string, and the value 48 indicates the ASCII code of the character string 0.
- 1.48: indicates the hwDynMacAddrQuerySiName object, which is not used. The value is set to the default value 0 of the character string type, which is expressed as 1.48 in the index. The value 1 indicates the length of the character string, and the value 48 indicates the ASCII code of character string 0.
- 0: indicates the hwDynMacAddrQueryBridgeId object, which is not used. The value is set to the default value 0 of the integer type.
- 0.0.0.0.0.0: indicates the hwDynMacAddrQueryMacAddr object, which is not used. The value is set to the default value 0 of the integer type.
- 10: indicates thehwDynMacAddrQueryConditionMode object. The value is set to 10, indicating showbyportvlan.
- 1.48 indicates the hwDynMacAddrQueryConditionStringA object, which is not used. The value is set to the default value 0 of the character string type, which is expressed as 1.48 in the index. The value 1 indicates the length of the character string, and the value 48 indicates the ASCII code of character string 0.
- 1.48: indicates the hwDynMacAddrQueryConditionStringB object, which is not used. The value is set to the default value 0 of the character string type, which is expressed as 1.48 in the index. The value 1 indicates the length of the character string, and the value 48 indicates the ASCII code of character string 0.
- 107: indicates the hwDynMacAddrQueryConditionDigitA object. The value is set to 107, indicating the VLAN ID.
- 4899: indicates the hwDynMacAddrQueryConditionDigitB object. The value is set to 4899, indicating the interface index.
- 0: indicates the hwDynMacAddrQueryConditionDigitC object, which is not used. The value is set to the default value 0 of the integer type.
- Introduction
- Rules for Setting MIB Table Indexes
- Prerequisites
- Querying Dynamic MAC Address on S Series Switches Based on a VLAN ID
- Querying Dynamic MAC Address on S Series Switches Based on an Interface Name
- Querying Dynamic MAC Address on S Series Switches Based on a VLAN ID and an Interface Name
- Related Information