代码演示:
首先配置交换机的基本配置:
- en
- conf t
- no ip domain lo
- enable password chujie
- lin con 0
- password chujie
- exec-t 0 0
- logg syn
- exit
- line vty 0 4
- password chujie
- exec-t 0 0
- logg syn
- login
- exit
- host
- host SW1/SW2/SW3/SW4
其次,
配置SW1
1.关闭与此实验不相关的端口:
- SW1(config)# int ran fa0/9 -10 , fa 0/2 , fa0/6
- SW1(config-if-range)# shut
2.为接口f0/5 f0/1配置trunk链路。
- SW1(config)# int r fa0/1 , fa0/5
- SW1(config-if-range)#switchport trunk encapsulation dot1q
- SW1(config-if-range)#switchport mode trunk
- SW1(config-if-range)#no shutdown
3.为SW1配置VTP模式,此版本,只能在此模式下创建。
- SW1#vlan database
- SW1(vlan)#vtp server
- SW1(vlan)#vtp domain vtplabs
- SW1(vlan)#exit
在vlan database 下创建vlan .此版本的IOS。只能在此模式下创建。
- SW1#vlan database
- SW1(vlan)#vlan
- SW1(vlan)#vlan 20
- VLAN 20 added:
- Name: VLAN0020
- SW1(vlan)#vlan 10
- VLAN 10 added:
- Name: VLAN0010
- SW1(vlan)#exit
- APPLY completed.
- Exiting....
使用 show vtp status
- SW1#show vtp status
- VTP Version : 2
- Configuration Revision : 2
- Maximum VLANs supported locally : 256
- Number of existing VLANs : 8
- VTP Operating Mode : Server
- VTP Domain Name : vtplabs
- VTP Pruning Mode : Disabled
- VTP V2 Mode : Disabled
- VTP Traps Generation : Disabled
- MD5 digest : 0x94 0x76 0x54 0x32 0x40 0xAA 0xC2 0x1A
- Configuration last modified by 0.0.0.0 at 3-1-02 03:16:16
- Local updater ID is 0.0.0.0 (no valid interface found)
使用sho vlan-switch查看vlan的配置信息
- SW1#sho vlan-switch
- VLAN Name Status Ports
- ---- -------------------------------- --------- -------------------------------
- 1 default active Fa0/0, Fa0/1, Fa0/2, Fa0/3
- Fa0/4, Fa0/6, Fa0/7, Fa0/8
- Fa0/11, Fa0/12, Fa0/13, Fa0/14
- Fa0/15
- 10 VLAN0010 active Fa0/10
- 20 VLAN0020 active Fa0/9
- 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
- 10 enet 100010 1500 - - - - - 0 0
- 20 enet 100020 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
配置SW2,SW3,SW4,与此类似。
此文的主要目的,就是在演示,老版本与新版本vlan 和vtp的配置差异性的地方。
最后,送给大家一些总结的小常识。
- VTP默认是使能的。
- show vlan-switch
- show vtp status
- 使用VTP架构网络的时候学习不到VLAN配置信息的原因:
- 1.是不是domain配置错了 2. trunk起来了没有 3.?密码
- show interfaces trunk
转载于:https://blog.51cto.com/hongxi/1171757