1. 配置公司A和公司B的私有网络,创建对应的VLAN,并且接口的链路类型
S3的配置:
系统视图进入: <Huawei>system-view
设置设备名称为s3: [huawei]sysname s3
创建VLAN 10和20: [s3]vlan batch 10 20
配置GigabitEthernet0/0/2接口为访问模式并分配VLAN 10:
复制代码
[s3]interface g0/0/2
[s3-GigabitEthernet0/0/2]port link-type access
[s3-GigabitEthernet0/0/2]port default vlan 10
配置GigabitEthernet0/0/3接口为访问模式并分配VLAN 20:
复制代码
[s3]interface g0/0/3
[s3-GigabitEthernet0/0/3]port link-type access
[s3-GigabitEthernet0/0/3]port default vlan 20
配置GigabitEthernet0/0/1接口为干道模式并允许VLAN 10和20通过:
复制代码
[s3]interface g0/0/1
[s3-GigabitEthernet0/0/1]port link-type trunk
[s3-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
S4的配置:
系统视图进入: <Huawei>system-view
设置设备名称为s4: [Huawei]sysname s4
创建VLAN 10和20: [s4]vlan batch 10 20
配置GigabitEthernet0/0/1接口为干道模式并允许VLAN 10和20通过:
复制代码
[s4]interface GigabitEthernet0/0/1
[s4-GigabitEthernet0/0/1] port link-type trunk
[s4-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 20
配置GigabitEthernet0/0/2接口为访问模式并分配VLAN 10:
复制代码
[s4]interface GigabitEthernet0/0/2
[s4-GigabitEthernet0/0/2] port link-type access
[s4-GigabitEthernet0/0/2] port default vlan 10
配置GigabitEthernet0/0/3接口为访问模式并分配VLAN 20:
复制代码
[s4]interface GigabitEthernet0/0/3
[s4-GigabitEthernet0/0/3] port link-type access
[s4-GigabitEthernet0/0/3] port default vlan 20
S5的配置:
系统视图进入: <Huawei>system-view
设置设备名称为s5: [Huawei]sysname s5
创建VLAN 10: [s5]vlan 10
配置GigabitEthernet0/0/2接口为访问模式并分配VLAN 10:
复制代码
[s5]interface g0/0/2
[s5-GigabitEthernet0/0/2]port link-type access
[s5-GigabitEthernet0/0/2]port default vlan 10
配置GigabitEthernet0/0/1接口为干道模式并允许VLAN 10通过:
复制代码
[s5]interface g0/0/1
[s5-GigabitEthernet0/0/1]port link-type trunk
[s5-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
S6的配置:
配置GigabitEthernet0/0/1接口为干道模式并允许VLAN 10通过:
复制代码
[s6]interface GigabitEthernet0/0/1
[s6-GigabitEthernet0/0/1] port link-type trunk
[s6-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
配置GigabitEthernet0/0/2接口为访问模式并分配VLAN 10:
复制代码
[s6]interface GigabitEthernet0/0/2
[s6-GigabitEthernet0/0/2] port link-type access
[s6-GigabitEthernet0/0/2] port default vlan 10
2. 在公网设备配置公网VLAN,并且配置QinQ
S1的配置:
系统视图进入: <Huawei>system-view
设置设备名称为S1: [Huawei]sysname S1
创建VLAN 2、3和4: [S1]vlan batch 2 3 4
配置GigabitEthernet0/0/1接口为混合模式并允许未标记的VLAN 2和3通过:
复制代码
[S1]interface g0/0/1
[S1-GigabitEthernet0/0/1]port link-type hybrid
[S1-GigabitEthernet0/0/1]port hybrid untagged vlan 2 3
启用QinQ功能: [S1-GigabitEthernet0/0/1]qinq vlan-translation enable
配置VLAN堆叠,将VLAN 10映射到外层VLAN 2,将VLAN 20映射到外层VLAN 3:
复制代码
[S1-GigabitEthernet0/0/1]port vlan-stacking vlan 10 stack-vlan 2
[S1-GigabitEthernet0/0/1]port vlan-stacking vlan 20 stack-vlan 3
配置GigabitEthernet0/0/3接口为dot1q隧道模式并分配VLAN 4:
复制代码
[S1]interface g0/0/3
[S1-GigabitEthernet0/0/3]port link-type dot1q-tunnel
[S1-GigabitEthernet0/0/3]port default vlan 4
S2的配置:
系统视图进入: <Huawei>system-view
设置设备名称为s2: [Huawei]sysname s2
创建VLAN 2、3和4: [s2]vlan batch 2 3 4
配置GigabitEthernet0/0/2接口为混合模式并允许未标记的VLAN 2和3通过:
复制代码
[s2]interface g0/0/2
[s2-GigabitEthernet0/0/2]port link-type hybrid
[s2-GigabitEthernet0/0/2]port hybrid untagged vlan 2 3
启用QinQ功能: [s2-GigabitEthernet0/0/2]qinq vlan-translation enable
配置VLAN堆叠,将VLAN 10映射到外层VLAN 2,将VLAN 20映射到外层VLAN 3:
复制代码
[s2-GigabitEthernet0/0/2]port vlan-stacking vlan 10 stack-vlan 2
[s2-GigabitEthernet0/0/2]port vlan-stacking vlan 20 stack-vlan 3
配置GigabitEthernet0/0/3接口为dot1q隧道模式并分配VLAN 4:
复制代码
[s2]interface g0/0/3
[s2-GigabitEthernet0/0/3]port link-type dot1q-tunnel
[s2-GigabitEthernet0/0/3]port default vlan 4
3. 配置公网设备互联端口的链路类型,放行公网VLAN流量通过
S1的配置:
配置GigabitEthernet0/0/2接口为干道模式并允许VLAN 2、3和4通过:
复制代码
[S1]interface g0/0/2
[S1-GigabitEthernet0/0/2]port link-type trunk
[S1-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 3 4
S2的配置:
配置GigabitEthernet0/0/1接口为干道模式并允许VLAN 2、3和4通过:
复制代码
[s2]interface g0/0/1
[s2-GigabitEthernet0/0/1]port link-type trunk
[s2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3 4
总结
该实验展示了如何在华为交换机上配置私有网络和公网网络,实现不同VLAN之间的通信。通过详细的配置步骤,包括接口类型设置、VLAN分配、QinQ配置以及干道端口的设置,确保了不同网络之间的有效隔离和通信。