понедельник, 11 ноября 2013 г.

Algoritm for get snmp mac=port

Get the Port Number on Which a MAC Address Has Been Learned

Step-by-Step Instructions

Complete the steps in this section in order to use SNMP to get the port number on which a MAC address has been learned. Consider that the port number is in VLAN1.
Note: In the commands in this section:
  • public is the read community string.
  • @1 is the VLAN 1 part of the read community string.
  • crumpy is the device host name.
    Note: You can also use the IP address for this host name.
Note: The Conclusion section uses the values that appear in italics in the command output.
  1. Retrieve the VLANs. Use the snmpwalk command on the vtpVlanState object (.1.3.6.1.4.1.9.9.46.1.3.1.1.2 ):
    %snmpwalk -c public crumpy .1.3.6.1.4.1.9.9.46.1.3.1.1.2
    CISCO-VTP-MIB::vtpVlanState.1.1 = INTEGER: operational(1)
    CISCO-VTP-MIB::vtpVlanState.1.3 = INTEGER: operational(1)
    CISCO-VTP-MIB::vtpVlanState.1.7 = INTEGER: operational(1)
    CISCO-VTP-MIB::vtpVlanState.1.10 = INTEGER: operational(1)
    ...
    Note: This command uses community string indexing. The command also uses vtpVlanState, which has OID.1.3.6.1.4.1.9.9.46.1.3.1.1.2. If you have loaded the MIBs to your network management system (NMS), you can use the object name instead of the OID. Issue this command instead:
    %snmpwalk -c public@1 crumpy vtpVlanState
    
    Note: You can also use the object names in steps 2 through 6.
  2. Issue this command in order to obtain the MAC address table by considering that the port belongs to VLAN1:
    snmpwalk -c public@1 crumpy .1.3.6.1.2.1.17.4.3.1.1
    
    17.4.3.1.1.0.0.12.7.172.8 =  Hex: 00 00 0C 07 AC 08
    17.4.3.1.1.0.1.2.27.80.145 =  Hex: 00 01 02 1B 50 91
    17.4.3.1.1.0.1.3.72.77.90 =  Hex: 00 01 03 48 4D 5A
    17.4.3.1.1.0.1.3.72.221.191 =  Hex: 00 01 03 48 DD BF
    ...
    Note: Provide the appropriate VLAN number after the community string. In this example, it is VLAN1.
    The command lists all MAC addresses that have been learned on all ports that belong to VLAN 1.
  3. Issue this command to determine the bridge port number for VLAN 1:
    snmpwalk -c public@1 crumpy .1.3.6.1.2.1.17.4.3.1.2 
    
    17.4.3.1.2.0.0.12.7.172.8 = 13
    17.4.3.1.2.0.1.2.27.80.128 = 13
    17.4.3.1.2.0.1.2.27.80.145 = 13
    17.4.3.1.2.0.1.2.163.145.225 = 13
    ...
    Note: VLAN 1 is dot1dTpFdbPort , or .1.3.6.1.2.1.17.4.3.1.2.
  4. Issue this command to map the bridge port to the ifIndex, OID .1.3.6.1.2.1.2.2.1.1:
    snmpwalk -c public@1 crumpy .1.3.6.1.2.1.17.1.4.1.2 
    
    17.1.4.1.2.13 = 2
    17.1.4.1.2.14 = 3
    17.1.4.1.2.15 = 4
    17.1.4.1.2.16 = 5
    This command queries the dot1dBasePortIfIndex, which has OID .1.3.6.1.2.1.17.1.4.1.2.
  5. Use the walk command with ifName in order to correlate the ifIndex value with a correct port name.
    Issue this command:
    Note: The ifName has OID .1.3.6.1.2.1.31.1.1.1.1.
    snmpwalk -c public@1 crumpy .1.3.6.1.2.1.31.1.1.1.1 
    
    ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.1 = VL1
    ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.2 = Fa0/1
    ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.3 = Fa0/2
    ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.4 = Fa0/3
    ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.5 = Fa0/4
    ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.6 = Fa0/5
    ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.7 = Fa0/6
    ...
  6. Link a MAC address to the port on which the address was learned.
    • From Step 1, the MAC address is:
      17.4.3.1.1.0.0.12.7.172.8 = Hex: 00 00 0C 07 AC 08
    • From Step 2, the bridge port tells that the MAC address belongs to bridge port number 13:
      17.4.3.1.2.0.0.12.7.172.8 = 13 
    • From Step 3, the bridge port number 13 has ifIndex number 2:
      17.1.4.1.2.13 = 2
    • From Step 4, the ifIndex 2 corresponds to port Fast Ethernet 0/1:
      ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.2 = Fa0/1

Conclusion

The MAC address 00 00 0C 07 AC 08 is learned on port Fa0/1.
Compare this conclusion with output from:
  • The show cam dynamic command for CatOS switches
  • The show mac command for Cisco IOS Software switches
Here is the sample output:
crumpy# show mac
Dynamic Address Count:                 58
Secure Address Count:                  2
Static Address (User-defined) Count:   0
System Self Address Count:             51
Total MAC addresses:                   111
Maximum MAC addresses:                 8192
Non-static Address Table:
Destination Address  Address Type  VLAN  Destination Port
-------------------  ------------  ----  -------------------

0000.0c07.ac08       Dynamic          1  FastEthernet0/1

0001.021b.5091       Dynamic          1  FastEthernet0/1
0001.0348.4d5a       Dynamic          1  FastEthernet0/1
0001.0348.ddbf       Dynamic          1  FastEthernet0/1
0001.972d.dfae       Dynamic          1  FastEthernet0/1
0002.55c6.cfe7       Dynamic          1  FastEthernet0/1
0002.7d61.d400       Dynamic          1  FastEthernet0/1
…


original: http://www.cisco.com/en/US/tech/tk648/tk362/technologies_tech_note09186a00801c9199.shtml 

среда, 6 ноября 2013 г.

Debian и удаление multiarch

1. Удалить все пакеты не нужной архитектуры:
    sudo apt-get remove --purge `dpkg --get-selections | grep i386 | awk '{print $1}'`
2. Удалить саму архитектуру
  dpkg --remove-architecture i386

В Ubuntu тоже самое!!!