目录
一、实验题目
二、实验思路
三、实验步骤
3.1 将接口划入vlan,设置trunk干道
3.2 启动DHCP服务,下发地址
四、测试
一、实验题目
实验要求:
1,PC1/3的接口均为access模式,且属于vlan2,处于同一网段
2,PC2/4/5/6的IP地址在同一网段,与R1/3网段不同
3,PC2可以访问4/5/6,PC4不能访问5/6,PC5不能访问PC6
4,所有PC端通过DHCP获取IP,PC1/3可以访问2/4/5/6
二、实验思路
1,在两台交换机中创建vlan
2,PC1/3划分入vlan2,接口为接入模式
3,其他接口划分为混杂模式,设置是否携带封装控制流量
4,用trunk干道设置允许所有流量通过
5,启动DHCP服务,建池塘分发IP地址
三、实验步骤
3.1 将接口划入vlan,设置trunk干道
SW1:
[sw1]vlan batch 2 to 6
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 2
[sw1-Ethernet0/0/1]int e0/0/2
[sw1-Ethernet0/0/2]port link-type hybrid
[sw1-Ethernet0/0/2]port hybrid pvid vlan 3
[sw1-Ethernet0/0/2]port hybrid untagged vlan 3 4 5 6
[sw1-Ethernet0/0/2]int e0/0/3
[sw1-Ethernet0/0/3]port link-type access
[sw1-Ethernet0/0/3]port default vlan 2
[sw1-Ethernet0/0/3]int e0/0/4
[sw1-Ethernet0/0/4]port link-type hybrid
[sw1-Ethernet0/0/4]port hybrid pvid vlan 4
[sw1-Ethernet0/0/4]port hybrid untagged vlan 3 4
[sw1-Ethernet0/0/4]int e0/0/6
[sw1-Ethernet0/0/6]port link-type hybrid
[sw1-Ethernet0/0/6]port hybrid untagged vlan 3 4 5 6
[sw1-Ethernet0/0/6]port hybrid tagged vlan 2
[sw1-Ethernet0/0/6]int e0/0/5
[sw1-Ethernet0/0/5]port link-type trunk
[sw1-Ethernet0/0/5]port trunk allow-pass vlan all
SW2:
[sw2]vlan batch 2 to 6
[sw2]int e0/0/2
[sw2-Ethernet0/0/2]port link-type hybrid
[sw2-Ethernet0/0/2]port hybrid pvid vlan
[sw2-Ethernet0/0/2]port hybrid untagged
[sw2-Ethernet0/0/2]int e0/0/3
[sw2-Ethernet0/0/3]port link-type hybrid
[sw2-Ethernet0/0/3]port hybrid pvid vlan 6
[sw2-Ethernet0/0/3]port hybrid untagged vlan 3 6
[sw2-Ethernet0/0/3]int e0/0/1
[sw2-Ethernet0/0/1]port link-type
[sw2-port-group-link-type]q
[sw2]int e0/0/1
[sw2-Ethernet0/0/1]port link-type trunk
[sw2-Ethernet0/0/1]port trunk allow-pass vlan all
3.2 启动DHCP服务,下发地址
R1:
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[r1-GigabitEthernet0/0/0]in 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-GigabitEthernet0/0/0.1]q
[r1]dhcp enable
[r1]ip pool 1
[r1-ip-pool-1]network 192.168.1.0 mask
[r1-ip-pool-1]gateway-list 192.168.1.1
[r1-ip-pool-1]dns-list 114.114.114.114
[r1-ip-pool-1]q
[r1]ip pool 2
[r1-ip-pool-2]network 192.168.2.0 mask 24
[r1-ip-pool-2]gateway-list 192.168.2.1
[r1-ip-pool-2]dns-list 114.114.114.114
[r1-ip-pool-2]q
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]dhcp select global
[r1-GigabitEthernet0/0/0]int g0/0/0.1
[r1-GigabitEthernet0/0/0.1]dhcp select global
[r1-GigabitEthernet0/0/0.1]q
四、测试
查看vlan接口:
PC1/3访问PC2/4/5/6:
PC2访问PC4/5/6:
PC4不能访问PC5/6:
PC5不能访问PC6: