需求:1.PC1和PC3所在接口为access接口;属于VLAN 2
PC2-4-5-6处于同一网段:其中PC2可以访间Pc4-5-6
PC4可以访间Pc5不能访间PC6
Pc5不能访问Pc6
3.PC1-Pc3---192.168.0.0 24与PC2-4-5-6不在一个网段--192.168.1.0 24
4.所有Pc均使用DHcp禁取IP地址,且PC1可以正常访间Pc2-4-5-6
第一步创建VLAN
[SW1]vlan batch 2 to 6
[SW2]vlan batch 2 to 6
SW1配置如下:
[SW1]int g 0/0/3
[SW1-GigabitEthernet0/0/3]port link-type access
[SW1-GigabitEthernet0/0/3]port default vlan 2
[SW1-GigabitEthernet0/0/4] port hybrid untagged vlan 2
[SW1-GigabitEthernet0/0/4] port hypvid vlan 3
[sw1-GigabitEthernet0/0/2]port link-type trunk
[sw1-GigabitEthernet0/0/2]port trunk allow-pass 2 to 6
[sw1-GigabitEthernet0/0/1]port hybird untagged vlan 2
[sw1-GigabitEthernet0/0/1]port hybird untagged vlan 3 4 5 6
SW2配置如下:
[SW2]int g 0/0/3
[SW2-GigabitEthernet0/0/3]port link-type access
[SW2-GigabitEthernet0/0/3]port default vlan 2
[SW2-GigabitEthernet0/0/4]port link-type hybird
[SW2-GigabitEthernet0/0/4]port hybird untagged vlan 2 3 4 5
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 6
[sw2-GigabitEthernet0/0/2]port link-type trunk
[SW2-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 to 6
[SW2-GigabitEthernet0/0/4]port hybird pvid vlan 4
SW3配置如下:
[SW3]vlan batch 2 to 6
[SW3-GigabitEthernet0/0/2]port link-type hybird
[SW3-GigabitEthernet0/0/2]port hybird untagged vlan 2 3 4 5
[SW3-GigabitEthernet0/0/2]port hybird pvid vlan 5
[SW3-GigabitEthernet0/0/3]port link-type hybird
[SW3-GigabitEthernet0/0/3]port hybird untagged vlan 2 3 6
[SW3-GigabitEthernet0/0/3]port hybird pvid vlan 6
[SW3-GigabitEthernet0/0/1]port link-type trunk
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 6
r1配置:
[r1-GigabitEthernet0/0/0.1]ip address 192.168.0.1 24
[r1-GigabitEthernet0/0/0.1]dotlq termination vid 2
[r1-GigabitEthernet0/0/0.1]arp broadcast enable
[r1-GigabitEthernet0/0/0] ip address 192.168.1.1 24
[r1]dhcp enable
[r1]ip pool aa
[r1-ip-pool-aa]network 192.168.0.0 mask 24
[r1-ip-pool-aa]gateway-list 192.168.0.1
c
[r1-GigabitEthernet0/0/0.1]dhcp select global
[r1]ip pool bb
[r1-ip-pool-bb]network 192.168.1.0 mask 24
[r1-ip-pool-bb]gateway-list 192.168.1.1
[r1-ip-pool-bb]network 192.168.0.0 mask 24
[r1-GigabitEthernet0/0/0]dhcp select global
经过配置后可以
此时已经配置完成了
pc1 ping pc2:
经过测试,和要求相符
标签:vlan,r1,hybird,IP,VLAN,GigabitEthernet0,实验,SW3,port From: https://www.cnblogs.com/YuAnQingi/p/18461613