实验拓扑图
1、配置PC的IP地址:
PC1
PC2
PC3
2、配置交换机:创建VLAN 10 20 30 ,把与PC相连的接口划入对应的VLAN,更改接口模式, 把交换机GE0/0/1改为trunk,并允许通过VLAN 10 20 30。配置如下:
[Huawei]sysname S1
[S1]vlan batch 10 20 30 //创建VLAN 10 20 30
[S1]interface GigabitEthernet 0/0/2
[S1-GigabitEthernet0/0/2]port link-type access
[S1-GigabitEthernet0/0/2]port default vlan 10
[S1-GigabitEthernet0/0/2]interface GigabitEthernet 0/0/3
[S1-GigabitEthernet0/0/3]port link-type access
[S1-GigabitEthernet0/0/3]port default vlan 20
[S1-GigabitEthernet0/0/3]interface GigabitEthernet 0/0/4
[S1-GigabitEthernet0/0/4]port link-type access
[S1-GigabitEthernet0/0/4]port default vlan 30
[S1]interface GigabitEthernet 0/0/1
[S1-GigabitEthernet0/0/1]port link-type trunk
[S1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
AR1配置:
[Huawei]sysname AR1
[AR1]interface GigabitEthernet 0/0/0.1
[AR1-GigabitEthernet0/0/0.1]ip address 192.168.1.254 24
[AR1-GigabitEthernet0/0/0.1]dot1q termination vid 10 //VLAN10打标签
[AR1-GigabitEthernet0/0/0.1]arp broadcast enable
[AR1-GigabitEthernet0/0/0.1]interface GigabitEthernet 0/0/0.2
[AR1-GigabitEthernet0/0/0.2]ip address 192.168.2.254 24
[AR1-GigabitEthernet0/0/0.2]dot1q termination vid 20 //VLAN20打标签
[AR1-GigabitEthernet0/0/0.2]arp broadcast enable
[AR1-GigabitEthernet0/0/0.2]interface GigabitEthernet 0/0/0.3
[AR1-GigabitEthernet0/0/0.3]ip address 192.168.3.254 24
[AR1-GigabitEthernet0/0/0.3]dot1q termination vid 30 //打VLAN30标签
[AR1-GigabitEthernet0/0/0.3]arp broadcast enable
测试:
PC1
PC1
PC1
PC2
PC2
……