Modificar Vlans Con SNMP
Modificar Vlans Con SNMP
Modificar Vlans Con SNMP
uction
This document describes how to create and delete VLANs on a Cisco Catalyst switch that uses Simple Network
Management Protocol (SNMP). It also describes how to add ports to a VLAN with SNMP.
Prerequisites
Requirements
Before you use the information in this document, ensure that you understand:
How the ifTable and ifIndexes work
How VLANs work on Cisco Catalyst switches
How to view VLAN information on Cisco Catalysts switches
The general use of SNMP get, set, and walk commands
Components
This document is for Catalyst switches that run regular Catalyst OS or Catalyst IOS that support the IF-MIB, CISCO-
VTP-MIB and CISCO-VLAN-MEMBERSHIP-MIB. The information in this document is based on these software and
hardware versions:
Catalyst 3524XL running CatIOS 12.0(5)WC5a
NET-SNMP version 5.0.6 available a www.net-snmp.org
The information presented in this document was created from devices in a specific lab environment. All of the devices
used in this document started with a cleared (default) configuration. If you are working in a live network, before you use
any command make sure that you understand the potential impact of any command.
Conventions
For more information on document conventions, see the Cisco Technical Conventions.
Background
1.3.6.1.4.1.9.9.46.1.3.1.1.2 (CISCO-VTP-MIB)
vtpVlanState OBJECT-TYPE
SYNTAX INTEGER { operational(1),
suspended(2),
mtuTooBigForDevice(3),
mtuTooBigForTrunk(4) }
MAX-ACCESS read-only
STATUS current
DESCRIPTION "The state of this VLAN.
1.3.6.1.4.1.9.9.46.1.4.1.1.1 (CISCO-VTP-MIB)
vtpVlanEditOperation OBJECT-TYPE
SYNTAX INTEGER { none(1),
copy(2),
apply(3),
release(4),
restartTimer(5)
}
MAX-ACCESS read-create
STATUS current
DESCRIPTION "This object always has the value 'none' when read.
When
written, each value causes the appropriate action:
1.3.6.1.4.1.9.9.46.1.4.1.1.3 (CISCO-VTP-MIB)
vtpVlanEditBufferOwner OBJECT-TYPE
SYNTAX OwnerString
MAX-ACCESS read-create
STATUS current
DESCRIPTION "The management station which is currently using the
Edit
Buffer for this management domain. When the Edit Buffer for
a management domain is not currently in use, the value of
this object is the zero-length string. Note that it is also
the zero-length string if a manager fails to set this object
when invoking a copy operation."
::= { vtpEditControlEntry 3 }
1.3.6.1.4.1.9.9.46.1.4.2.1.11 (CISCO-VTP-MIB)
vtpVlanEditRowStatus OBJECT-TYPE
SYNTAX RowStatus
1:active
2:notInService
3:notReady
4:createAndGo
5:createAndWait
6:destroy
MAX-ACCESS read-create
STATUS current
DESCRIPTION "The status of this row. Any and all columnar objects in
an
existing row can be modified irrespective of the status of
the row.
1.3.6.1.4.1.9.9.46.1.4.2.1.3.1.48 (CISCO-VTP-MIB)
vtpVlanEditType OBJECT-TYPE
SYNTAX VlanType
MAX-ACCESS read-create
STATUS current
DESCRIPTION "The type which this VLAN would have.
An implementation may restrict access to this object."
DEFVAL { ethernet }
::= { vtpVlanEditEntry 3 }
1.3.6.1.4.1.9.9.46.1.4.2.1.4.1.48 (CISCO-VTP-MIB)
vtpVlanEditName OBJECT-TYPE
SYNTAX DisplayString (SIZE (1..32))
MAX-ACCESS read-create
STATUS current
DESCRIPTION "The name which this VLAN would have. This name
would be
used as the ELAN-name for an ATM LAN-Emulation segment of
this VLAN.
1.3.6.1.4.1.9.9.46.1.4.1.1.2.1 (CISCO-VTP-MIB)
vtpVlanApplyStatus OBJECT-TYPE
SYNTAX INTEGER { inProgress(1),
succeeded(2),
configNumberError(3),
inconsistentEdit(4),
tooBig(5),
localNVStoreFail(6),
remoteNVStoreFail(7),
editBufferEmpty(8),
someOtherError(9)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION "The current status of an 'apply' operation to instanciate
the Edit Buffer as the new global VLAN information (for this
management domain). If no apply is currently active, the
status represented is that of the most recently completed
apply. The possible values are:
1.3.6.1.4.1.9.9.68.1.2.2.1.2 (CISCO-VLAN-MEMBERSHIP-MIB)
vmVlan OBJECT-TYPE
SYNTAX INTEGER(0..4095)
MAX-ACCESS read-write
STATUS current
DESCRIPTION "The VLAN id of the VLAN the port is assigned
to
when vmVlanType is set to static or dynamic.
This object is not instantiated if not applicable.
Step-by-Step Instructions
In the example shown below, VLAN 11 is added to the switch:
1. In order to check which VLANs are currently configured on the switch, issue an snmpwalk on
the vtpVlanState OID:
Note: The last number in the OID is the VLAN number.
3. The edition is not in use, so it is safe to start to edit. Set the vtpVlanEditOperation to the copy state (integer 2).
This allows you to create the VLAN.
4. In order to make the current owner of the edit permission visible, you can set the owner when you issue the
command, vtpVlanEditBufferOwner.
6. This example is VLAN 11 and shows you how to create a row and set the type and the name:
7. Set the vtpVlanEditDot10Said. This is the VLAN number + 100000 translated to hexadecimal. This example
creates VLAN 11, so the vtpVlanEditDot10Said should be: 11 + 100000 = 100011 -> Hex: 000186AB
8. When you have created VLAN 11, you must apply the modifications. Use the vtpVlanEditOperation OID again.
This time use the Apply to confirm the settings :
9. Verify that the VLAN was created successfully. Use the OID vtpVlanApplyStatus. Check the process until the
status reads: succeeded:
10. The last action is to commit the modifications and release the permissions so that other users can add, modify,
or delete VLANs from their NMS.
12. Verify that VLAN 11 was created on the switch with the CLI command show vlan or with an snmpwalk:
Note: Certain SNMP versions require you to use a (.) before the OID in the SNMP SET commands.
Step-by-Step Instructions
In this example VLAN 48 is deleted from the switch. Refer to the Add a VLAN to a Cisco Catalyst with SNMP for more
information. The difference between this section where you delete a VLAN and the one where you add a VLAN is that
you use the destroy instead of the CreateAndGo command for the vtpVlanEditRowStatus:
1. Issue the command to delete VLAN 48:
2. Since you know that port Fast Eth 0/5 has an ifIndex of 6, add the port to VLAN 48:
3. Verify that the port was correctly added by querying the same OID again.
crumpy#sh vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4,
Fa0/6, Fa0/7,
Fa0/8, Fa0/9,
Fa0/10, Fa0/11,
Fa0/12, Fa0/13,
Fa0/14, Fa0/15,
Fa0/16, Fa0/17,
Fa0/18, Fa0/19,
Fa0/20, Fa0/21,
Fa0/22, Fa0/23,
Fa0/24, Gi0/1,
Gi0/2
48 VLAN0048 active Fa0/5
2. Since you know that port Fast Eth 0/3 has an ifIndex of 4, you can verify to which VLAN the port currently
belongs:
crumpy#sh vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/4, Fa0/5,
Fa0/6, Fa0/7,
Fa0/8, Fa0/9,
Fa0/10, Fa0/11,
Fa0/12, Fa0/13,
Fa0/14, Fa0/15,
Fa0/16, Fa0/17,
Fa0/18, Fa0/19,
Fa0/20, Fa0/21,
Fa0/22, Fa0/23,
Fa0/24, Gi0/1,
Gi0/2
48 VLAN0048 active Fa0/3
crumpy#sh vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4,
Fa0/5, Fa0/6,
Fa0/7, Fa0/8,
Fa0/9, Fa0/10,
Fa0/11, Fa0/12,
Fa0/13, Fa0/14,
Fa0/15, Fa0/16,
Fa0/17, Fa0/18,
Fa0/19, Fa0/20,
Fa0/21, Fa0/22,
Fa0/23, Fa0/24,
Gi0/1, Gi0/2
48 VLAN0048 active
Note: You can make other changes, such as the VLAN name, the owner, and much more. Refer to the entire
MIB for more details on OID.