配置举例:
SW1(f1/1)--------(f1/1)SW3
(f1/4)
SW1的配置:
SW1#sh run int f1/1
Building configuration...
Current configuration : 71 bytes
!
interface FastEthernet1/1
end
SW1#sh run int f1/4
Building configuration...
Current configuration : 71 bytes
!
interface FastEthernet1/4
end
SW1#sh vlan bri
VLAN Name
---- -------------------------------- --------- -------------------------------
1
10
20
30
1002 fddi-default
1003 token-ring-default
1004 fddinet-default
1005 trnet-default
SW1#sh vtp st
VTP Version
Configuration Revision
Maximum VLANs supported locally : 256
Number of existing VLANs
VTP Operating Mode
VTP Domain Name
VTP Pruning Mode
VTP V2 Mode
VTP Traps Generation
MD5 digest
Configuration last modified by 0.0.0.0 at 3-1-02 00:03:49
Local updater ID is 0.0.0.0 (no valid interface found)
SW2的配置:
SW2#sh run int f1/5
Building configuration...
Current configuration : 71 bytes
!
interface FastEthernet1/5
end
SW2#sh vtp st
VTP Version
Configuration Revision
Maximum VLANs supported locally : 256
Number of existing VLANs
VTP Operating Mode
VTP Domain Name
VTP Pruning Mode
VTP V2 Mode
VTP Traps Generation
MD5 digest
Configuration last modified by 0.0.0.0 at 3-1-02 00:03:49
SW2#sh vlan-s bri
VLAN Name
---- -------------------------------- --------- -------------------------------
1
10
20
30
1002 fddi-default
1003 token-ring-default
1004 fddinet-default
1005 trnet-default
SW3的配置:
VLAN Name
---- -------------------------------- --------- -------------------------------
1
1002 fddi-default
1003 token-ring-default
1004 fddinet-default
1005 trnet-default
SW3#sh run int f1/1
Building configuration...
Current configuration : 71 bytes
!
interface FastEthernet1/1
end
SW3#sh vtp st
VTP Version
Configuration Revision
Maximum VLANs supported locally : 256
Number of existing VLANs
VTP Operating Mode
VTP Domain Name
VTP Pruning Mode
VTP V2 Mode
VTP Traps Generation
MD5 digest
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00
<VTP Pruning>
·VTP修剪能够确定Trunk何时正在扩散不必要的流量。并将其VLAN修剪掉。
在Server端配置,其他SW会学习到。
SW1的配置:
SW1(vlan)#vtp pruning
Pruning switched ON
SW1(vlan)#exi
APPLY completed.
Exiting....
SW1#sh vtp st
VTP Version
Configuration Revision
Maximum VLANs supported locally : 256
Number of existing VLANs
VTP Operating Mode
VTP Domain Name
VTP Pruning Mode
VTP V2 Mode
VTP Traps Generation
MD5 digest
Configuration last modified by 0.0.0.0 at 3-1-02 00:15:42
Local updater ID is 0.0.0.0 (no valid interface found)
看一看SW2情况:
SW2#sh vtp st
VTP Version
Configuration Revision
Maximum VLANs supported locally : 256
Number of existing VLANs
VTP Operating Mode
VTP Domain Name
VTP Pruning Mode
VTP V2 Mode
VTP Traps Generation
MD5 digest
Configuration last modified by 0.0.0.0 at 3-1-02 00:15:42
·VTP版本:(V1/V2/V3)
默认是V1。Cisco 建议一个域中版本一致。
Sw1(config)#vtp version 2
Sw3#vlan database
Sw3(vlan)#vtp v2-mode
·VTP认证:
Sw2(config)#vtp password aaa
Sw3#vlan database
Sw3(vlan)#vtp password aaa
如何检查密码相同/不同:
Sw2#show vtp password
SWITCH常用配置命令
Sw1#show cdp neighbors detail
Show mac-address-table
Show mac-address-table aging-time
Sw1(config)#mac-address-table aging-time 150
创建VLAN
Sw1(config)#vlan 10
Sw1(config)#name sales
在2900等旧机型上要用数据库模式来创建:
Sw1#vlan database
Sw1#vlan 10 name sales
Sw1#exit
Show vlan
Show vlan brief
Show interface summary
Show interface status
将端口划进VLAN
Int f0/12
Switchport mode access
Switchport access valn 10
Intferface range f0/5,f0/7,f0/12
Intferface range fastethernet 0/5 - 8,fastethernet 0/12 - 18
本台交换机起Trunk
Int f0/24
Switchport mode trunk
Switchport trunk encapsulation isl(dot1q|negotiate)封装模式,如果使用negotiate参数表示协商
Sw1(config-if)#switchport nonegotiate 本接口不发送协商信息,通常和trunk模式联用
Switchport trunk native vlan 10
Switchport trunk allowed vlan 10
Switchport trunk allowed all
Show interface trunk
Show int f0/24 switchport
配置VTP域
Sw1(config)#vtp domain china
Sw1(config)#vtp mode server|client|transparent
在旧机型上的配置方法:
Sw1#vlan database
Sw1#vtp domain china
Sw1#vtp server|client|transparent
Show vtp status
在VTP中还可设置密码
在三层交换机中完成VLAN间的通信
Sw1(config)#ip routing
Sw1(config)#router rip
Sw1(config-router)#network 100.1.1.0
Sw1(config)#interface vlan 100
Sw1(config-if)#ip address 100.1.1.1
Sw1(config-if)#no shutdown
在交换机中建立VLAN后,会在FLASH中生成一个VLAN文件,可用下列命令查看、删除。
Show flash
Delete vlan.dat
Delete config.text