vlan综合实验

一、实验拓扑

vlan综合实验_第1张图片

二、实验要求

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;

三、实验步骤

配置交换机

SW1

[SW1]vlan batch 2 to 6
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access 
[SW1-GigabitEthernet0/0/1]port default vlan 2
[SW1-GigabitEthernet0/0/2]port hybrid pvid vlan 3
[SW1-GigabitEthernet0/0/2]port hybrid untagged 3 to 6
[SW1-GigabitEthernet0/0/3]port link-type trunk 
[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
[SW1-GigabitEthernet0/0/4]port hybrid untagged vlan 3 to 6
[SW1-GigabitEthernet0/0/4]port hybrid tagged vlan 2

SW2

[SW2]VLAN batch 2 TO 6
[SW2-GigabitEthernet0/0/3]port link-type trunk 
[SW2-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
[SW2-GigabitEthernet0/0/4]port link-type trunk 
[SW2-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 to 6
[SW2-GigabitEthernet0/0/1]port link-type access 
[SW2-GigabitEthernet0/0/1]port default vlan 2
[SW2-GigabitEthernet0/0/2]port hybrid pvid vlan 4
[SW2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 6

SW3

[SW3-GigabitEthernet0/0/3]port link-type trunk 
[SW3-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
[SW3-GigabitEthernet0/0/1]port hybrid pvid vlan 5
[SW3-GigabitEthernet0/0/1]port hybrid untagged vlan 3 to 5
[SW3-GigabitEthernet0/0/2]port hybrid pvid vlan 6
[SW3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 6

配置路由器

R1

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[R1-GigabitEthernet0/0/0]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]ip add 192.168.2.1 24
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[R1-GigabitEthernet0/0/0.1]arp broadcast enable 
[R1]dhcp enable 
[R1]ip pool aa
[R1-ip-pool-aa]network 192.168.1.0 mask 24
[R1-ip-pool-aa]gateway-list 192.168.1.1
[R1-ip-pool-aa]dns-list  8.8.8.8
[R1-GigabitEthernet0/0/0]dhcp select global 
[R1]ip pool bb
[R1-ip-pool-aa]network 192.168.2.0 mask 24
[R1-ip-pool-aa]gateway-list 192.168.2.1
[R1-ip-pool-aa]dns-list  8.8.8.8
[R1-GigabitEthernet0/0/0.1]dhcp select global 

测试是否获取到相应网段的地址

pc1

vlan综合实验_第2张图片

pc4

vlan综合实验_第3张图片

使用pc1pingpc3

vlan综合实验_第4张图片

全网可正常访问

vlan综合实验_第5张图片

你可能感兴趣的:(网络)