二 实验要求
①pc1和pc3所在接口为access,pvlan为vlan2
②pc2/4/5/6处于同一网段
③pc2可以访问4\5\6 pc4和pc5可通,pc4和pc6不通,pc5和pc6不通
三 实验分析
①创建VLAN,VLAN 2/3/4/5/6
②划分VLAN,pc1/3在vlan2,pc2 vlan3,pc4 vlan4,pc5 vlan5,pc6 vlan6
③改类型,pc1和pc3是access因为是同一局域网,交换机之间是trunk
四 实验操作
SW1
[sw1]int g0/0/2
[sw1-GigabitEthernet0/0/2]dis this
#
interface GigabitEthernet0/0/2 进接口
port link-type access 设置模式,题目要求access
port default vlan 2 pc1划分到vlan 2
#
return
[sw1-GigabitEthernet0/0/3]dis this
#
interface GigabitEthernet0/0/3 进接口
port hybrid pvid vlan 3 设置pvid为vlan3
port hybrid tagged vlan 3 华为:在进入交换机前会先贴上所在vlan的标签(思科:在进入后打标签)
port hybrid untagged vlan 4 to 6 数据帧到达,并且允许vlan 4 to 6都撕掉标签
#
return
SW2
[sw2]int g0/0/2
[sw2-GigabitEthernet0/0/2]dis this
#
interface GigabitEthernet0/0/2
port link-type access 设置模式,为access模式
port default vlan 2 pc3划分到vlan2
#
return
[sw2-GigabitEthernet0/0/3]dis this
#
interface GigabitEthernet0/0/3
port hybrid pvid vlan 4 默认模式为hybrid模式,划分pvid为vlan4
port hybrid tagged vlan 4 在进入交换机前贴上所在vlan4的标签
port hybrid untagged vlan 3 5 允许撕掉标签vlan3 5,没有vlan2是因为不在同一网段
#
SW3
[sw3]int g0/0/2
[sw3-GigabitEthernet0/0/2]dis this
#
interface GigabitEthernet0/0/2
port hybrid pvid vlan 5 默认模式为hybrid模式,划分pvid为vlan5
port hybrid tagged vlan 5 在进入交换机前贴上所在vlan5的标签
port hybrid untagged vlan 3 to 4 允许撕掉标签vlan3 4,题目要求pc5 pc6不通所以允许列表中不需要加上vlan6
#
return
[sw3-GigabitEthernet0/0/2]int g0/0/3
[sw3-GigabitEthernet0/0/3]dis this
#
interface GigabitEthernet0/0/3
port hybrid pvid vlan 6 默认模式为hybrid模式,划分pvid为vlan6
port hybrid tagged vlan 6 在进入交换机前贴上所在vlan6的标签
port hybrid untagged vlan 3 to 4 允许列表中允许vlan3 4,且允许撕掉标签vlan3 4
#
return
(①创建vlan②进接口③修改模式④划分vlan 查看模式用display port vlan active命令 )
交换机之间
SW1
[sw1]int g0/0/4
[sw1-GigabitEthernet0/0/4]dis this
#
interface GigabitEthernet0/0/4
port link-type trunk 定义trunk模式
port trunk allow-pass vlan 2 to 6 允许通过vlan2 3 4 5 6
#
return
SW2
[sw2-GigabitEthernet0/0/1]dis this
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 6
#
return
[sw2-GigabitEthernet0/0/1]int g0/0/4
[sw2-GigabitEthernet0/0/4]dis this
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 6
#
return
SW3
[sw3-GigabitEthernet0/0/1]dis this
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 6
#
return
路由器和交换机之间
[sw1-GigabitEthernet0/0/1]dis this
#
interface GigabitEthernet0/0/1
port hybrid tagged vlan 2
port hybrid untagged vlan 3 to 5
#
return