QinQ技术是一种扩展VLAN空间的技术,通过在802.1Q标签报文的基础上再增加一层802.1Q的Tag来达到扩展VLAN空间的功能。
- QinQ技术允许私网VLAN透传公网,使得在骨干网中传递的报文有两层802.1Q Tag(一层公网Tag,一层私网Tag),因此也被称为“QinQ协议”。
- 这种技术可以显著扩展VLAN的数量,从原本的4096个增加到4K×4K个,从而满足了城域以太网中标识大量用户的需求。
实验拓扑:
配置情况:
LSW1的配置:
LSW1]vlan batch 2 3 4
[LSW1]interface g0/0/1
[LSW1-GigabitEthernet0/0/1]port link-type hybrid //配置接口类型为混合
[LSW1-GigabitEthernet0/0/1]port hybrid untagged vlan 2 3 //vlan2,3的帧以untagged的方式进入
[LSW1-GigabitEthernet0/0/1]qinq vlan-translation enable //打开QINQ配置功能
[LSW1-GigabitEthernet0/0/1]port vlan-stacking vlan 10 stack-vlan 2 //使VLAN10转换为VLAN2
[LSW1-GigabitEthernet0/0/1]port vlan-stacking vlan 20 stack-vlan 3 //使VLAN20转换为VLAN3
[LSW1-GigabitEthernet0/0/1]quit
[LSW1]interface g0/0/3
[LSW1-GigabitEthernet0/0/3]port link-type dot1q-tunnel //配置接口类型为dot1q-tunnel
[LSW1-GigabitEthernet0/0/3]port default vlan 2
[LSW1-GigabitEthernet0/0/3]port default vlan 4
[LSW1-GigabitEthernet0/0/3]quit
[LSW1]interface g0/0/2
[LSW1-GigabitEthernet0/0/2]port link-type trunk
[LSW1-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 3 4
LSW2的配置:
[LSW2]vlan batch 4
[LSW2]vlan batch 2 3
[LSW2]interface g0/0/2
[LSW2-GigabitEthernet0/0/2]port link-type hybrid
[LSW2-GigabitEthernet0/0/2]port hybrid untagged vlan 2 3
[LSW2-GigabitEthernet0/0/2]qinq vlan-translation enable
[LSW2-GigabitEthernet0/0/2]port vlan-stacking vlan 10 stack-vlan 2
[LSW2-GigabitEthernet0/0/2]port vlan-stacking vlan 20 stack-vlan 3
[LSW2-GigabitEthernet0/0/2]quit
[LSW2]interface g0/0/3
[LSW2-GigabitEthernet0/0/3]port link-type dot1q-tunnel
[LSW2-GigabitEthernet0/0/3]port default vlan 4
[LSW2-GigabitEthernet0/0/3]quit
[LSW2]interface g0/0/1
[LSW2-GigabitEthernet0/0/1]port link-type trunk
[LSW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3 4
LSW3的配置:
[LSW3]vlan batch 10 20
[LSW3]interface g0/0/2
[LSW3-GigabitEthernet0/0/2]port link-type access
[LSW3-GigabitEthernet0/0/2]port default vlan 10
[LSW3-GigabitEthernet0/0/2]quit
[LSW3]interface g0/0/3
[LSW3-GigabitEthernet0/0/3]port link-type access
[LSW3-GigabitEthernet0/0/3]port default vlan 20
[LSW3-GigabitEthernet0/0/3]quit
[LSW3]interface g0/0/1
[LSW3-GigabitEthernet0/0/1]port link-type trunk
[LSW3-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
LSW4的配置:
[LSW4]vlan batch 10 20
[LSW4]interface g0/0/1
[LSW4-GigabitEthernet0/0/1]port link-type trunk
[LSW4-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[LSW4-GigabitEthernet0/0/1]quit
[LSW4]interface g0/0/2
[LSW4-GigabitEthernet0/0/2]port link-type access
[LSW4-GigabitEthernet0/0/2]port default vlan 10
[LSW4-GigabitEthernet0/0/2]quit
[LSW4]interface g0/0/3
[LSW4-GigabitEthernet0/0/3]port link-type access
[LSW4-GigabitEthernet0/0/3]port default vlan 20
LSW5的配置:
[LSW5]vlan batch 10
[LSW5]interface g0/0/2
[LSW5-GigabitEthernet0/0/2]port link-type access
[LSW5-GigabitEthernet0/0/2]port default vlan 10
[LSW5-GigabitEthernet0/0/2]quit
[LSW5]interface g0/0/1
[LSW5-GigabitEthernet0/0/1]port link-type trunk
[LSW5-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
LSW6的配置:
[LSW6]vlan batch 10
[LSW6]interface g0/0/2
[LSW6-GigabitEthernet0/0/2]port link-type access
[LSW6-GigabitEthernet0/0/2]port default vlan 10
[LSW6-GigabitEthernet0/0/2]quit
[LSW6]interface g0/0/1
[LSW6-GigabitEthernet0/0/1]port link-type trunk
[LSW6-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
实验测试:
通过对PC1pingPC2的测试,可以得知双方具有连通性且抓包发现在经过LSW1的g0/0/2接口时PC1的帧多了一层VALN2的包装。说明配置成功了。
QinQ技术是一项重要的网络技术,它通过在原有的802.1Q报文基础上增加一层802.1Q标签,实现了VLAN空间的扩展和更灵活的网络配置。这项技术不仅解决了VLAN数量不足的问题,还提供了业务隔离、VPN等多样化的网络功能,对于现代复杂网络环境具有重要意义。