基本QinQ
拓扑图
PC 1 1.1.1.1/24 PC2 1.1.1.2/24
[SW3-GigabitEthernet0/0/1]dis this
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
[SW3-GigabitEthernet0/0/1]int g0/0/2
[SW3-GigabitEthernet0/0/2]dis this
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]dis this
interface GigabitEthernet0/0/1
port link-type dot1q-tunnel
port default vlan 5
[SW1-GigabitEthernet0/0/1]int g0/0/2
[SW1-GigabitEthernet0/0/2]dis this
port link-type trunk
port trunk allow-pass vlan 2 to 4094
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]dis this
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
[SW2]int g0/0/2
[SW2-GigabitEthernet0/0/2]dis this
interface GigabitEthernet0/0/2
port link-type dot1q-tunnel
port default vlan 5
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]dis this
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
[SW2]int g0/0/2
[SW2-GigabitEthernet0/0/2]dis this
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
在SW2的g0/0/2接口上抓包,可以看到数据被打上了两层802.1Q标签
灵活QinQ
在基本QinQ配置的基础上增加PC3和PC4
清除SW1 g0/0/1和SW2g0/0/2接口上的配置 改成灵活QinQ 配置 如下 记得创建VLAN5和15
基于VLAN的灵活QinQ利用hybrid端口实现,需要按步骤在hybrid端口开启QinQ功能,设置灵活QinQ策略,设置去标签策略
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]dis this
interface GigabitEthernet0/0/1
qinq vlan-translation enable //开启QinQ功能
port hybrid untagged vlan 5 15 //设置去标签策略
port vlan-stacking vlan 10 stack-vlan 5 //如果内层标签是10,就再打上外标签5
port vlan-stacking vlan 20 stack-vlan 15 //如果内层标签是20,就再打上外标签15
[SW2]int g0/0/2
[SW2-GigabitEthernet0/0/2]dis this
interface GigabitEthernet0/0/2
qinq vlan-translation enable
port hybrid untagged vlan 5 15
port vlan-stacking vlan 10 stack-vlan 5
port vlan-stacking vlan 20 stack-vlan 15