- 实验需求
1、pc1和pc3所在接口为access;属于vlan 2;
pc2/pc4/pc5/pc6处于同一网段;其中pc2可以访问pc4/pc5/pc6;
pc4可以访问pc6; pc5不能访问pc6;
2、pc1/pc3与pc2/pc4/pc5/pc6不在同一网段;
3、所有pc通过DHCP获取IP地址,且pc1/pc3可以正常访问pc2/pc4/pc5/pc6
划分vlan区域,pc2/4/5/6 在同一个广播域中,.pc1/3 在同一个广播域中,在交换机中创建vlan,将接口划分vlan配置链路模式
●LSW1配置:
创建VLAN2—VLAN5
[SW1]vlan batch 2 to 5
PC1所连接端口:为access模式,属于VLAN2
interface GigabitEthernet0/0/2
port link-type access
port default vlan 2
PC2所连接端口:为hybrid(混杂)模式,打标签为VLAN3,设置所有流量进入不打标签
interface GigabitEthernet0/0/3
port hybrid pvid vlan 3
port hybrid untagged vlan 3 to 5
●LSW1与LSW2之间端口:为trunk模式,设置允许所有VLAN流量通过
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
●LSW2配置:
创建VLAN2—VLAN5
[SW1]vlan batch 2 to 5
PC3所连接端口:为access模式,属于VLAN2
interface GigabitEthernet0/0/3
port link-type access
port default vlan 2
PC4所连接端口:为hybrid(混杂)模式,打标签VLAN4,设置VLAN3/4流量进入不打标签,让VLAN5流量不在允许列表里面。
interface GigabitEthernet0/0/4
port hybrid pvid vlan 4
port hybrid untagged vlan 3 to 4
LSW2与LSW1 和 LSW2与LSW3:接口为trunk模式,并且让其通过所有VLAN流量
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
●LSW3配置:
创建VLAN2—VLAN5
[SW1]vlan batch 2 to 5