实验拓扑图
实验要求
1、pc1和pc3所在接口为access;属于vlan 2;
Pc2/pc4/pc5/pc6处于同一网段;其中pc2可以访问pc4/pcs/pc6;
pc4可以访问pc6;pc5不能访问pc6;
2.pc1/pc3与pc2/pc4/pc5/pc6不在同一网段;
3、所有pc通过DHCP获取Ip地址,且pc1/pc3可以正常访问pc2/pc4/pc5/pc6;
实验步骤及思路
- pc1和pc3为access接口,且都在vlan 2,需要其他主机不在同一网段,通过子接口实现
- 交换机之间所有流量都需经过,所以将其之间的接口类型设置为trunk模式,允许所有VLAN通过
- pc2/pc4/pc5/pc6处于同一网段,且有权限设置,那么接口类型就用混杂模式实现
交换机配置
LSW1
[LSW1]vlan batch 2 to 6
[LSW1]int g0/0/1
[LSW1-GigabitEthernet0/0/1]port link-type access
[LSW1-GigabitEthernet0/0/1]port default vlan 2
[LSW1-GigabitEthernet0/0/1]int g0/0/2
[LSW1-GigabitEthernet0/0/2]port hybrid pvid vlan 3
[LSW1-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 5 6
[LSW1-GigabitEthernet0/0/2]int g0/0/3
[LSW1-GigabitEthernet0/0/3]port link-type trunk
[LSW1-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[LSW1-GigabitEthernet0/0/3]int g0/0/4
[LSW1-GigabitEthernet0/0/4]port hybrid untagged vlan 3 4 5 6
[LSW1-GigabitEthernet0/0/4]port hybrid tagged vlan 2
LSW2
[LSW2]vlan batch 2 to 6
[LSW2]int g0/0/3
[LSW2-GigabitEthernet0/0/3]port link-type trunk
[LSW2-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[LSW2-GigabitEthernet0/0/3]int g0/0/4
[LSW2-GigabitEthernet0/0/4]port link-type trunk
[LSW2-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[LSW2-GigabitEthernet0/0/4]int g0/0/1
[LSW2-GigabitEthernet0/0/1]port link-type access
[LSW2-GigabitEthernet0/0/1]port default vlan 2
[LSW2-GigabitEthernet0/0/1]int g 0/0/2
[LSW2-GigabitEthernet0/0/2]port hybrid pvid vlan 4
[LSW2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 5 6
LSW3
[LSW3]vlan batch 2 to 6
[LSW3-GigabitEthernet0/0/3]port link-type trunk
[LSW3-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[LSW3-GigabitEthernet0/0/3]int g0/0/1
[LSW3-GigabitEthernet0/0/1]port hybrid pvid vlan 5
[LSW3-GigabitEthernet0/0/1]port hybrid untagged vlan 3 4 5
[LSW3-GigabitEthernet0/0/1]int g0/0/2
[LSW3-GigabitEthernet0/0/2]port hybrid pvid vlan 6
[LSW3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 6
实验现象
pc1-6都有了ip地址
并且pc2可以访问pc4/pc5/pc6(图一);pc4可以访问pc6(图二);pc5不能访问pc6(图三);
至此,实验结束