实验一vlan的创建与划分
五、实验过程(配置过程):
1.同一个交换机上的vlan划分
创建虚拟局域网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 S1
S1(config)#vlan 22
S1(config-vlan)#name T22
S1(config-vlan)#exit
S1(config)# vlan 11
S1(config-vlan)#name T11
S1(config-vlan)#exit
S1(config)#exit
S1#
验证测试:验证虚拟局域网VLAN11和VLAN22已创建成功
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig1/1, Gig1/2
11 T11 active Fa0/1, Fa0/2
22 T22 active Fa0/3, Fa0/4
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 0 0
11 enet 100011 1500 - - - - - 0 0
22 enet 100022 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 0 0
S1#show vlan
为局域网VLAN11和VLAN22分配端口
S1#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#interface vlan 11
S1(config-if)#
%LINK-5-CHANGED: Interface Vlan11, changed state to up
S1(config-if)#interface fastethernet 0/1
S1(config-if)#switchport access vlan 11
S1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan11, changed state to up
S1(config-if)#exit
S1(config)#interface vlan 11
S1(config-if)#interface fastethernet 0/2
S1(config-if)#switchport access vlan 11
S1(config-if)#exit
S1(config)#interface vlan 22
S1(config-if)#
%LINK-5-CHANGED: Interface Vlan22, changed state to up
S1(config-if)#interface fastethernet 0/3
S1(config-if)#switchport access vlan 22
S1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan22, changed state to up
S1(config-if)#exit
S1(config)#interface vlan 22
S1(config-if)#interface fastethernet 0/4
S1(config-if)#switchport access vlan 22
S1(config-if)#exit
验证测试:验证为VLAN11和VLAN22分配端口成功
划分虚拟局域网之前网络情况:
划分虚拟局域网之后网络情况:
2、进行跨交换机的相同vlan之间的计算机的通信实验。
在S1上创建虚拟局域网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 S1
S1(config)#vlan 11
S1(config-vlan)#name T11
S1(config-vlan)#exit
S1(config)#interface fastethernet 0/2
S1(config-if)#switchport access vlan 11
S1(config-if)#exit
S1(config)#exit
S1#
%SYS-5-CONFIG_I: Configured from console by console
S1#show vlan id 11
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
11 T11 active Fa0/2
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/3
S1(config-if)#switchport access vlan 22
S1(config-if)#exit
S1(config)#exit
S1#
%SYS-5-CONFIG_I: Configured from console by console
S1#show vlan id 22
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
22 T22 active Fa0/3
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
22 enet 100022 1500 - - - - - 0 0
S1#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#interface fastethernet 0/1
S1(config-if)#switchport mode trunk
S1(config-if)#
%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
S1(config-if)#exit
S1(config)#exit
S1#
%SYS-5-CONFIG_I: Configured from console by console
S1#show interface fastethernet 0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
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
Appliance trust: none
在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)#host 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
S2#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
S2(config)#interface fastrthernet 0/4
^
% Invalid input detected at '^' marker.
S2(config)#interface fastethernet 0/4
S2(config-if)#switchport access vlan 11
S2(config-if)#exit
S2(config)#exit
S2#
%SYS-5-CONFIG_I: Configured from console by console
S2#show vlan id 11
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
11 T11 active Fa0/4
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/5
S2(config-if)#switchport access vlan 22
S2(config-if)#exit
S2(config)#exit
S2#
%SYS-5-CONFIG_I: Configured from console by console
S2#show vlan id 22
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
22 T22 active Fa0/5
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
22 enet 100022 1500 - - - - - 0 0
S2#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 mode trunk
S2(config-if)#exit
S2(config)#exit
S2#
%SYS-5-CONFIG_I: Configured from console by console
S2#show interces fastethernet 0/1 switchport
^
% Invalid input detected at '^' marker.
S2#show interface fastethernet 0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
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—
划分虚拟局域网之前网络情况:
划分虚拟局域网之后网络情况:
六、实验总结:
通过本次实验,可以发现,不管是只有一个交换机,还是跨交换机,只有在相同的局域网上pc机之间才能通信,不在同一个局域网的pc之间不能通信。
标签:S2,S1,vlan,6.6,exit,config,Fa0 From: https://www.cnblogs.com/binglinll/p/18252239