实验拓扑
实验目的:
三台交换机配置三个
VLAN
命名为
:VLAN10
、
VLAN20
、
VLAN30
配置
f0/5-9
为
VLAN 10
配置
f0/10-14
为
VLAN 20
配置
f0/15-20
为
VLAN 30
配置第一台交换机
Switch>en
Switch#vlan database
Switch(vlan)#vlan 2 name vlan10
Switch(vlan)#vlan 3 name vlan20
Switch(vlan)#vlan 4 name vlan30
Switch(vlan)#exit
Switch#configure t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw1
sw1(config)#interface range fastEthernet 0/5 -9
sw1(config-if-range)#switchport mode access
sw1(config-if-range)#switchport access vlan 2
sw1(config)#interface range fastEthernet 0/10 -14
sw1(config-if-range)#switchport mode access
sw1(config-if-range)#switchport access vlan 3
sw1(config)#interface range fastEthernet 0/15 -20
sw1(config-if-range)#switchport mode access
sw1(config-if-range)#switchport access vlan 4
配置第二台交换机
Switch>en
Switch#vlan database
Switch(vlan)#vlan 2 name vlan10
Switch(vlan)#vlan 3 name vlan20
Switch(vlan)#vlan 4 name vlan30
Switch(vlan)#exit
Switch#configure t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw2
sw2(config)#interface range fastEthernet 0/5 -9
sw2(config-if-range)#switchport mode access
sw2(config-if-range)#switchport access vlan 2
sw2(config-if-range)#exit
sw2(config)#interface range fastEthernet 0/10 -14
sw2(config-if-range)#switchport mode access
sw2(config-if-range)#switchport access vlan 3
sw2(config-if-range)#exi
sw2(config)#interface range fastEthernet 0/15 -20
sw2(config-if-range)#switchport mode access
sw2(config-if-range)#switchport access vlan 4
配置第三台交换机
Switch>en
Switch#vlan database
Switch(vlan)#vlan 2 name vlan10
Switch(vlan)#vlan 3 name vlan20
Switch(vlan)#vlan 4 name vlan30
Switch(vlan)#exit
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw3
Sw4(config)#interface range fastEthernet 0/5 -9
Sw4(config-if-range)#switchport mode access
Sw4(config-if-range)#switchport access vlan 2
Sw4(config-if-range)#exit
Sw4(config)#interface range fastEthernet 0/10 -14
Sw4(config-if-range)#switchport mode access
Sw4(config-if-range)#switchport access vlan 3
Sw4(config-if-range)#exi
Sw4(config)#interface range fastEthernet 0/15 -20
Sw4(config-if-range)#switchport mode access
Sw4(config-if-range)#switchport access vlan 4
配置汇聚链路
sw1(config)#interface fastEthernet 0/1
sw1(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
sw2(config)#interface fastEthernet 0/2
sw2(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
验证配置:
可以利用以下命令验证端口是否启用汇聚
sw1#show interfaces fastEthernet 0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
sw2#show interfaces fastEthernet 0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
实验结果:
PC1
能够
PING
通
PC4
和
PC7
其余不能
PINNG
通,因为他们都属于
VLAN 1
PC2
能够
PING
通
PC5
和
PC8
其余不能
PINNG
通,因为他们都属于
VLAN 2
PC3
能够
PING
通
PC6
和
PC9
其余不能
PINNG
通,因为他们都属于
VLAN 3