Как удалить vlan на cisco

от admin

How To Add, Modify, and Remove VLANs on a Catalyst Using SNMP

The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.

Contents

Introduction

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 at http://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 Tips Conventions.

Background

Details of the MIB Variables—Including Object Identifiers (OIDs)

Add a VLAN to a Cisco Catalyst Switch With SNMP

Step-by-Step Instructions

In the example shown below, VLAN 11 is added to the switch:

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.

Verify if the edition is in use by another NMS station or device. The edition is not in use if you see this message: no MIB objects contained under subtree:

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.

In order to make the current owner of the edit permission visible, you can set the owner when you issue the command, vtpVlanEditBufferOwner.

This example shows how to verify that the table exists:

This example is VLAN 11 and shows you how to create a row and set the type and the name:

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

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 :

Verify that the VLAN was created successfully. Use the OID vtpVlanApplyStatus. Check the process until the status reads: succeeded:

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.

Verify that the buffer is empty:

Verify that VLAN 11 was created on the switch with the CLI command show vlan or with an snmpwalk:

Add a VLAN to a Cisco Catalyst Switch With SNMP

One Step Instructions

The one step process uses the OID numbers instead of the OID names like the previous step-by-step process. See the MIB details for translation. This example creates VLAN 6:

Note: Certain SNMP versions require you to use a (.) before the OID in the SNMP SET commands.

Delete a VLAN from a Cisco Catalyst Switch With SNMP

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:

Issue the command to delete VLAN 48:

To verify that VLAN 48 was deleted, use vtpVlanState or show vlan on the CLI:

Add a Port to a VLAN on a Cisco Catalyst Switch With SNMP

This example shows how to add a port Fast Ethernet 0/5 to VLAN 48.

To verify which ifIndex Fast Eth 0/5 has, issue an snmpwalk of ifDescr:

Since you know that port Fast Eth 0/5 has an ifIndex of 6, add the port to VLAN 48:

Verify that the port was correctly added by querying the same OID again.

You can also verify this on the switch:

How to Change a Port from One VLAN to Another VLAN

This example demonstrates how port Fast Eth 0/3 belongs to VLAN 48 and how to move it to VLAN 1 (default VLAN):

To verify which ifIndex Fast Eth 0/3 has, issue an snmpwalk of ifDescr:

Since you know that port Fast Eth 0/3 has an ifIndex of 4, you can verify to which VLAN the port currently belongs:

The port belongs to VLAN 48.

To move the port from VLAN 48 to VLAN 1, issue an snmpset of vmVlan.

To verify if the port was changed to the other VLAN, query vmVlan again:

You can also verify this on the switch itself :

Before the change:

After the change:

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.

Как удалить vlan на cisco

Примечание. Выходные данные команды, которые вы увидите, могут отличаться от выходных данных, которые содержатся в данном разделе. Эти различия зависят от модели используемого коммутатора.

Чтобы создать сеть VLAN, необходимо выполнить следующие действия:
1. Сначала необходимо решить, будет ли использоваться протокол VTP в вашей сети.
С помощью VTP можно централизованно изменять конфигурацию на одном коммутаторе, а затем автоматически применить внесенные изменения ко всем коммутаторам сети. По умолчанию на коммутаторах Catalyst 2900XL, 3500XL, 2950, 2970 и 2940 установлен серверный режим протокола VTP. Более подробно о протоколе VTP см. Общие сведения и настройка магистрального протокола VLAN (VTP).
Примечание: чтобы проверить статус протокола VTP на коммутаторах серии XL, воспользуйтесь командой show vtp status.

VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 254
Number of existing VLANs : 5
VTP Operating Mode : Server

!— Этот режим используется по умолчанию.

VTP Domain Name :
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xBF 0x86 0x94 0x45 0xFC 0xDF 0xB5 0x70
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00

2. После того как домен VTP был установлен и проверен, можно начать создание сетей VLAN на коммутаторе.
По умолчанию для всех портов существует только одна сеть VLAN. Такая сеть VLAN называется сетью по умолчанию. Сеть VLAN 1 не может быть переименована или удалена.
Чтобы получить информацию о сети VLAN, воспользуйтесь командой show vlan.

3524XL#show 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
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
—- —— ———- —— —— —— ——— —- ——— —— ——
1 enet 100001 1500 — — — — — 1002 1003
1002 fddi 101002 1500 — — — — — 1 1003
1003 tr 101003 1500 1005 0 — — srb 1 1002
1004 fdnet 101004 1500 — — 1 IBM — 0 0
1005 trnet 101005 1500 — — 1 IBM — 0 0

Чтобы создать другую сеть VLAN, в привилегированном режиме используйте набор команд:

!— Чтобы настроить виртуальную локальную сеть, необходимо войти в ее базу данных.

Device mode already VTP SERVER.

!— Эту команду можно пропустить, если серверный режим коммутатора уже
!— включен, и требуется именно это.

Примечание. Сеть VLAN может быть создана на коммутаторе только в том случае, если этот коммутатор работает в режиме сервера VTP или прозрачном режиме VTP. Более подробно о протоколе VTP см. Общие сведения и настройка магистрального протокола VLAN (VTP).

<1-1005> ISL VLAN index

are Maximum number of All Route Explorer hops for this VLAN
backupcrf Backup CRF mode of the VLAN
bridge Bridging characteristics of the VLAN
media Media type of the VLAN
mtu VLAN Maximum Transmission Unit
name Ascii name of the VLAN
parent ID number of the Parent VLAN of FDDI or Token Ring type VLANs
ring Ring number of FDDI or Token Ring type VLANs
said IEEE 802.10 SAID
state Operational state of the VLAN
ste Maximum number of Spanning Tree Explorer hops for this VLAN
stp Spanning tree characteristics of the VLAN
tb-vlan1 ID number of the first translational VLAN for this VLAN (or zero
if none)
tb-vlan2 ID number of the second translational VLAN for this VLAN (or zero
if none)

3524XL(vlan)#vlan 2 name ?

WORD The ASCII name for the VLAN

3524XL(vlan)#vlan 2 name cisco_vlan_2

VLAN 2 added:
Name: cisco_vlan_2

!— Необходимо выйти из базы данных виртуальной локальной сети,
!— чтобы изменения были применены.

APPLY completed.
Exiting.
3524XL#

Примечание. Режим VTP может измениться с клиентского на прозрачный в том случае, когда коммутатор попытается запомнить или передать количество сетей VLAN, превышающее количество, поддерживаемое данным коммутатором. Необходимо всегда проверять, чтобы коммутаторы, работающие в клиентском режиме, поддерживали то же количество сетей, которое передается коммутаторами в серверном режиме.

3. Чтобы убедиться в том, что сеть VLAN была создана, воспользуйтесь командой show 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
2 cisco_vlan_2 active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
—- —— ———- —— —— —— ——— —- ——— —— ——
1 enet 100001 1500 — — — — — 1002 1003
2 enet 100002 1500 — — — — — 0 0
1002 fddi 101002 1500 — — — — — 1 1003
1003 tr 101003 1500 1005 0 — — srb 1 1002
1004 fdnet 101004 1500 — — 1 IBM — 0 0
1005 trnet 101005 1500 — — 1

Читать:
Как записать градусы в excel

4. К вновь созданной сети VLAN можно добавить порты (интерфейсы).
Для каждого интерфейса, который нужно добавить в новую VLAN, необходимо перейти в режим настройки интерфейса. Эта услуга доступна в рамках ИТ-аутсорсинга от компании "Ветрикс"
Примечание. В случае коммутаторов Catalyst 2-го уровня серии XL порты могут быть назначены нескольким сетям VLAN, однако единовременно коммутаторы могут поддерживать только один интерфейс VLAN c активным управлением, в то время как другие коммутируемые виртуальные интерфейсы (SVI) остаются выключенными из-за функциональных особенностей уровня 2. Таким образом, коммутаторы поддерживают только один адрес 3-го уровня с активным управлением. Для того чтобы автоматически выключить сеть VLAN 1 и перевести IP-адрес на новую сеть VLAN, на коммутаторах Catalyst серии XL при работе под новым интерфейсом SVI можно воспользоваться дополнительной командой management.

Switch(config)#interface vlan 2

Switch#show ip interface brief
Interface IP-Address OK? Method Status Protocol
VLAN1 10.0.0.2 YES manual up down
VLAN2 20.0.0.2 YES manual up up
FastEthernet0/1 unassigned YES unset up up
FastEthernet0/2 unassigned YES unset up up

!— Выходные данные отключены.

Чтобы добавить соответствующий интерфейс к сети VLAN, в привилегированном режиме используйте набор команд:

Enter configuration commands, one per line. End with CNTL/Z.

3524XL(config)#interface fastethernet 0/2

vlan Set VLAN when interface is in access mode

3524XL(config-if)#switchport access vlan ?

<1-1001> VLAN ID of the VLAN when this port is in access mode
dynamic When in access mode, this interfaces VLAN is controlled by VMPS

3524XL(config-if)#switchport access vlan 2

!— Эти команды назначают интерфейс Fast Ethernet 0/2
!— на виртуальную локальную сеть 2.

3524XL(config)#interface fastethernet 0/3

3524XL(config-if)#switchport access vlan 2

!— Эти команды назначают интерфейс Fast Ethernet 0/3
!— на виртуальную локальную сеть 2.

3524XL#
00:55:26: %SYS-5-CONFIG_I: Configured from console by console

!— Эта команда сохраняет конфигурацию.

5. Чтобы проверить конфигурацию сети VLAN, воспользуйтесь командой show vlan.

VLAN Name Status Ports
—- ——————————— ——— ——————————-
1 default active Fa0/1, 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
2 cisco_vlan_2 active Fa0/2, Fa0/3
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
—- —— ———- —— —— —— ——— —- ——— —— ——
1 enet 100001 1500 — — — — — 1002 1003
2 enet 100002 1500 — — — — — 0 0
1002 fddi 101002 1500 — — — — — 1 1003
1003 tr 101003 1500 1005 0 — — srb 1 1002
1004 fdnet 101004 1500 — — 1 IBM — 0 0
1005 trnet 101005 1500 — — 1 IBM — 0 0

Удаление портов или сетей VLAN

Чтобы удалить порты из сети VLAN, в режиме настройки интерфейса используйте команду no switchport access vlan vlan_number. После удаления из сети VLAN (отличной от сети VLAN 1, которая является сетью заданной по умолчанию) этот порт будет автоматически добавлен в сеть VLAN, заданную по умолчанию.

Например, если требуется удалить интерфейс Fast Ethernet 0/2 из cisco_vlan_2 (VLAN 2), то в привилегированном режиме необходимо использовать такую последовательность команд:

Enter configuration commands, one per line. End with CNTL/Z.

3524XL(config)#interface fastethernet 0/2

3524XL(config-if)#no switchport access vlan 2

!— Эти две команды снимают интерфейс Fast Ethernet 0/2 с
!— виртуальной локальной сети 2.

!— Примечание. Интерфейс Fast Ethernet 0/2 назначается обратно
!— на виртуальную локальную сеть по умолчанию.

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
2 cisco_vlan_2 active Fa0/3
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
—- —— ———- —— —— —— ——— —- ——— —— ——
1 enet 100001 1500 — — — — — 1002 1003
2 enet 100002 1500 — — — — — 0 0
1002 fddi 101002 1500 — — — — — 1 1003
1003 tr 101003 1500 1005 0 — — srb 1 1002
1004 fdnet 101004 1500 — — 1 IBM — 0 0
1005 trnet 101005 1500 — — 1 IBM — 0 0

Чтобы удалить сеть VLAN, в режиме базы данных используйте команду no vlan vlan_number. Интерфейсы, относящиеся к удаляемой сети VLAN, остаются частью этой сети. Эти интерфейсы будут деактивированы, поскольку уже не принадлежат ни к одной сети VLAN. Если вы пользуетесь абонентским обслуживанем компьютеров от Ветрикса, то все указанные выше действия выполнят наши инженеры.

Например, если на коммутаторе необходимо удалить сеть cisco_vlan_2, в привилегированном режиме используйте следующий набор команд:

!— Эта команда позволяет перейти в режим базы данных
!— виртуальной локальной сети.

3524XL(vlan)#no vlan 2

!— Эта команда удаляет виртуальную локальную сеть из базы данных.

Deleting VLAN 2.

APPLY completed.
Exiting.

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
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active

!— Выходные данные отключены.

Обратите внимание на то, что порт Fast Ethernet 0/3 не отображен в выходных данных команды show vlan. При удалении сети VLAN 2 этот порт деактивируется. До тех пор, пока этот порт не будет добавлен в одну из имеющихся сетей VLAN, он не будет отображаться и его нельзя будет использовать.

3524XL#show interfaces fastethernet 0/3

FastEthernet0/3 is down, line protocol is down

!— Выходные данные отключены.

Для того чтобы интерфейсом можно было пользоваться, необходимо, чтобы он принадлежал к какой-нибудь сети VLAN. В примере, приводимом в настоящем разделе, показано, что для того чтобы можно было использовать интерфейс Fast Ethernet 0/3, его необходимо добавить в сеть VLAN по умолчанию (VLAN 1).

Если выходные данные команды show-tech support получен с устройства Cisco, то в этом случае для интерпретации результатов можно воспользоваться утилитой Output Interpreter (только для зарегистрированных пользователей). Данная утилита отображает потенциальные проблемы и предлагает способы их решения.

Примечание. В случае коммутаторов Catalyst 3550 интерфейс можно использовать, не добавляя его при этом в какую-либо сеть VLAN. Однако для этого его необходимо настроить как интерфейс 3-го уровня. Более подробно об интерфейсах 3-го уровня на коммутаторах Catalyst 3550 см. Настройка интерфейсов 3-го уровня в разделе Настройка параметров интерфейса.

How to Create and Delete VLAN on Cisco Catalyst Switch

One of the typical configuration activities you’ll perform on a Cisco Switch is to manipulate VLANs.

VLAN stands for Virtual Local Area Network.

In one physical cisco switch, you can create multiple VLANs that connects to different network.

For example, a VLAN for 10.10.191.0 network, a VLAN for 10.10.192.0 network, and a VLAN for 10.10.193.0 network. All three of these can be configured in the same physical switch.

While these commands were tested on a cisco catalyst switch 3750 series, similar commands (may be with slight variation to the port number format) should work on all cisco switches.

Create VLAN on Cisco Switch

If you are planning to have only one network in your whole switch (for example, 10.10.192.0). i.e All the ports in the switch will be connected to the 10.10.192.0 network, then you don’t need to create a VLAN, just use the default VLAN 1.

Every switch comes with the default VLAN 1 as shown below. In this example, all the ports in this switch ( from 1 through 8 ) are part of the default VLAN 1.

In the following example, we are creating 192 VLAN network (for 10.10.192.0 network). While creating a VLAN you also need to specify the range of ports from the switch that needs to be part of this VLAN network.

In this example, ports 3 through 6 are configured as part of 192 VLAN network.

In the above commands:

  • config t – Goes into the configuration mode
  • vlan 192 – Creates VLAN 192
  • interface range gigabitEthernet 1/0/3-6 – Indicates that the port numbers 3 through 6 are assigned to this VLAN
  • swithport access vlan 192 – Indicates that the access to the vlan 192 is enabled

Apart from providing the access to the vlan 192 for the port numbers 3 through 6, you can also specify the following additional switchport configuration parameters (for example, nonegotiate and mode access)

Once you’ve created a VLAN verify it as shown below,

On a side note, it is always recommended that you upgrade ISO image on your cisco switch to the latest version.

Delete VLAN on Cisco Switch

You might want to delete a VLAN, if you are planning to switch the ports assigned to VLAN 192 to a different VLAN. Or, you might want to delete a VLAN, just because you’ve created it by mistake.

Let us assume that you want to delete the VLAN 192 (ports 3 though 6) that you just created.

Deleting a VLAN is as simple as assigning the default VLAN 1 to the ports that are part of the VLAN you want to delete, and delete the VLAN.

i.e If you want to delete VLAN 192, assign VLAN 1 to the ports 3 through 6, and just delete the VLAN 192.

First, assign the default VLAN 1 to ports 3 though 6 as shown below.

Next, delete the vlan itself as shown below.

Finally, verify that the VLAN 192 got deleted as shown below.

As a final note, if you don’t know what you are doing, do not execute any of the above commands on production switch, as you might bring down your network. Do this only on a test system, where you can play around and learn how to manipulate VLANs on cisco switch.

Блог по сетевым технологиям и решениям

Рассмотрим наиболее распространенные действия с VLAN на коммутаторе — создание, удаление,выключение.
1. Создание VLAN.
Создать VLAN на коммутаторе Cisco можно 4 способами:
— через команду vlan в режиме конфигурации:

SWITCH1(config)#vlan 10
SWITCH1(config-vlan)#exit

-через конфигурацию базы данных VLAN
SWITCH1#vlan database
% Warning: It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated. Please consult user
documentation for configuring VTP/VLAN in config mode.


SWITCH1(vlan)#

Похожие статьи