6.2 VLAN基本配置
==========================================================
1.基础配置
==========================================================
S1:
sy
syname S1
undo info-cen en
vlan batch 10 20 30
dis vlan
------------------------------------------
S2:
sy
syname S2
undo info-cen en
vlan batch 10 20 30
dis vlan
------------------------------------------
==========================================================
2.配置access 端口并划分vlan
==========================================================
S1;
int g0/0/1
port link-type access
port default vlan 10
int g0/0/2
port link-type access
port default vlan 20
dis vlan
------------------------------------------
S2:
int g0/0/1
port link-type access
port default vlan 10
int g0/0/2
port link-type access
port default vlan 20
int g0/0/3
port link-type access
port default vlan 30
dis vlan
==========================================================
3.配置trunk端口实现跨交换机通信
==========================================================
#PC1和PC3之间的通信
*首先PC1无法ping通PC3;
*在S1上dis vlan 发现PC1和PC3之间的G0/0/24属于VLAN1,而他们PC1和PC3属于vlan10,需要把G0/0/24配置为trunk端口;
------------------------------------------
S1:
int g0/0/24
port link-type trunk
port trunk allow-pass vlan 10 20 30
dis vlan
------------------------------------------
S2:
int g0/0/24
port link-type trunk
port trunk allow-pass vlan 10 20 30
------------------------------------------
#PC2和PC4之间的通信
*因为G0/0/24配置为trunk端口,PC2和PC4之间可以正常通信;
*PC2和PC4可以ping通;
==========================================================
3.配置hybrid接口实现不同vlan间的通信
==========================================================
#使用undo命令删除access端口
S1:
int g0/0/1
undo port default vlan
undo port link-type
int g0/0/2
undo port default vlan
undo port link-type
int g0/0/24
undo port trunk allow-pass vlan 10 20 30
undo port link-type
------------------------------------------
#使用port link-type hybrid修改端口为hybrid端口
S1:
int g0/0/1
port link-type hybrid
int g0/0/2
port link-type hybrid
------------------------------------------
#使用port hybrid untag vlan指示端口发送数据时的untag帧标签
S1:
int g0/0/1
port hybrid untag vlan 10 30
int g0/0/2
port hybrid untag vlan 20 30
------------------------------------------
#使用port hybrid pvid vlan指示端口对收到的untag帧标签
S1:
int g0/0/1
port hybrid pvid vlan 10
int g0/0/2
port hybrid pvid vlan 20
------------------------------------------
S1:
int g0/0/24
port link-type hybrid
port hybrid tag vlan 10 20 30
------------------------------------------
========================
#合并的结果
S1:
int g0/0/1
undo port default vlan
undo port link-type
int g0/0/2
undo port default vlan
undo port link-type
int g0/0/24
undo port trunk allow-pass vlan 10 20 30
undo port link-type
int g0/0/1
port link-type hybrid
port hybrid untag vlan 10 30
port hybrid pvid vlan 10
int g0/0/2
port link-type hybrid
port hybrid untag vlan 20 30
port hybrid pvid vlan 20
int g0/0/24
port link-type hybrid
port hybrid tag vlan 10 20 30
========================
------------------------------------------
#在S2进行类似的操作配置,不同的是需要在g0/0/3添加到PC5的配置;
*在g0/0/3端口上需要全打标签,允许所有通过;
S2:
int g0/0/1
undo port default vlan
undo port link-type
int g0/0/2
undo port default vlan
undo port link-type
int g0/0/3
undo port default vlan
undo port link-type
int g0/0/24
undo port trunk allow-pass vlan 10 20 30
undo port link-type
--------------------
int g0/0/1
port link-type hybrid
port hybrid untag vlan 10 30
port hybrid pvid vlan 10
int g0/0/2
port link-type hybrid
port hybrid untag vlan 20 30
port hybrid pvid vlan 20
int g0/0/3
port link-type hybrid
port hybrid untag vlan 10 20 30
port hybrid pvid vlan 30
int g0/0/24
port link-type hybrid
port hybrid tag vlan 10 20 30
------------------------------------------
==========================================================