您的位置:首页 > 其它

划分VLAN

2017-04-21 13:48 423 查看

实验环境



实验步骤

划分VLAN

创建VLAN,将接口划分到VLAN。

在划分VLAN前,配置路由器R1和R2的f0/0接口,从R1上ping R2.默认交换机接口都在VLAN 1上,R1和R2可以通信。

 

在S1上创建VLAN

S1#vlan database
% Warning: It is recommended to configure VLAN fromconfig mode,
as VLAN database mode is being deprecated. Please consultuser
documentation for configuring VTP/VLAN in config mode.
//进入VLAN database模式,警告:推荐在config模式下配置VLAN
S1(vlan)#vlan 2 name VLAN2
VLAN 2 added:
Name: VLAN2
//创建VLAN2。2是VLAN编号,名字是VLAN2
S1(vlan)#vlan 3 name VLAN3
VLAN 3 added:
Name: VLAN3
S1(vlan)#ex
APPLY completed.
Exiting....

//退出VLAN模式,创建的VLAN立即生效

端口划分在VLAN中

S1(config-if)#int f0/1
S1(config-if)#switchport
S1(config-if)#swi mo acc
S1(config-if)#swi acc vlan 2

S1(config-if)#int f0/2
S1(config-if)#switchport
S1(config-if)#switchport mo acc
S1(config-if)#swi acc vlan 3

实验调试

S1#show vlan    //查看VLAN
 
VLAN Name Status Ports
---- -------------------------------- ----------------------------------------
1 default active Fa0/3, Fa0/4, 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, Gig0/1, Gig0/2
2 VLAN2 active Fa0/1
3 VLAN3 active Fa0/2
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 BrdgModeTrans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ------------ ------ ------
1 enet 100001 1500 - - - - - 0 0
2 enet 100002 1500 - - - - - 0 0
3 enet 100003 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 0 0
1003 tr 101003 1500 - - - - - 0 0
1004 fdnet 101004 1500 - - - ieee - 0 0
1005 trnet 101005 1500 - - - ibm - 0 0
 
Remote SPAN VLANs
------------------------------------------------------------------------------
 
 
Primary Secondary Type Ports
------- -------------------------- ------------------------------------------

S1#show vlan b    //查看VLAN信息摘要

S1#show interfaces f0/1 switchport    //查看f0/1作为交换端口的有关信息

S1#show interfacesf0/1 switchport

Name: Fa0/1    //接口名字

Switchport: Enabled    //接口时交换接口

Administrative Mode: static access   //接口是access接口

Operational Mode: static access

//接口现在的模式是access。有可能管理员配置了自动协商,最终结果是access

Administrative Trunking Encapsulation: dot1q

//接口封装方式

Operational Trunking Encapsulation: native

//接口的trunk方式。native,不对帧进行重新封装

Negotiation of Trunking: Off

//已经关闭trunk的自动协商

Access Mode VLAN: 2 (VLAN2)

//接口属于VLAN2

Trunking Native Mode VLAN: 1 (default)

//接口默认VLAN1

Voice VLAN: none

//没有配置voice VLAN

//以下是私有VLAN信息

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

Unknown unicast blocked: disabled

Unknown multicast blocked: disabled

Appliance trust: none

 

此时R1应该ping不通R2,因为交换机两个接口不在同一个VLAN。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  思科 cisco