目录
一、实验拓扑
二、实验要求
三、实验步骤
1、交换机配置vlan
1)SW1配置
2)SW2配置
3)SW3配置
2、路由器配置子接口、DHCP
配置结果:
PC1-6IP地址
测试
一、实验拓扑
二、实验要求
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
pc1和pc3为access接口,且都在vlan 2,需其余主机不在同一网段,通过子接口实现
pc2/pc4/pc5/pc6处于同一网段,且有权限设置,则接口类型用混杂模式实现
交换机之间所有流量都需经过,所以将其接口类型设置为trunk模式,允许所有VLAN通过
在SW1连接路由器接口上,将vlan 2流量进行打标签,将流量转向子接口,剩余流量设置不打标签,去往物理接口
三、实验步骤
1、交换机配置vlan
1)SW1配置
GE0/0/1 --access vlan 2
GE0/0/2 -- 默认hybrid,接收vlan 4/5/6
(PC2的允许列表是VALAN3、VALAN4、VALAN5、VALAN6不带标签的数据流都能够通)
GE0/0/3 --trunk,允许所有vlan通过
GE0/0/4 -- hybrid,剥离vlan 3/4/5/6标签 ,带标签vlan2
[SW1]vlan batch 2 to 6
[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 vlan 3 4 5 6
[SW1-GigabitEthernet0/0/3]port link-type trunk
[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/4]port hybrid untagged vlan 3 4 5 6
[SW1-GigabitEthernet0/0/4]port hybrid tagged vlan 2
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 all
[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 4 5 6
[SW2-GigabitEthernet0/0/4]port link-type trunk
[SW2-GigabitEthernet0/0/4]port trunk allow-pass vlan all
3)SW3配置
[SW3]vlan batch 2 to 6
[SW3-GigabitEthernet0/0/3]port link-type trunk
[SW3-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[SW3-GigabitEthernet0/0/1]port hybrid pvid vlan 5
[SW3-GigabitEthernet0/0/1]port hybrid untagged vlan 3 4 5
[SW3-GigabitEthernet0/0/2]port hybrid pvid vlan 6
[SW3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 6
2、路由器配置子接口、DHCP
[AR1]int g0/0/0.1
[AR1-GigabitEthernet0/0/0.1]ip add 192.168.2.1 24
[AR1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[AR1-GigabitEthernet0/0/0.1]arp broadcast enable
[AR1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[AR1-GigabitEthernet0/0/0]dhcp enable
[AR1]ip pool v36
[AR1-ip-pool-v36]network 192.168.1.0 mask 24
[AR1-ip-pool-v36]gateway-list 192.168.1.1
[AR1-ip-pool-v36]dns-list 114.114.114.114
[AR1]ip pool v2
[AR1-ip-pool-v2]network 192.168.2.0 mask 24
[AR1-ip-pool-v2]gateway 192.168.2.1
[AR1-ip-pool-v2]dns-list 114.114.114.114
[AR1]int g0/0/0.1
[AR1-GigabitEthernet0/0/0.1]dhcp select global
[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]dhcp select global
配置结果:
PC1-6IP地址
测试
pc1 ping pc2/4/5/6
pc3 ping pc2/4/5/6
pc2 ping pc4/5/6
pc 4 ping pc6
pc5 ping pc6