vlan database cisco для чего
Выполняю установку, настройку, сопровождение серверов. Для уточнения деталей используйте форму обратной связи
Обновлена 15.01.2010
Первым делом объясню, зачем нужны вланы. Допустим, есть у вас одна сеть. Появилась вторая. Что делать? Докупать ещё один свич и ещё один сетевой интерфейс в ваш роутер? А если сети не одна, а сразу несколько? И в каждой по 1-5 компов? На помощь приходит понятие vlan. В одном физическом устройстве может содержаться несколько логических. Например, возмём Cisco Catalyst 2950 на 24 порта. В нём теоретически можно создать 256 (для более точного определения — смотрите таблицу ниже) vlan’ов. Есть ещё такое понятие, как trunk. Иногда можно встретиться термин «тегированный».
Транковый порт означает, что через этот порт могут передаваться несколько vlan’ов. Зачем это нужно? Например, у вас есть несколько свичей и нужно передать с одного свича пару вланов на другой. Порты, которыми соеденены будут свичи — должны быть в транке. И вообще, если порт передаёт больше одного влана — он всегда должен быть в trunk’e. Если запомнить это золотое правило, то проблем можно избежать в дальнейшем.
Важно заметить, что перед тем, как перевести порт в нужный влан, он должен существовать. Если перевести порт в несуществующий влан, результаты непредсказуемые. Например, на форумеciscolab.ru, один из пользователей рассказал о том, что если добавить в транк несуществующий влан, то свич уходит в даун. Вланы создаются через базу данных vlan’ов (вводится в конфигурационном режиме):
cisco#vlan database
cisco(vlan)#vlan №ВЛАНА
Там же можно и удалять вланы. Так же стоит запомнить, что новосозданные вланы появляются после того, как вы выйдете из vlan database с помощью команды exit:
cisco(vlan)#exit
APPLY completed.
Exiting.
Перевод порта в определённый влан осуществляется следующей командой (эта команда вводится в конфигурационном режиме, в настройках определённого порта):
cisco(config-if)switchport access vlan №ВЛАНА
Обычно перед этой командой выполняют ещё такую:
cisco(config-if)switchport mode access
Это даёт понять, что мы точно хотим использовать этот порт как обычный, а не как транковый. Эта команда не отображается в конфигурации свичей более ранних версий, таких как Cisco Catalyst 2900XL, но не вызывает ошибки, если её ввести.
Теперь рассмотрим вариант с транками.
Для переключения порта в режим транка используем следующую команду:
cisco(config-if)switchport mode trunk
Дальше нужно перечислить те вланы, которые мы хотим пропускать через этот транковый порт:
cisco(config-if)switchport trunk allowed vlan 101-107,110
Если в дальнейшем нужно будет пробросить ещё несколько вланов, то тут нужно быть внимательным, ибо для этого нужно будет после слова vlan в строке добавить ключевое слово add, иначе все существующие вланы на этом порту затрутся и останутся только вновь прописанные:
cisco(config-if)switchport trunk allowed vlan add 201,230
Если 2 свича связаны напрямую кабелем или оптикой то такая схема будет работать. Если вам нужно пробросить вланы через несколько свичей — эти вланы должны быть проброшены на каждом свиче, через который они пробрасываются. Это очень важно и часто возникают ошибки, потому что, на каком-то промежуточном свиче не существуют эти вланы.
Но что делать если у вас свичи находятся в разных концах города и связь между ними предоставляется через канал связи провайдера. Напомню, что здесь имеется ввиду не интернет соединение, а именно ТРАНСПОРТ от одного источника к другому. Для этих целей применяется инкапсуляция. Обычно применяют dot1q. Вланы, так сказать, инкапсулируются вланы и передаются как одно целое. Что бы включить инкапсуляцию на транковом порту выполняем следующее:
cisco(config-if)switchport trunk encapsulation dot1q
Это делается на всех транковых портах которые имеют соединение через чей-то транспорт, в том числе у провайдера. Я недавно сам столкнулся с тем, что нужно было пробросить вланы ещё и у провайдера (напомню, в данном контексте провайдер — это тот, кто предоставляет транспорт, а не интернет).
Напомню, что есть 2 вида соединения — оптика и канал (транспорт). Главное отличие в том, что оптика — это прямой участок между без какого-либо промежуточного оборудования, а транспорт — может проходить через оборудование не одного провайдера. Поэтому, если вам нужно пробросить вланы через оптику — вы просто прописываете их на обеих концах и всё. А если через транспорт — то их нужно прописать на каждом из оборудования провайдера (другими словами пробросить вланы на каждом из оборудовании).
Примечание.
Если вы пытаетесь перевести порт во vlan, который не существует, то последствия нельзя прудсмотреть. Например, у меня на Catalyst 2950 выдало такое:
epsilon-sw(config-if)#switchport access vlan 613
% Access VLAN does not exist. Creating vlan 613
Но! читал в инете, что у одного чела на 2960 циска ушла в даун. Будьте осторожны!
Работаем с vlan’ами : 8 комментариев
Не совсем понятна фраза
«нужно было пробросить вланы ещё и у провайдера».
Это что, пров должен знать о моих вланах?
Напомню, что есть 2 вида соединения — оптика и канал (транспорт). Главное отличие в том, что оптика — это прямой участок между без какого-либо промежуточного оборудования, а транспорт — может проходить через оборудование не одного провайдера. Поэтому, если вам нужно пробросить вланы через оптику — вы просто прописываете их на обеих концах и всё. А если через транспорт — то их нужно прописать на каждом из оборудования провайдера (другими словами пробросить вланы на каждом из оборудовании).
Так пров на это никогда не пойдет. На фиг ему наши заморочки?
У меня две удаленные конторы и связь через транспорт прова (не интернет). Все проплачено, все работает.
Но как только я организовала виланы пров сказал, что пропускать их не будет — платите еще денег.
Как это понять и что делать?
Либо вас не так поняли, либо вы не так поняли.
Я работал с несколькими провайдерами и все пробрасывали вланы нормально. Криминального здесь ничего нет. Почему провайдер не пойдёт на это? Приведите причины такого поведения? Это точно так же, как предоставлять интернет через свои маршрутизаторы.
Возможно ваш провайдер хочет взымать дополнительную плату за каждый новый проброшенный влан.
Насчет причин — я думаю, что всю череду свих коммутаторов ему нет смысла настраивать
на мои виланы. Или я ошибаюсь?
Есть какие то способы пробросить мои виланы без дополнительной платы?
Например GRE или Q-in-Q помогут мне?
Ошибаетесь, это такая же услуга, как и коллокейшин или выделенный канал — и всё равно приходится настраивать что-то на своём оборудовании.
Забудьте про GRE. Не всё оборудование умеет Q-in-Q (если умеет — то используйте Q-in-Q). В моём случае провайдер не имел такого оборудования.
«Например, возмём Cisco Catalyst 2950 на 24 порта. В нём теоретически можно создать 256 vlan’ов.» Но активно всего лишь 64 vlan’ов.
Manage vlan.dat file on Catalyst Switches Running Cisco IOS
Available Languages
Download Options
Contents
Introduction
Cisco Catalyst switches that run Cisco IOS ® software releases maintain the VLAN information in a special file named vlan.dat. This document discusses the purpose of this file, and ways to manage the file.
Prerequisites
Requirements
Cisco recommends that you have knowledge of this topic:
Understand how Cisco Catalyst switches work
Components Used
This document is not restricted to specific software and hardware versions.
The information in this document is based on these software and hardware versions:
Cisco Catalyst 6500 switch that runs Cisco IOS Software Release 12.1(26)E1
Cisco Catalyst 2950 switch that runs Cisco IOS Software Release 12.1(22)EA9
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, make sure that you understand the potential impact of any command.
Related Products
This document can also be used with these hardware and software versions:
Cisco Catalyst 6000, 4500, 4000 series switches that run Cisco IOS
Cisco Catalyst 3750, 3750E, 3560, 3560E, 3550, 2970, 2960, 2955, 2950, and 2940 series switches
Conventions
Refer to Cisco Technical Tips Conventions for more information on document conventions.
Background Information
VLAN or VTP configuration changes in CatOS are written to NVRAM immediately after a change is made. In contrast, Cisco IOS software does not save configuration changes to NVRAM unless you issue the copy run start command.
VTP client and server systems require VTP updates from other VTP servers to be immediately saved in NVRAM without user intervention. The VTP update requirements are met by the default CatOS operation, but the Cisco IOS software update model requires an alternative update operation. For this, a VLAN database was introduced to Cisco IOS software for Catalyst switches as a method to immediately save VTP updates for VTP clients and servers. This VLAN database is in the form of a separate file in NVRAM called the vlan.dat file.
Managing vlan.dat File
During Switch Bootup
During boot up, the switch compares the content in the vlan.dat file and the configuration in startup-config to determine if it should use the configuration in vlan.dat or startup-config. When you save VTP mode, domain name, and VLAN configurations in the switch startup configuration file and reboot the switch, the VTP and VLAN configurations are selected by these conditions:
If both the VLAN database and the configuration file show the VTP mode as transparent and the VTP domain names match, the VLAN database is ignored. The VTP and VLAN configurations in the startup configuration file are used. The VLAN database revision number remains unchanged in the VLAN database.
If the startup VTP mode is server mode, or the startup VTP mode or domain names do not match the VLAN database, VTP mode and VLAN configuration for the first 1005 VLANs are selected by VLAN database information, such as the vlan.dat file. VLANs greater than 1005 are configured from the switch configuration file.
If there is no vlan.dat file, or if the vlan.dat cannot be read, the switch boots with these characteristics:
Attribute | Default Values |
---|---|
VTP Mode | Server |
VTP Domain Name | (no name / empty) |
VLANs | 1, 1002-1005 |
Filename and Location
By default, the VLAN database file name is vlan.dat.
You can use the vtp file command to rename the file. You cannot use the vtp file command to load a new database. You can use it only to rename the file in which the existing database is stored.
This example shows how to specify the IFS file system file where the VTP configuration is stored:
The vlan.dat stored in NVRAM alone can be accessed by the switch. The vlan.dat file can be copied from its location for backup purposes. The memory location name where the vlan.dat file is stored varies from device to device. Refer to the respective product documentation before you issue the copy command.
In Cisco Catalyst 6500/6000 series switches, it is const_nvram:. Similarily for Catalyst 4500/4000 switches, it is cat4000_flash:. In Cisco Catalyst 29xx series and Cisco Catalyst 35xx, 3750 series, it is referred to as flash:.
Viewing VLAN Information
In order to display all the VLAN configurations, the VLAN ID, name, and so forth, that are stored in the binary vlan.dat file, you must issue the show vlan command.
You can display the VTP information, the mode, domain, and so forth, with use of the show vtp status command.
The VLAN information and the VTP information are not displayed in the show running-config command output when the switch is in the VTP server/client mode. This is normal behavior of the switch.
Switches that are in VTP transparent mode display the VLAN and VTP configurations in the show running-config command output because this information is also stored in the configuration text file.
Reset VLAN Information to Defaults
Complete this procedure to reset the VLAN configuration on a Cisco Catalyst switch that runs Cisco IOS software.
In this example, a Cisco Catalyst 6500 switch is in VTP client mode. In order to reset the VLAN information, you have to remove the vlan.dat file and reload the switch.
Issue the show vtp status and show vlan commands to determine the original VTP/VLAN information.
Verify the vlan.dat file status.
Note: The memory location where the vlan.dat file is stored varies from device to device. See the Filename and Location section in this document for more information.
Remove the vlan.dat file from NVRAM.
Note: Before you delete the file from NVRAM, it is recommended to make a backup of the file. See the Backup and Restore of vlan.dat File section for the procedure.
Note that the size of the vlan.dat file is zero (0).
After the switch boots up, verify if the VLAN information is set to default values. For information on the default values, see the table in the During Switch Bootup section.
At this point, the VTP VLAN configuration change can be triggered in two ways:
User configuration on the device (CLI/SNMP)
VTP update from other devices in the same VTP domain
This means that even if the switch was originally in client mode, simply applying another saved configuration does not set it back to client mode. In order to return the switch to client mode, the network administrator needs to manually configure the system with the vtp mode client command in global configuration mode.
Recovering vlan.dat File
If the vlan.dat file is deleted accidently and the switch gets reloaded, all the VLANs that were available on the switch are lost. Until the switch is reloaded, the VLAN information is present in the switch.
Complete these steps in order to recover the vlan.dat file:
Issue the show vlan command in order to confirm the availability of VLAN information.
If the switch is in VTP server or transparent mode, make any modifications to the VLAN database.
Modifications to the VLAN database can be any of these:
Modify the attributes of any existing VLAN.
If the switch is in VTP client mode, make modifications to the VLAN database at any VTP server of the same domain.
Once any change is done to the VLAN database, the switch automatically creates the vlan.dat file.
Issue the show flash: command in order to verify the creation of the vlan.dat file.
Note: The memory location where the vlan.dat file is stored varies from device to device. See the Filename and Location section for more information.
Backup and Restore of vlan.dat File
Network administrators might want to back up the vlan.dat file, especially for their VTP server systems. The vlan.dat file can be backed be saved to the same locations as any other file (bootflash, disk0:, bootdisk:, tftp:, ftp:, etc). Even though the file can be copied to any location, it can only be read from NVRAM.
In order to perform a complete backup of your configuration, include the vlan.dat file in the backup along with the configuration. Then, if the entire switch or the Supervisor Engine module requires replacement, the network administrator must upload both of these files in order to restore the complete configuration:
The configuration file
This also has an effect in dual supervisor environments when running Stateful Switchover (SSO). Because the file to file sync is only available for NVRAM, if the vlan.dat is in a non-NVRAM location such as bootflash:, there will not be vlan.dat file sync between the active and standby supervisors. Instead, when the standby SP receives the new VLAN data, it will write the config in standby vlan.dat.
Finally, if a saved vlan.dat is applied to a system that has already booted, the system must be reloaded before the newly applied vlan.dat configuration takes effect.
Issue the show vtp status and show vlan commands to determine the original VTP/VLAN information.
Verify the vlan.dat file status.
Note: The memory location where the vlan.dat file is stored varies from device to device. See the Filename and Location section for more information.
Back up the existing vlan.dat file.
Remove the vlan.dat file from NVRAM.
Verify the reset of VTP/VLAN information after reload.
Notice that the number of existing VLANs has dropped from 12 to 5, and the Domain is now empty instead of Cisco123.
Copy the saved vlan.dat file to the NVRAM.
Check if there is any change in the VTP status. There would not be any change, as the vlan.dat file is read only when the switch boots up. In order to bring the changes to effect, reload the switch.
Once the switch boots up, verify if the VLAN/VTP information has been properly restored.
Archiving vlan.dat Using Archive Management
The Archive Management application maintains an active archive of the vlan.dat file of devices managed by Resource Manager Essentials (RME). It enables you to perform these tasks:
Fetch, and archive, device configurations (which includes the vlan.dat file)
Search and generate reports on archived data
Compare and label configurations (which includes the vlan.dat file)
For more information on the Archive Management application, refer to Archiving Configurations and Managing Them Using Archive Management.
The RME suite is part of the CiscoWorks LAN Management Solution (LMS), one of the bundle in the CiscoWorks family of products. It is an Enterprise solution to network management. RME is a powerful suite of web-based applications offering network management solutions for Cisco switches, access servers, and routers.
For more information on RME and its applications, refer to Overview of RME.
VLAN Information and Redundancy
Supervisor engine redundancy does not support non-default VLAN data file names or locations. Do not enter the vtp file file_name command on a switch that has a redundant supervisor engine.
Before installing a redundant supervisor engine, enter the no vtp file command to return to the default configuration.
In Route Processor Redundancy (RPR+) redundancy, supervisor engine redundancy does not support configuration entered in VLAN database mode. Use global configuration mode with RPR+ redundancy.
Узелки на память
информация не бывает бессмысленной
12 мар. 2013 г.
Cisco 2960. Работаем с vlan’ами
cisco(config-if)switchport access vlan №ВЛАНА
cisco(config-if)switchport mode access
Это даёт понять, что мы точно хотим использовать этот порт как обычный, а не как транковый. Эта команда не отображается в конфигурации свичей более ранних версий, таких как Cisco Catalyst 2900XL, но не вызывает ошибки, если её ввести.
Теперь рассмотрим вариант с транками.
Для переключения порта в режим транка используем следующую команду:
cisco(config-if)switchport mode trunk
cisco(config-if)switchport trunk allowed vlan 101-107,110
cisco(config-if)switchport trunk allowed vlan add 201,230
Если 2 свича связаны напрямую кабелем или оптикой то такая схема будет работать. Если вам нужно пробросить вланы через несколько свичей – эти вланы должны быть проброшены на каждом свиче, через который они пробрасываются. Это очень важно и часто возникают ошибки, потому что, на каком-то промежуточном свиче не существуют эти вланы.
Но что делать если у вас свичи находятся в разных концах города и связь между ними предоставляется через канал связи провайдера. Напомню, что здесь имеется ввиду не интернет соединение, а именно ТРАНСПОРТ от одного источника к другому. Для этих целей применяется инкапсуляция. Обычно применяют dot1q. Вланы, так сказать, инкапсулируются вланы и передаются как одно целое. Что бы включить инкапсуляцию на транковом порту выполняем следующее:
cisco(config-if)switchport trunk encapsulation dot1q
Это делается на всех транковых портах которые имеют соединение через чей-то транспорт, в том числе у провайдера. Я недавно сам столкнулся с тем, что нужно было пробросить вланы ещё и у провайдера (напомню, в данном контексте провайдер – это тот, кто предоставляет транспорт, а не интернет).
Напомню, что есть 2 вида соединения – оптика и канал (транспорт). Главное отличие в том, что оптика – это прямой участок между без какого-либо промежуточного оборудования, а транспорт – может проходить через оборудование не одного провайдера. Поэтому, если вам нужно пробросить вланы через оптику – вы просто прописываете их на обеих концах и всё. А если через транспорт – то их нужно прописать на каждом из оборудования провайдера (другими словами пробросить вланы на каждом из оборудовании).
Настройка Cisco Catalyst-3560 (L3 switch):
1) Зададим IP – адрес коммутатору:
Switch(config)#interface vlan 1
Switch(config-if)#ip address 192.168.1.1 255.255.255.0
Switch(config-if)# no shutdown
Switch(config)#vlan 2
Switch(config-vlan)#name net2
Switch(config)#vlan 3
Switch(config-vlan)#name net3
Switch(config)#interface vlan 2
Switch(config-if)#ip address 192.168.2.1 255.255.255.0
Switch(config)#interface vlan 3
Switch(config-if)#ip address 192.168.3.1 255.255.255.0
Switch(config)#finterface fastEthernet 0/1
Switch(config-if)#switchport trunk encapsulation dot1q
7) Настроим DHCP-сервер (имеем 2 vlan-интерфейса, к которым привязаны разные подсети, нужно в каждую подсеть раздать адреса динамически с дефолтным маршрутом)
7.1) Исключаем адреса шлюзов из доступных адресов для раздачи:
Switch(config)#ip dhcp excluded-address 192.168.2.1
Switch(config)#ip dhcp excluded-address 192.168.3.1
Switch(config)#ip dhcp pool net2
Switch(dhcp-config)#network 192.168.2.0 255.255.255.0
Switch(dhcp-config)#default-router 192.168.2.1
Switch(config)#ip dhcp pool net3
Switch(dhcp-config)#network 192.168.3.0 255.255.255.0
Switch(dhcp-config)#default-router 192.168.3.1
Настройка Cisco Catalyst-2960 (L2 switch):
1) Зададим IP – адрес коммутатору:
Switch(config)#interface vlan 1
Switch(config-if)#ip address 192.168.1.2 255.255.255.0
Switch(config-if)# no shutdown
Switch(config)#ip default-gateway 192.168.1.1
Switch(config)#vlan 2
Switch(config-vlan)#name net2
Switch(config)#vlan 3
Switch(config-vlan)#name net3
Switch(config)#interface range fastEthernet 0/2-10
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 2
Switch(config)#interface range fastEthernet 0/11-20
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 3
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport mode trunk