Switch Basic Experiment

Experimental requirements

insert image description here

根据题目要求
1、pc1 和 PC3所在接口为access,pvlan  vlan2;

   pc2/4/5/6处于同一网段;其中pc2可以访问pc4/5/6;

   但pc4可以访问pc5,不能访问pc6.

2、pc5不能访问pc6
所以划分4个vlan
PC1PC3VLAN2,使用access接口

PC2VLAN3,使用hybrid接口

PC4/5VLAN4,使用hybrid接口

PC6VLAN5,使用hybrid接口

Plan as shown
insert image description here

Experimental procedure

1. Create a vlan on the switch

on SW1

[sw1]vlan batch 2 to 5

on SW2

[sw1]vlan batch 2 to 5

on SW3

[sw1]vlan batch 2 to 5

2. Each interface on the switch is divided into the corresponding vlan

on SW1

[sw1]int e0/0/3
[sw1-Ethernet0/0/3]port link-type access 
[sw1-Ethernet0/0/3]port default vlan 2

[sw1]int e0/0/4
[sw1-Ethernet0/0/4]port hybrid pvid vlan 3
[sw1-Ethernet0/0/4]port hybrid untagged vlan 3 to 5

on SW2

[sw2]int e0/0/3
[sw2-Ethernet0/0/3]port link-type access 
[sw2-Ethernet0/0/3]port default vlan 2

[sw2]int e0/0/4
[sw2-Ethernet0/0/4]port hybrid pvid vlan 4
[sw2-Ethernet0/0/4]port hybrid untagged vlan 3 to 4

on SW3


[sw3]int e0/0/2
[sw3-Ethernet0/0/2]port hybrid pvid vlan 4
[sw3-Ethernet0/0/2]port hybrid untagged vlan 3 to 4

[sw3]int e0/0/3
[sw3-Ethernet0/0/3]port hybrid pvid vlan 5
[sw3-Ethernet0/0/3]port default vlan 3 5

3, trunk road

on SW1

[sw1]int e0/0/2
[sw1-Ethernet0/0/2]port link-type trunk 
[sw1-Ethernet0/0/2]port trunk allow-pass vlan all 

on SW2

[sw2]int e0/0/1
[sw2-Ethernet0/0/1]port link-type trunk 
[sw2-Ethernet0/0/1]port trunk allow-pass vlan all 

[sw2]int e0/0/2
[sw2-Ethernet0/0/2]port link-type trunk 
[sw2-Ethernet0/0/2]port trunk allow-pass vlan all 

on SW3

[sw3]int e0/0/1
[sw3-Ethernet0/0/1]port link-type trunk 
[sw3-Ethernet0/0/1]port trunk allow-pass vlan all 

4. DHCP to obtain IP

The routing DHCP pool is established, the g0/0/0 interface matches VLAN3/4/5, and g0/0/0.1 matches vlan2
to configure the DHCP pool

[r2]dhcp enable 
[r2]ip pool v2
[r2-ip-pool-v2]gateway-list 192.168.1.1
[r2-ip-pool-v2]network 192.168.1.0 mask 24

[r2]ip pool v345
[r2-ip-pool-v345]gateway-list 192.168.2.1
[r2-ip-pool-v345]network 192.168.2.0 mask 24

Although the vlans of vlan3/4/5 are different, they are three in the same broadcast domain, so use a physical interface to match
vlan2 directly to identify the label match with the sub-interface

[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.2.1 255.255.255.0
[r2-GigabitEthernet0/0/0]dhcp select global 

[r2]int g0/0/0.1
[r2-GigabitEthernet0/0/0.1]dot1q termination vid 2
[r2-GigabitEthernet0/0/0.1]arp broadcast enable 
[r2-GigabitEthernet0/0/0.1]dhcp select global 

Tag vlan2 with promiscuous interface on SW1

[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port hybrid tagged vlan 2
[sw1-Ethernet0/0/1]port hybrid untagged vlan 3 to 5

Use the ipconfigcommand to view the ip
, take PC2 as an example
insert image description here

5. Test connectivity

PC2 accesses PC1
insert image description here
PC2 accesses PC3
insert image description here
PC2 accesses PC4
insert image description here

PC2 accesses PC5
insert image description here

PC2 accesses PC6
insert image description here
PC4 can access PC5, but cannot access PC6
PC4 accesses PC5
insert image description here
PC4 accesses PC6
insert image description here

Guess you like

Origin blog.csdn.net/m0_46467017/article/details/122915792