VLAN实验

 要求:

1.pc1和pc3所在接口为access;vlan2;pc2/4/5/6处于同一网段;其中pc2可以访问pc4/5/6;但         pc4可以访问pc5,不能访问pc6
2.pc5不能访问pc6
3.pc1/3与pc2/4/5/6不在一个网段
4.所有pc通过DHCP获取ip地址,且pc1/3可以正常访问pc2/4/5/6

VLAN实验_第1张图片配置:

创建VLAN

[LSW1]vlan batch 2 to 6
[LSW2]vlan batch 2 to 6
[LSW3]vlan batch 2 to 6

[LSW1]int g0/0/1
[LSW1-GigabitEthernet0/0/1]port link-type access
[LSW1-GigabitEthernet0/0/1]port default vlan 2
[LSW1-GigabitEthernet0/0/1]int g0/0/2
[LSW1-GigabitEthernet0/0/2]port link-type hybrid
[LSW1-GigabitEthernet0/0/2]port hybrid pvid vlan 3
[LSW1-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 5 6

将SW1的g 0/0/3接口设置为trunk接口并允许所有

[LSW1]int g0/0/3
[LSW1-GigabitEthernet0/0/3]port link-type trunk
[LSW1-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[LSW1]int g0/0/4
[LSW1-GigabitEthernet0/0/4]port link-type hybrid
[LSW1-GigabitEthernet0/0/4]port hybrid tagged vlan 2
[LSW1-GigabitEthernet0/0/4]port hybrid untagged vlan 3 4 5 6

LSW2

配置sw2在g0/0/1上的接口为access

[LSW2]int g0/0/1
[LSW2-GigabitEthernet0/0/1]port link-type access
[LSW2-GigabitEthernet0/0/1]port default vlan 2

配置sw2在g0/0/2上的接口为hybrid
[LSW2-GigabitEthernet0/0/1]int g0/0/2
[LSW2-GigabitEthernet0/0/2]port link-type hybrid
[LSW2-GigabitEthernet0/0/2]port hybrid pvid vlan 4
[LSW2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 5

在sw2连接sw1和sw3的接口上配置trunk
[LSW2-GigabitEthernet0/0/2]int g0/0/3
[LSW2-GigabitEthernet0/0/3]port link-type trunk
[LSW2-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[LSW2-GigabitEthernet0/0/3]int g0/0/4
[LSW2-GigabitEthernet0/0/4]port link-type trunk
[LSW2-GigabitEthernet0/0/4]port trunk allow-pass vlan all

LSW3

[LSW3]int g0/0/1
[LSW3-GigabitEthernet0/0/1]port link-type hybrid
[LSW3-GigabitEthernet0/0/1]port hybrid pvid vlan 5
[LSW3-GigabitEthernet0/0/1]port hybrid untagged vlan 3 4 5
[LSW3-GigabitEthernet0/0/1]int g0/0/2
[LSW3-GigabitEthernet0/0/2]port link-type hybrid
[LSW3-GigabitEthernet0/0/2]port hybrid pvid vlan 6
[LSW3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 6
[LSW3-GigabitEthernet0/0/2]int g0/0/3
[LSW3-GigabitEthernet0/0/3]port link-type trunk
[LSW3-GigabitEthernet0/0/3]port trunk allow-pass vlan all

R1

[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]ip add 192.168.1.1 24
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[R1-GigabitEthernet0/0/0.1]arp broadcast enable
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.2.1 24

地址池
[R1]dhcp enable
[R1]ip pool aaa
[R1-ip-pool-aaa]network 192.168.1.0 mask 24
[R1-ip-pool-aaa]gateway-list 192.168.1.1
[R1-ip-pool-aaa]dns-list 114.114.114.114

[R1]ip pool bbb
[R1-ip-pool-bbb]network 192.168.2.0 mask 24
[R1-ip-pool-bbb]gateway-list 192.168.2.1
[R1-ip-pool-bbb]dns-list 114.114.114.114

[R1] int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]dhcp select global
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]dhcp select global

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