1、vlan database 这条命令,cisco 已经不推荐使用这个命令了,现在要创建vlan 的话直接在 conf t 下打 vlan 就 OK 了跨交换机的 VLAN 配置实验SW1:添加 VLANSW1#vlan databaseSW1(vlan)#vlan 10 VLAN 10 added:Name: VLAN0010SW1(vlan)#vlan 20VLAN 20 added:Name: VLAN0020SW1(vlan)#vlan 30VLAN 30 added:Name: VLAN0030SW1(vlan)#vlan 40VLAN 40 added:Name: VLAN0040S
2、W1(vlan)#vlan 50VLAN 50 added:Name: VLAN0050SW1(vlan)#exitAPPLY completed.ExitingSW1#show vlan-sw briefVLAN Name Status Ports- - - -1 default active Fa0/0, Fa0/1, Fa0/2, Fa0/3Fa0/4, Fa0/5, Fa0/6, Fa0/7Fa0/8, Fa0/9, Fa0/10, Fa0/11Fa0/12, Fa0/13, Fa0/14, Fa0/1510 VLAN0010 active 20 VLAN0020 active 30
3、VLAN0030 active 40 VLAN0040 active 50 VLAN0050 active 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active设置中继并配置以太通道捆绑SW1#conf tEnter configuration commands, one per line. End with CNTL/Z.SW1(config)#interface range fastethernet0/1 - 4SW1(con
4、fig-if-range)#switchport mode trunk*Mar 1 01:12:29.463: %DTP-5-TRUNKPORTON: Port Fa0/1-4 has become dot1q trunkSW1(config-if-range)#switchport trunk encapsulation dot1qSW1(config-if-range)#channel-group 1 mode onCreating a port-channel interface Port-channel1 SW1(config-if-range)#*Mar 1 01:12:45.775
5、: %EC-5-BUNDLE: Interface Fa0/1 joined port-channel Po1*Mar 1 01:12:45.991: %EC-5-BUNDLE: Interface Fa0/2 joined port-channel Po1*Mar 1 01:12:46.159: %EC-5-BUNDLE: Interface Fa0/3 joined port-channel Po1*Mar 1 01:12:46.339: %EC-5-BUNDLE: Interface Fa0/4 joined port-channel Po1*Mar 1 01:12:48.487: %L
6、INEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to upSW1(config-if-range)#int range f0/5 - 8SW1(config-if-range)#switchport mode trunk*Mar 1 01:13:15.699: %DTP-5-TRUNKPORTON: Port Fa0/5-8 has become dot1q trunkSW1(config-if-range)#switchport trunk encapsulation dot1qSW1(co
7、nfig-if-range)#channel-group 2 mode onCreating a port-channel interface Port-channel2 SW1(config-if-range)#*Mar 1 01:13:22.123: %EC-5-BUNDLE: Interface Fa0/5 joined port-channel Po2*Mar 1 01:13:22.411: %EC-5-BUNDLE: Interface Fa0/6 joined port-channel Po2*Mar 1 01:13:22.591: %EC-5-BUNDLE: Interface
8、Fa0/7 joined port-channel Po2*Mar 1 01:13:22.795: %EC-5-BUNDLE: Interface Fa0/8 joined port-channel Po2SW1(config-if-range)#*Mar 1 01:13:24.831: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel2, changed state to upSW1(config-if-range)#endSW1#show etherchannel summaryFlags: D - down P -
9、in port-channelI - stand-alone s - suspendedR - Layer3 S - Layer2U - in useGroup Port-channel Ports-+-+-1 Po1(SU) Fa0/1(P) Fa0/2(P) Fa0/3(P) Fa0/4(P) 2 Po2(SU) Fa0/5(P) Fa0/6(P) Fa0/7(P) Fa0/8(P) 配置 VTP 域:SW1#vlan databaseSW1(vlan)#vtp serverDevice mode already VTP SERVER.SW1(vlan)#vtp domain TKChan
10、ging VTP domain name from NULL to TKSW1(vlan)#vtp password ciscoSetting device VLAN database password to cisco.SW1(vlan)#vtp pruningPruning switched ONSW1(vlan)#exitAPPLY completed.ExitingSW1#show vtp statusVTP Version : 2Configuration Revision : 2Maximum VLANs supported locally : 256Number of exist
11、ing VLANs : 10VTP Operating Mode : ServerVTP Domain Name : TKVTP Pruning Mode : EnabledVTP V2 Mode : DisabledVTP Traps Generation : DisabledMD5 digest : 0xAA 0x90 0x65 0x7A 0x72 0x0C 0x31 0x6A Configuration last modified by 0.0.0.0 at 3-1-02 01:15:38Local updater ID is 0.0.0.0 (no valid interface fo
12、und)配置以太通道不承载 vlan 40 和 vlan50 的流量:SW1(config)#int range f0/1 - 4SW1(config-if-range)#switchport trunk allowed vlan remove 40SW1(config-if-range)#switchport trunk allowed vlan remove 50SW1#show int f0/1 switchportName: Fa0/1Switchport: EnabledAdministrative Mode: trunkOperational Mode: down (suspend
13、ed member of bundle Po1)Administrative Trunking Encapsulation: dot1qNegotiation of Trunking: DisabledAccess Mode VLAN: 0 (Inactive)Trunking Native Mode VLAN: 1 (default)Trunking VLANs Enabled: 1-39,41-49,51-1005Trunking VLANs Active: nonePriority for untagged frames: 0Override vlan tag priority: FAL
14、SEVoice VLAN: none Appliance trust: noneSW1#conf tEnter configuration commands, one per line. End with CNTL/Z.SW1(config)#int range f0/5 - 8SW1(config-if-range)#switchport trunk allowed vlan remove 40SW1(config-if-range)#switchport trunk allowed vlan remove 50SW1(config-if-range)#endSW1#show int f0/
15、5 switchportName: Fa0/5Switchport: EnabledAdministrative Mode: trunkOperational Mode: down (suspended member of bundle Po2)Administrative Trunking Encapsulation: dot1qNegotiation of Trunking: DisabledAccess Mode VLAN: 0 (Inactive)Trunking Native Mode VLAN: 1 (default)Trunking VLANs Enabled: 1-39,41-
16、49,51-1005Trunking VLANs Active: nonePriority for untagged frames: 0Override vlan tag priority: FALSEVoice VLAN: none Appliance trust: noneSW2:设置中继并配置以太通道捆绑:SW2#conf tEnter configuration commands, one per line. End with CNTL/Z.SW2(config)#int range f0/1 - 4SW2(config-if-range)#switchport mode trunk*
17、Mar 1 01:16:14.267: %DTP-5-TRUNKPORTON: Port Fa0/1-4 has become dot1q trunkSW2(config-if-range)#switchport trunk encapsulation dot1qSW2(config-if-range)#channel-group 1 mode onCreating a port-channel interface Port-channel1 SW2(config-if-range)#*Mar 1 01:16:20.703: %EC-5-BUNDLE: Interface Fa0/1 join
18、ed port-channel Po1*Mar 1 01:16:20.847: %EC-5-BUNDLE: Interface Fa0/2 joined port-channel Po1*Mar 1 01:16:20.991: %EC-5-BUNDLE: Interface Fa0/3 joined port-channel Po1*Mar 1 01:16:21.111: %EC-5-BUNDLE: Interface Fa0/4 joined port-channel Po1*Mar 1 01:16:23.447: %LINEPROTO-5-UPDOWN: Line protocol on
19、Interface Port-channel1, changed state to upSW2(config-if-range)#end 配置 VTP 域:SW2#vlan databaseSW2(vlan)#vtp clientSetting device to VTP CLIENT mode.SW2(vlan)#vtp domain TKChanging VTP domain name from NULL to TKSW2(vlan)#vtp password ciscoSetting device VLAN database password to cisco.SW2(vlan)#exi
20、tIn CLIENT state, no apply attempted.ExitingSW2#show vlan-sw briefVLAN Name Status Ports- - - -1 default active Fa0/0, Fa0/5, Fa0/6, Fa0/7Fa0/8, Fa0/9, Fa0/10, Fa0/11Fa0/12, Fa0/13, Fa0/14, Fa0/1510 VLAN0010 active 20 VLAN0020 active 30 VLAN0030 active 40 VLAN0040 active 50 VLAN0050 active 1002 fddi
21、-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active 端口 f0/11-f0/15 分配到 VLAN10 中:SW2#conf tEnter configuration commands, one per line. End with CNTL/Z.SW2(config)#int range f0/11 - 15SW2(config-if-range)#switchport mode accessSW2(config-if)#switchport
22、access vlan 10SW2(config-if)#endSW2#show vlan-sw briefVLAN Name Status Ports- - - -1 default active Fa0/0, Fa0/5, Fa0/6, Fa0/7Fa0/8, Fa0/9, Fa0/1010 VLAN0010 active Fa0/11, Fa0/12, Fa0/13, Fa0/14Fa0/1520 VLAN0020 active 30 VLAN0030 active 40 VLAN0040 active 50 VLAN0050 active 1002 fddi-default activ
23、e 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default activeSW3:设置中继并配置以太通道捆绑:SW3#conf tEnter configuration commands, one per line. End with CNTL/Z.SW3(config)#int range f0/5 - 8SW3(config-if-range)#switchport mode trunkSW3(config-if-range)#switchport trunk encapsulation do
24、t1qSW3(config-if-range)#channel-group 2 mode onSW3(config-if-range)#end配置 VTP 域:SW3#vlan databaseSW3(vlan)#vtp clientSetting device to VTP CLIENT mode.SW3(vlan)#vtp domain TKChanging VTP domain name from NULL to TKSW3(vlan)#vtp password ciscoSetting device VLAN database password to cisco.SW3(vlan)#e
25、xitIn CLIENT state, no apply attempted.ExitingSW3#show vlan-sw briefVLAN Name Status Ports- - - -1 default active Fa0/0, Fa0/5, Fa0/6, Fa0/7Fa0/8, Fa0/9, Fa0/10, Fa0/11Fa0/12, Fa0/13, Fa0/14, Fa0/1510 VLAN0010 active 20 VLAN0020 active 30 VLAN0030 active 40 VLAN0040 active 50 VLAN0050 active 1002 fd
26、di-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active 端口 f0/11-f0/15 分配到 VLAN10 中:SW3#conf tEnter configuration commands, one per line. End with CNTL/Z.SW3(config)#int range f0/11 - 15SW3(config-if-range)#switchport mode accessSW3(config-if-range)#swi
27、tchport access vlan 10SW3(config-if-range)#endSW3#show vlan-sw briefVLAN Name Status Ports- - - -1 default active Fa0/0, Fa0/1, Fa0/2, Fa0/3Fa0/4, Fa0/9, Fa0/1010 VLAN0010 active Fa0/11, Fa0/12, Fa0/13, Fa0/14Fa0/1520 VLAN0020 active 30 VLAN0030 active 40 VLAN0040 active 50 VLAN0050 active 1002 fddi
28、-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active 客户机配置:PC1:IP:192.168.1.1/24PC2:IP:192.168.1.2/24测试连通性:PC1ping 192.168.1.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:!Success rate is 100 percent (5/5), round-trip min/avg/max = 72/298/1092 ms