日报81
五、实验过程(配置过程):
1.同一个交换机上的vlan划分
首先建立一个交互机,选择2960的(点击长方体),然后建立四个pc机进行连接(闪电)。
步骤1:划分子网,在交换机switch0上创建虚拟局域网VLAN101和VLAN102并为局域网VLAN101和VLAN102分配端口
点击交换机然后点击CLI按提示输入代码
Switch>en
Switch#config t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 101
Switch(config-vlan)#name M101
Switch(config-vlan)#exit
Switch(config)#vlan 102
Switch(config-vlan)#name M102
Switch(config-vlan)#exit
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport access vlan 101
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#switchport access vlan 101
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/3
Switch(config-if)#switchport access vlan 102
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/4
Switch(config-if)#switchport access vlan 102
Switch(config-if)#exit
Switch(config)#exit
Switch#
%SYS-5-CONFIG_I: Configured from console by console
验证虚拟局域网VLAN101和VLAN102已创建成功且分配端口成功
Switch#show vlan
将pc0和pc3划分到虚拟网段vlan11,pc1和pc2划分到虚拟网段vlan22.
Switch>enable
Switch#config
Configuring from terminal,memory,or network [terminal] ?
Enter configuration commands,one per line. End with CNTL/Z.
Switch (config) #hostname s1
sl (config)#vlan 102
sl (config-vlan) #name M102
s1 (config-vlan) #exit
S1(config)#vlan 101
sl (config-vlan) #name Ml01
sl (config-vlan)#exit
sl (config)#
验证虚拟局域网VLAN11和VLAN22已创建成功:
s1#show vlan
检查4台pc之间的通信情况
给pc机配置ip端口(左击pc机后配置)
pc0: 192.168.101.3,连接端口F0/1
pc1: 192.168.101.4,连接端口F0/2
pc2: 192.168.101.5,连接端口F0/4
pc3: 192.168.101.6,连接端口F0/3
pc0 ping pc3
pc2 分别ping pc1和pc0
2.进行跨交换机的相同vlan之间的计算机和不同vlan之间的计算机的通信实验.
在S1上创建虚拟局域网VLAN11和VLAN22并为之分配端口:
Switch>en
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname S1
S1(config)#vlan 11
S1(config-vlan)#name T11
S1(config-vlan)#exit
S1(config)#interface fastethernet 0/1
S1(config-if)#switchport access vlan 11
S1(config-if)#exit
S1(config)#exit
S1#
%SYS-5-CONFIG_I: Configured from console by console
show vlan id 11
VLAN Name Status Ports
11 T11 active Fa0/1
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
11 enet 100011 1500 - - - - - 0 0
S1#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#vlan 22
S1(config-vlan)#name T22
S1(config-vlan)#exit
S1(config)#interface fastethernet 0/2
S1(config-if)#switchport access vlan 22
S1(config-if)#exit
S1(config)#exit
S1#
%SYS-5-CONFIG_I: Configured from console by console
show vlan id 22
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
22 T22 active Fa0/2
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
22 enet 100022 1500 - - - - - 0 0
将S1的F0/7端口设置为trunk模式:
S1#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#interface fastethernet 0/7
S1(config-if)#switchport mode trunk
S1(config-if)#exit
S1(config)#exit
S1#
%SYS-5-CONFIG_I: Configured from console by console
show interfaces fastethernet 0/7 switchport
Name: Fa0/7
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: down
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk private VLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: All
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL
Protected: false
--More—
在S2上创建虚拟局域网VLAN11和VLAN22并为之分配端口:
Switch>enable
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname S2
S2(config)#vlan 11
S2(config-vlan)#name T11
S2(config-vlan)#exit
S2(config)#exit
S2#
%SYS-5-CONFIG_I: Configured from console by console
config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
S2(config)#interface fastethernet 0/1
S2(config-if)#switchport access vlan 11
S2(config-if)#exit
S2(config)#exit
S2#
%SYS-5-CONFIG_I: Configured from console by console
show vlan id 11
VLAN Name Status Ports
11 T11 active Fa0/1
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
11 enet 100011 1500 - - - - - 0 0
S2#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
S2(config)#vlan 22
S2(config-vlan)#name T22
S2(config-vlan)#exit
S2(config)#interface fastethernet 0/2
S2(config-if)#switchport access vlan 22
S2(config-if)#exit
S2(config)#exit
S2#
%SYS-5-CONFIG_I: Configured from console by console
show vlan id 22
VLAN Name Status Ports
22 T22 active Fa0/2
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
22 enet 100022 1500 - - - - - 0 0
将S2的F0/7端口设置为trunk模式:
S2#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
S2(config)#interface fastethernet 0/7
S2(config-if)#switchport mode trunk
S2(config-if)#exit
S2(config)#exit
S2#
%SYS-5-CONFIG_I: Configured from console by console
show interfaces fastethernet 0/7 switchport
Name: Fa0/7
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: down
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk private VLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: All
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL
Protected: false
--More--
划分虚拟局域网之前网络情况:
PC0和PC1、PC2,PC3通信的通信情况,用截图表示:
划分虚拟局域网之后网络情况:
PC0和PC1、PC2,PC3通信的通信情况,用截图表示
浙公网安备 33010602011771号