题目
实验步骤
一.配置vlan
在各个交换机上配置vlan并分配给接口
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/1]int g0/0/2
[sw1-GigabitEthernet0/0/2]port hybrid pvid vlan 3
[sw1-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 6
[sw1-GigabitEthernet0/0/2]int g0/0/3
[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
SW2
[sw2]vlan batch 2 to 6
[sw2]int g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type access
[sw2-GigabitEthernet0/0/1]port default vlan 2
[sw2-GigabitEthernet0/0/1]int g0/0/2
[sw2-GigabitEthernet0/0/2]port hybrid pvid vlan 4
[sw2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 6
[sw2-GigabitEthernet0/0/2]int g0/0/3
[sw2-GigabitEthernet0/0/3]port link-type trunk
[sw2-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
[sw2-GigabitEthernet0/0/3]int g0/0/4
[sw2-GigabitEthernet0/0/4]port link-type trunk
[sw2-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 to 6
SW3
[sw3]vlan batch 2 to 6
[sw3]int g0/0/1
[sw3-GigabitEthernet0/0/1]port hybrid pvid vlan 5
[sw3-GigabitEthernet0/0/1]port hybrid untagged vlan 3 4 5
[sw3]int g0/0/2
[sw3-GigabitEthernet0/0/2]port hybrid pvid vlan 6
[sw3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 6
[sw3]int g0/0/3
[sw3-GigabitEthernet0/0/3]port link-type trunk
[sw3-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
使用命令行对配置检查
display this
二.配置IP地址
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[R1-GigabitEthernet0/0/0.1]arp broadcast enable ---开启arp广播
[R1-GigabitEthernet0/0/0.1]ip add 192.168.2.1 24
三.DHCP配置
[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]ip pool bb
[r1-ip-pool-bb]network 192.168.2.0 mask 24
[r1-ip-pool-bb]gateway-list 192.168.2.1
[r1-ip-pool-bb]dns-list 8.8.8.8
开启DHCP
[r1]int g 0/0/0.1
[r1-GigabitEthernet0/0/0.1]dhcp select global
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]dhcp select global
检查
结果验证
pc自动获取IP
PC2可以访问PC4 5 6
PC1可以访问所有
PC4不可以访问PC6