此产品的文档集力求使用非歧视性语言。在本文档集中,非歧视性语言是指不隐含针对年龄、残障、性别、种族身份、族群身份、性取向、社会经济地位和交叉性的歧视的语言。由于产品软件的用户界面中使用的硬编码语言、基于 RFP 文档使用的语言或引用的第三方产品使用的语言,文档中可能无法确保完全使用非歧视性语言。 深入了解思科如何使用包容性语言。
思科采用人工翻译与机器翻译相结合的方式将此文档翻译成不同语言,希望全球的用户都能通过各自的语言得到支持性的内容。 请注意:即使是最好的机器翻译,其准确度也不及专业翻译人员的水平。 Cisco Systems, Inc. 对于翻译的准确性不承担任何责任,并建议您总是参考英文原始文档(已提供链接)。
查看 VLAN 信息
本文档介绍Catalyst交换机如何维护特别计划中的VLAN信息。 vlan.dat
文件.
Cisco 建议您了解以下主题:
Cisco Catalyst 交换机
本文档中的信息基于以下软件和硬件版本:
运行Cisco IOS®软件版本12.1(26)E1的Cisco Catalyst 6500交换机
运行 Cisco IOS 软件版本 12.1(22)EA9 的 Cisco Catalyst 2950 交换机
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。
本文档也可用于以下硬件和软件版本:
运行 Cisco IOS 的 Cisco Catalyst 6000、4500、4000 系列交换机.
Cisco Catalyst 3750、3750E、3560、3560E、3550、2970、2960、2955、2950和2940系列交换机。
有关文档规则的详细信息,请参阅 Cisco 技术提示规则。
运行Cisco IOS软件版本的Cisco Catalyst交换机在名为vlan.dat的特殊文件中维护VLAN信息。 本文档讨论此文件的用途以及管理此文件的方式。
在 CatOS 中进行 VLAN 或 VTP 配置更改后,这些更改将会立即写入 NVRAM。相反,除非发出 copy run start 命令,否则 Cisco IOS 软件不会将配置更改保存到 NVRAM。
VTP 客户端和服务器系统要求在没有用户干预的情况下,立即将来自其他 VTP 服务器的 VTP 更新保存到 NVRAM 中。默认 CatOS 操作符合 VTP 更新要求,但是 Cisco IOS 软件更新模型要求不同的更新操作。为此,VLAN 数据库作为立即保存 VTP 客户端和服务器的 VTP 更新的方法,被引入了 Catalyst 交换机的 Cisco IOS 软件。此 VLAN 数据库在 NVRAM 中以称为 vlan.dat 文件的单独文件形式存在。
在启动过程中,交换机将vlan.dat文件中的内容与startup-config中的配置进行比较,以确定它是否必须使用vlan.dat或startup-config中的配置。在您将 VTP 模式、域名和 VLAN 配置保存到交换机启动配置文件中并重新启动交换机时,将按照以下条件选择 VTP 和 VLAN 配置:
如果 VLAN 数据库和配置文件将 VTP 模式显示为透明且 VTP 域名匹配,则将忽略 VLAN 数据库。启动配置文件中的 VTP 和 VLAN 配置会予以使用。VLAN 数据库修订版号在 VLAN 数据库中保持不变。
如果启动 VTP 模式是服务器模式,或者启动 VTP 模式或域名与 VLAN 数据库不匹配,则前 1005 个 VLAN 的 VTP 模式和 VLAN 配置会按照 VLAN 数据库信息(例如 vlan.dat 文件)选择。ID 号大于 1005 的 VLAN 使用交换机配置文件配置。
如果没有 vlan.dat 文件或者无法读取 vlan.dat,交换机将使用以下属性启动:
属性 | 默认值 |
---|---|
VTP 模式 | 服务器 |
vtp domain name | (无名称/为空) |
VLAN | 1、1002-1005 |
默认情况下,VLAN数据库文件名是 vlan.dat
.
您可以使用 vtp file
命令重命名文件。您不能使用 vtp file
命令加载新数据库。您只能使用该命令重命名存储现有数据库的文件。
此示例显示如何指定存储 VTP 配置的 IFS 文件系统文件:
Switch(config)#vtp file vtpconfig
Setting device to store VLAN database at filename vtpconfig.
Switch(config)#
交换机可以访问单独存储在 NVRAM 中的 vlan.dat。可以处于备份目的从其所在位置复制 vlan.dat 文件。各设备上存储 vlan.dat 文件的存储位置名称有所不同。在发出TFTP服务器之前,请参阅相应的产品文档 copy
命令。
在Cisco Catalyst 6500/6000系列交换机中, const_nvram:
.类似于Catalyst 4500/4000交换机, cat4000_flash:
. 在Cisco Catalyst 29xx系列和Cisco Catalyst 35xx、3750系列中,它称为flash:。
Cat6K-Cisco IOS#dir const_nvram:
Directory of const_nvram:/ 1 -rwx 856 <no date> vlan.dat 129004 bytes total (128148 bytes free)
要显示存储在二进制vlan.dat文件中的所有VLAN配置、VLAN ID、名称等,您必须发出 show vlan
命令。
您可以使用VTP信息、模式、域等 show vtp status
命令。
VLAN信息和VTP信息不显示在 show running-config
命令输出。这是正常的交换机行为。
Switch#show run | include vlan vlan internal allocation policy ascending Switch# Switch#show run | include vtp Switch#
处于VTP透明模式的交换机显示中的VLAN和VTP配置 show running-config
命令输出,因为此信息也存储在配置文本文件中。
Switch#show run | include vlan vlan internal allocation policy ascending vlan 1 tb-vlan1 1002 tb-vlan2 1003 vlan 20-21,50-51 vlan 1002 tb-vlan1 1 tb-vlan2 1003 vlan 1003 tb-vlan1 1 tb-vlan2 1002 vlan 1004 vlan 1005 Switch#show run | include vtp vtp domain cisco vtp mode transparent
完成此过程可重置运行 Cisco IOS 软件的 Cisco Catalyst 交换机上的 VLAN 配置。
在本示例中,Cisco Catalyst 6500 交换机处于 VTP 客户端模式。必须删除 vlan.dat 文件并重新加载交换机才能重置 VLAN 信息。
发出 show vtp status
和 show vlan
命令来确定原始VTP/VLAN信息。
Cat6K-IOS#show vtp status VTP Version : 2 Configuration Revision : 0 Maximum VLANs supported locally : 1005 Number of existing VLANs : 12 VTP Operating Mode : Client VTP Domain Name : Cisco123 VTP Pruning Mode : Enabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0xDF 0xCE 0x47 0x0B 0xD0 0x3F 0xEA 0x18 Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00 Local updater ID is 172.16.5.12 on interface Vl1 (lowest numbered VLAN interface found) Cat6K-IOS#
Cat6K-IOS#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa3/11, Fa3/16 5 VLAN0005 active Fa3/1 10 VLAN0010 active Fa3/5 20 Management_Vlan active Fa3/7, Fa3/9, Fa3/24 30 SW-3_PCs_Vlan active 40 SW-1_PCs_Vlan active 50 IP_Phone_Voice_Vlan active 60 Guest_Fail_Vlan active 1002 fddi-default act/unsup 1003 token-ring-default act/unsup 1004 fddinet-default act/unsup 1005 trnet-default act/unsup VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 1 enet 100001 1500 - - - - - 0 0 5 enet 100005 1500 - - - - - 0 0 10 enet 100010 1500 - - - - - 0 0 !--- Rest of the output elided.
验证 vlan.dat 文件状态。
Cat6K-IOS#dir const_nvram: Directory of const_nvram:/ 1 -rw- 976 <no date> vlan.dat 129004 bytes total (128028 bytes free) Cat6K-IOS#
注:存储vlan.dat文件的内存位置因设备而异。有关详细信息,请参阅本文档中的文件名和位置 部分。
从 NVRAM 中删除 vlan.dat 文件。
注:从NVRAM中删除文件之前,建议备份该文件。有关操作过程,请参阅备份和恢复 vlan.dat 文件 部分。
Cat6K-IOS#delete const_nvram:vlan.dat
Delete filename [vlan.dat]?
Delete const_nvram:vlan.dat? [confirm]
Cat6K-IOS#dir const_nvram:
Directory of const_nvram:/
1 -rw- 0 <no date> vlan.dat
129004 bytes total (129004 bytes free)
Cat6K-IOS#
请注意,vlan.dat 文件的大小为零 (0)。
重新加载交换机。
Cat6K-IOS#reload Proceed with reload? [confirm] !--- Rest of the output no displayed.
在交换机启动后,请验证 VLAN 信息是否设置为默认值。有关默认值的信息,请参阅在交换机启动期间 部分中的表。
Cat6K-IOS#show vtp status VTP Version : 2 Configuration Revision : 0 Maximum VLANs supported locally : 1005 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 : 0x57 0xCD 0x40 0x65 0x63 0x59 0x47 0xBD Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00 Local updater ID is 172.16.5.12 on interface Vl1 (lowest numbered VLAN interface found)
Cat6K-IOS#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa3/11, Fa3/16 1002 fddi-default act/unsup 1003 token-ring-default act/unsup 1004 fddinet-default act/unsup 1005 trnet-default act/unsup VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 1 enet 100001 1500 - - - - - 0 0 1002 fddi 101002 1500 - - - - - 0 0 1003 tr 101003 1500 - - - - - 0 0 1004 fdnet 101004 1500 - - - ieee - 0 0 1005 trnet 101005 1500 - - - ibm - 0 0 Remote SPAN VLANs ------------------------------------------------------------------------------ Primary Secondary Type Ports ------- --------- ----------------- ------------------------------------------ Cat6K-IOS#
Cat6K-IOS#dir const_nvram: Directory of const_nvram:/ 1 -rw- 0 <no date> vlan.dat 129004 bytes total (129004 bytes free) Cat6K-IOS#
此时,可以通过两种方式触发 VTP VLAN 配置更改:
设备 (CLI/SNMP) 上的用户配置
同一 VTP 域中其他设备中的 VTP 更新
这意味着,即使交换机最初处于客户端模式,只应用其他保存的配置不会将其设置回客户端模式。为了将交换机返回到客户端模式,网络管理员需要在全局配置模式下使用 vtp mode client 命令手动配置系统。
如果 vlan.dat 文件被意外删除,且交换机进行了重新加载,则交换机上的所有可用 VLAN 将会丢失。在交换机重新加载之前,VLAN 信息一直存在于交换机上。
完成下列步骤以恢复 vlan.dat 文件:
发出 show vlan 命令以确认 VLAN 信息的可用性。
Switch#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/10, Fa0/11, Fa0/12, Gi0/1 Gi0/2 10 VLAN0010 active 11 VLAN0011 active 20 VLAN0020 active 21 VLAN0021 active 30 VLAN0030 active 31 VLAN0031 active 40 VLAN0040 active 41 VLAN0041 active 50 Vlan50 active 100 100thVLAN active
如果交换机处于 VTP 服务器或透明模式,则可以对 VLAN 数据库进行任意修改。
可以对 VLAN 数据库进行以下任意修改:
创建任意 VLAN。
删除任意 VLAN。
修改现有任何 VLAN 的属性。
如果交换机处于 VTP 客户端模式,则可以在同一域内的任意 VTP 服务器上对 VLAN 数据库进行修改。
Switch#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#vlan 50 Switch(config-vlan)#name 50thVLAN Switch(config-vlan)#end Switch#
对 VLAN 数据库进行任何更改后,交换机会自动创建 vlan.dat 文件。
发出show flash:命令以验证是否创建了vlan.dat文件。
Switch#show flash: Directory of flash:/ 2 -rwx 5 Mar 01 1993 00:04:47 private-config.text 3 -rwx 2980487 Mar 02 1993 06:08:14 c2950-i6q4l2-mz.121-19.EA1a.bin 4 -rwx 1156 Mar 01 1993 01:51:27 vlan.dat 16 -rwx 1014 Mar 01 1993 00:04:47 config.text 6 drwx 4096 Mar 02 1993 03:49:26 html 7 -rwx 3121383 Mar 02 1993 03:47:52 c2950-i6q4l2-mz.121-22.EA9.bin 7741440 bytes total (65536 bytes free)
注:存储vlan.dat文件的内存位置因设备而异。有关详细信息,请参阅文件名和位置 部分。
要备份vlan.dat文件的网络管理员,尤其是对于VTP服务器系统。此 vlan.dat
可以将该文件与任何其他文件(bootflash、disk0:、bootdisk:、tftp:、ftp:等)保存在相同的位置。虽然可以将文件复制到任何位置,但是只能从 NVRAM 中读取文件。
要对配置执行完全备份,需要将 vlan.dat 文件与配置一起包含在备份中。之后,如果整个交换机或 Supervisor 引擎模块需要更换,网络管理员必须上载以下两个文件才能恢复完整配置:
此 vlan.dat
文件
配置文件
这在运行 Stateful Switchover (SSO) 的双重 Supervisor 环境中也会产生影响。由于文件到文件同步仅可用于NVRAM,因此,如果vlan.dat位于非NVRAM位置(例如bootflash:),则主用和备用管理引擎之间不能进行vlan.dat文件同步。相反,当备用SP收到新的VLAN数据时,它可以将配置写入备用vlan.dat。
最后,如果保存的 vlan.dat 应用于已启动的系统,则必须重新加载系统才能使新应用的 vlan.dat 配置生效。
发出 show vtp status 和 show vlan 命令以确定原始 VTP/VLAN 信息。
Cat6K-IOS#show vtp status VTP Version : 2 Configuration Revision : 0 Maximum VLANs supported locally : 1005 Number of existing VLANs : 12 VTP Operating Mode : Client VTP Domain Name : Cisco123 VTP Pruning Mode : Enabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0xDF 0xCE 0x47 0x0B 0xD0 0x3F 0xEA 0x18 Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00 Local updater ID is 172.16.5.12 on interface Vl1 (lowest numbered VLAN interface found) Cat6K-IOS# Cat6K-IOS#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa3/11, Fa3/16 5 VLAN0005 active Fa3/1 10 VLAN0010 active Fa3/5 20 Management_Vlan active Fa3/7, Fa3/9, Fa3/24 30 SW-3_PCs_Vlan active 40 SW-1_PCs_Vlan active 50 IP_Phone_Voice_Vlan active 60 Guest_Fail_Vlan active 1002 fddi-default act/unsup 1003 token-ring-default act/unsup 1004 fddinet-default act/unsup 1005 trnet-default act/unsup VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 1 enet 100001 1500 - - - - - 0 0 5 enet 100005 1500 - - - - - 0 0 10 enet 100010 1500 - - - - - 0 0 !--- Rest of the output elided.
验证 vlan.dat 文件状态。
Cat6K-IOS#dir const_nvram: Directory of const_nvram:/ 1 -rw- 976 <no date> vlan.dat 129004 bytes total (128028 bytes free) Cat6K-IOS#
注:存储vlan.dat文件的内存位置因设备而异。有关详细信息,请参阅文件名和位置 部分。
备份现有的 vlan.dat 文件。
Cat6K-IOS#copy const_nvram:vlan.dat bootflash:vlan.dat Destination filename [vlan.dat]? 976 bytes copied in 0.516 secs (1891 bytes/sec) Cat6K-IOS#show bootflash: -#- ED ----type---- --crc--- -seek-- nlen -length- ---------date/time--------- n ame 1 .. image C32839CA 2349AC 30 1788204 May 31 2006 18:15:50 +00:00 c 6msfc2-boot-mz.121-13.E17.bin 2 .. unknown 1D1450E8 234DFC 8 976 Dec 01 2008 01:43:18 +00:00 v lan.dat 13414916 bytes available (1789436 bytes used)
从 NVRAM 中删除 vlan.dat 文件。
Cat6K-IOS#delete const_nvram:vlan.dat
Delete filename [vlan.dat]?
Delete const_nvram:vlan.dat? [confirm]
Cat6K-IOS#dir const_nvram:
Directory of const_nvram:/
1 -rw- 0 <no date> vlan.dat
129004 bytes total (129004 bytes free)
Cat6K-IOS#
重新加载交换机。
Cat6K-IOS#reload Proceed with reload? [confirm] !--- Rest of the output elided.
重新加载后,验证是否已重置 VTP/VLAN 信息。
Cat6K-IOS#show vtp status VTP Version : 2 Configuration Revision : 0 Maximum VLANs supported locally : 1005 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 : 0x57 0xCD 0x40 0x65 0x63 0x59 0x47 0xBD Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00 Local updater ID is 172.16.5.12 on interface Vl1 (lowest numbered VLAN interface found)
请注意,现有 VLAN 的数量已从 12 降低到 5,且 Domain 现在为空而不是 Cisco123。
Cat6K-IOS#dir const_nvram: Directory of const_nvram:/ 1 -rw- 0 <no date> vlan.dat 129004 bytes total (129004 bytes free) Cat6K-IOS#
将已保存的 vlan.dat 文件复制到 NVRAM。
Cat6K-IOS#copy bootflash:vlan.dat const_nvram:vlan.dat Destination filename [vlan.dat]? 976 bytes copied in 0.688 secs (1419 bytes/sec) Cat6K-IOS# Cat6K-IOS#dir const_nvram: Directory of const_nvram:/ 1 -rw- 976 <no date> vlan.dat 129004 bytes total (128028 bytes free) Cat6K-IOS#
检查 VTP 状态中是否有任何更改。应不存在任何更改,因为仅当在交换机启动时才读取 vlan.dat 文件。要使更改生效,请重新加载交换机。
Cat6K-IOS#show vtp status VTP Version : 2 Configuration Revision : 0 Maximum VLANs supported locally : 1005 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 : 0x57 0xCD 0x40 0x65 0x63 0x59 0x47 0xBD Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00 Local updater ID is 172.16.5.12 on interface Vl1 (lowest numbered VLAN interface found) Cat6K-IOS#
重新加载交换机。
Cat6K-IOS#reload Proceed with reload? [confirm] !--- Rest of the output elided.
交换机启动后,验证 VLAN/VTP 信息是否已正常恢复。
Cat6K-IOS#show vtp status VTP Version : 2 Configuration Revision : 0 Maximum VLANs supported locally : 1005 Number of existing VLANs : 12 VTP Operating Mode : Server VTP Domain Name : Cisco123 VTP Pruning Mode : Enabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0xDF 0xCE 0x47 0x0B 0xD0 0x3F 0xEA 0x18 Configuration last modified by 172.16.5.12 at 11-16-07 03:23:56 Local updater ID is 172.16.5.12 on interface Vl1 (lowest numbered VLAN interface found) Cat6K-IOS#
Cat6K-IOS#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa3/11, Fa3/16 5 VLAN0005 active Fa3/1 10 VLAN0010 active Fa3/5 20 Management_Vlan active Fa3/7, Fa3/9, Fa3/24 30 SW-3_PCs_Vlan active 40 SW-1_PCs_Vlan active 50 IP_Phone_Voice_Vlan active 60 Guest_Fail_Vlan active 1002 fddi-default act/unsup 1003 token-ring-default act/unsup 1004 fddinet-default act/unsup 1005 trnet-default act/unsup VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 1 enet 100001 1500 - - - - - 0 0 5 enet 100005 1500 - - - - - 0 0 10 enet 100010 1500 - - - - - 0 0 20 enet 100020 1500 - - - - - 0 0 !--- Rest of the the output not shown.
Archive Management 应用程序可维护受 Resource Manager Essentials (RME) 管理的设备的 vlan.dat 文件的活动档案。利用该应用程序您可以执行以下任务:
提取和归档设备配置(包含 vlan.dat 文件)
搜索归档数据并对其生成报告
比较并标记配置(包含 vlan.dat 文件)
有关 Archive Management 应用程序的详细信息,请参阅使用 Archive Management 归档和管理配置。
RME 套件是 CiscoWorks LAN Management Solution (LMS) 的一部分,后者是 CiscoWorks 系列产品的一个捆绑组件。它是用于进行网络管理的企业解决方案。RME 是一个功能强大的基于 Web 的应用程序套件,用于为 Cisco 交换机、接入服务器和路由器提供网络管理解决方案。
有关RME及其应用的详细信息,请参阅RME Essentials。
Supervisor 引擎冗余不支持非默认 VLAN 数据文件名或位置。请勿在具有冗余 Supervisor 引擎的交换机上输入 vtp file file_name 命令。
在安装冗余 Supervisor 引擎之前,请输入 no vtp file 命令以返回默认配置。
在 Route Processor Redundancy (RPR+) 冗余中,Supervisor 引擎冗余不支持在 VLAN 数据库模式下输入的配置。将全局配置模式与 RPR+ 冗余结合使用。
在SSO中,从活动SP到备用SP的NVRAM vlan.dat文件同步仍然完成,因此,如果在VLAN记录同步过程中发生切换,备用可以通过从NVRAM加载二进制文件来恢复。由于文件到文件同步仅可用于NVRAM,因此,如果二进制文件位于非NVRAM位置(例如bootflash:),则主用和备用之间不能进行vtp二进制配置文件同步。事实上,如果vlan.dat不在NVRAM中,则在备用启动期间,备用Supervisor无法联机。必须在活动Supervisor上显示错误消息,以要求用户将vlan.dat位置更改为NVRAM。
版本 | 发布日期 | 备注 |
---|---|---|
2.0 |
29-Jun-2023 |
重新认证 |
1.0 |
19-Dec-2008 |
初始版本 |