• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 新华三人才研学中心
  • 关于我们

02-二层技术-以太网交换配置指导

目录

11-QinQ配置

本章节下载 11-QinQ配置  (406.01 KB)

11-QinQ配置


1 QinQ

1.1  QinQ简介

QinQ是802.1Q in 802.1Q的简称,它是基于IEEE 802.1Q技术的一种二层隧道协议,通过将用户的私网报文封装上外层VLAN Tag,使其携带两层VLAN Tag穿越运营商的骨干网络(又称公网),从而为用户提供了一种比较简单的二层VPN隧道技术,也使运营商能够利用一个VLAN为包含多个VLAN的用户网络提供服务成为了可能。

1.1.1  QinQ的产生背景和优点

IEEE 802.1Q定义的VLAN ID域只有12个比特,最多可以表示4094个VLAN。但在实际应用中,尤其是在城域网中,需要大量的VLAN来隔离用户,4094个VLAN远远不能满足需求。

QinQ使整个网络最多可提供4094×4094个VLAN,从而满足了城域网对VLAN数量的需求。它具备以下优点:

·     缓解公网VLAN ID资源日益紧缺的问题。

·     用户可以规划自己的私网VLAN ID,不会导致与公网VLAN ID冲突。

·     为小型城域网和企业网提供了一种简单、灵活的二层VPN解决方案。

·     当运营商升级网络时,用户网络不必更改原有配置,使用户网络具有了较强的独立性。

1.1.2  QinQ的实现原理                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

在公网的传输过程中,设备只根据外层VLAN Tag转发报文,并将报文的源MAC地址表项学习到外层VLAN Tag所在VLAN的MAC地址表中,而用户的私网VLAN Tag将被当作报文的数据部分进行传输。

图1-1 QinQ典型应用组网图

 

图1-1所示,用户网络A和B的私网VLAN分别为VLAN 1~10和VLAN 1~20。运营商为用户网络A和B分配的公网VLAN分别为VLAN 3和VLAN 4。当用户网络A和B中带VLAN Tag的报文进入运营商网络时,报文外面就会被分别封装上VLAN 3和VLAN 4的VLAN Tag。这样,来自不同用户网络的报文在运营商网络中传输时被完全分开,即使这些用户网络各自的VLAN范围存在重叠,在运营商网络中传输时也不会产生冲突。当报文穿过运营商网络,到达运营商网络另一侧PE设备后,报文会被剥离公网VLAN Tag,然后再传送给用户网络的CE设备。

1.1.3  QinQ的报文结构

图1-2所示,QinQ报文在运营商网络中传输时带有双层VLAN Tag:

·     内层VLAN Tag:为用户的私网VLAN Tag,对应图中的Customer VLAN Tag。依靠该Tag在私网中传送QinQ报文。

·     外层VLAN Tag:为运营商分配给用户的公网VLAN Tag,对应图中的Service VLAN Tag。依靠该Tag在公网中传送QinQ报文,内层VLAN Tag在公网中被屏蔽。

图1-2 QinQ的报文结构

 

说明

接口的MTU(Maximum Transmission Unit,最大传输单元)值默认为1500字节。由于为报文加上外层VLAN Tag后,报文长度将增加4个字节,因此建议用户适当增加运营商网络中各接口的MTU值(至少为1504字节)。有关接口MTU值的相关配置,请参见“二层技术-以太网交换”中的“以太网端口”。

 

1.1.4  QinQ的实现方式

QinQ的实现方式可分为以下两种:

1. 基本QinQ

基本QinQ是基于端口方式实现的。当端口上配置了基本QinQ功能后,不论从该端口收到报文是否带有VLAN Tag,设备都会为该报文打上本端口缺省VLAN的Tag:

·     如果收到的是带有VLAN Tag的报文,该报文就成为带双Tag的报文;

·     如果收到的是不带VLAN Tag的报文,该报文就成为带有本端口缺省VLAN Tag的报文。

2. 灵活QinQ

灵活QinQ是基于端口与VLAN相结合的方式实现的,它对QinQ的功能进行了扩展,是对QinQ的一种更灵活的实现。灵活QinQ除了能实现所有基本QinQ的功能外,对于从同一个端口收到的报文,还可以根据VLAN的不同进行不同的操作,包括:

·     为具有不同内层VLAN ID的报文添加不同的外层VLAN Tag。

·     根据报文内层VLAN的802.1p优先级标记外层VLAN的802.1p优先级。

·     在添加外层VLAN Tag的同时,还可修改内层的VLAN ID。

通过使用灵活QinQ技术,在能够隔离运营商网络和用户网络的同时,又能够提供丰富的业务特性和更加灵活的组网能力。

1.1.5  VLAN Tag的TPID值可调功能

图1-3所示,是IEEE802.1Q协议定义的以太网帧的VLAN Tag结构,TPID(Tag Protocol Identifier,标签协议标识符)就是VLAN Tag中的一个字段,用于表示VLAN Tag的协议类型,其缺省取值为0x8100。

图1-3 以太网帧的VLAN Tag结构

 

TPID值可以用来判断报文中是否携带有VLAN Tag,例如:在设备上配置用户VLAN Tag和运营商VLAN Tag中携带的TPID值分别为0x8200和0x9100,而如果收到的报文实际携带的内、外层VLAN Tag的TPID值分别为0x8100和0x9100,设备就会认为该报文只携带运营商VLAN Tag,而没有携带用户VLAN Tag。

第三方厂商的设备可能将QinQ报文外层VLAN Tag的TPID设为不同的值。为了与这些厂商的设备兼容,用户可以通过修改TPID值,使发送到公网中的QinQ报文携带的TPID值与第三方厂商的相同,从而实现与这些厂商的设备互通。

由于TPID字段在以太网报文中的位置与不带VLAN Tag的报文中协议类型字段的位置相同,因此为了避免给报文转发和接收造成混乱,不允许将TPID值配置为表1-1中列举的常用协议类型值。

表1-1 常用协议类型值

协议类型

协议类型值

ARP

0x0806

PUP

0x0200

RARP

0x8035

IP

0x0800

IPv6

0x86DD

PPPoE

0x8863/0x8864

MPLS

0x8847/0x8848

IPX/SPX

0x8137

IS-IS

0x8000

LACP

0x8809

802.1X

0x888E

集群

0x88A7

设备保留

0xFFFD/0xFFFE/0xFFFF

 

1.1.6  协议规范

与QinQ相关的协议规范有:

·     IEEE 802.1Q:IEEE standard for local and metropolitan area networks: Virtual Bridged Local Area Networks

1.2  QinQ配置任务简介

表1-2 QinQ配置任务简介

配置任务

说明

详细配置

配置基本QinQ功能

使能基本QinQ功能

必选

1.3.1 

配置VLAN透传功能

可选

1.3.2 

配置灵活QinQ功能

配置外层VLAN Tag添加策略

三者至少选其一

1.4.1 

配置内、外层VLAN Tag中802.1p优先级的映射关系

1.4.2 

配置内层VLAN ID替换关系

1.4.3 

配置VLAN TagTPID

可选

1.5 

 

说明

·     QinQ功能只需在运营商网络进行配置,用户网络不需进行配置。

·     对于QinQ的相关配置来说,以太网端口视图下的配置只对当前端口有效;二层聚合接口视图下的配置对当前接口及其对应聚合组中的所有成员端口都有效;端口组视图下的配置对当前端口组中的所有端口有效。

·     基本QinQ和灵活QinQ功能都应在连接用户网络的运营商侧接口上进行配置。

·     所有的QinQ相关配置都不能在镜像反射端口上进行配置。有关镜像反射端口的详细介绍,请参见“网络管理和监控配置指导/镜像”中的“端口镜像”。

·     开启基本QinQ的端口,需要配置允许端口的缺省VLAN通过,配置灵活QinQ功能的端口,需要配置允许QinQ外层VLAN通过。

 

1.3  配置基本QinQ功能

1.3.1  使能基本QinQ功能

使能了基本QinQ功能的端口将为其收到的报文添加新的VLAN Tag,该VLAN Tag即该端口缺省VLAN的Tag。

表1-3 使能基本QinQ功能

操作

命令

说明

进入系统视图

system-view

-

进入相应视图

进入二层以太网端口或二层聚合接口视图

interface interface-type interface-number

二者必选其一

进入端口组视图

port-group manual port-group-name

使能端口的基本QinQ功能

qinq enable

必选

缺省情况下,端口的基本QinQ功能处于关闭状态

 

1.3.2  配置VLAN透传功能

端口上使能了基本QinQ功能后,从该端口收到的报文就会被打上本端口缺省VLAN的Tag。而VLAN透传功能则可使端口在收到带有指定VLAN Tag的报文后,不为其添加外层VLAN Tag而直接在运营商网络中传输。

表1-4 配置VLAN透传功能

操作

命令

说明

进入系统视图

system-view

-

进入相应视图

进入二层以太网端口或二层聚合接口视图

interface interface-type interface-number

二者必选其一

进入端口组视图

port-group manual port-group-name

配置端口的链路类型

port link-type { hybrid | trunk }

必选

缺省情况下,端口的链路类型为Access类型

配置端口允许透传VLAN和端口缺省VLAN通过

当端口类型为Hybrid端口

port hybrid vlan vlan-id-list { tagged | untagged }

二者必选其一

缺省情况下,Trunk端口只允许VLAN 1通过;Hybrid端口只允许VLAN 1的报文以Untagged方式通过

当端口类型为Trunk端口

port trunk permit vlan { vlan-id-list | all }

使能端口的基本QinQ功能

qinq enable

必选

缺省情况下,端口的基本QinQ功能处于关闭状态

配置端口的VLAN透传功能

qinq transparent-vlan vlan-list

必选

缺省情况下,端口没有配置VLAN透传功能

 

注意

·     配置VLAN透传功能时,还需在报文传输路径的所有设备上都配置允许透传的VLAN通过。

·     配置了端口对指定VLAN的报文进行透传后,请勿在该端口上对这些VLAN再进行VLAN映射的相关配置。有关VLAN映射的详细介绍,请参见“二层技术-以太网交换配置指导”中的“VLAN映射”。

 

1.4  配置灵活QinQ功能

1.4.1  配置外层VLAN Tag添加策略

基本QinQ功能添加的外层VLAN Tag是端口缺省VLAN的Tag,灵活的QinQ功能则可以为不同的内层VLAN Tag添加不同的外层VLAN Tag。

本系列交换机的灵活QinQ功能通过QoS策略的方式实现,通过配置匹配报文原有VLAN Tag的流分类和封装外层VLAN Tag的流行为,并将其在QoS策略中进行关联,然后应用到连接用户的端口,即可以实现根据报文内层VLAN封装外层VLAN Tag的功能。

表1-5 配置外层VLAN Tag添加策略

操作

命令

说明

进入系统视图

system-view

-

创建类并进入类视图

traffic classifier classifier-name [ operator { and | or } ]

必选

缺省情况下,类视图下各规则之间的关系为and,即逻辑与

配置匹配报文的规则,即指定报文的内层VLAN ID

if-match customer-vlan-id vlan-id-list

必选

退出至系统视图

quit

-

创建流行为并进入流行为视图

traffic behavior behavior-name

必选

定义流行为,即指定为报文封装的外层VLAN ID

nest top-most vlan-id vlan-id

必选

退出至系统视图

quit

-

创建QoS策略并进入QoS策略视图

qos policy policy-name

必选

将之前定义的流分类和指定的流行为进行绑定,组成QoS策略

classifier classifier-name  behavior behavior-name

必选

退出至系统视图

quit

-

进入连接用户的以太网端口视图或端口组视图

进入二层以太网端口视图

interface interface-type interface-number

二者必选其一

进入端口组视图

port-group manual port-group-name

开启端口的基本QinQ功能

qinq enable

必选

在端口的入方向应用QoS策略

qos apply policy policy-name inbound

必选

 

注意

l 开启灵活QinQ前必须先配置端口的基本QinQ功能,灵活QinQ的优先级高于基本QinQ,即当端口接收的报文不能匹配流分类规则的情况下,才根据基本QinQ的功能封装外层VLAN Tag。

l 关于QoS策略的更多详细信息,请参见“ACL和QoS配置指导/QoS”中的“QoS配置方式”。

 

1.4.2  配置内、外层VLAN Tag中802.1p优先级的映射关系

用户可以通过本配置改变报文内层VLAN Tag中携带的802.1p优先级与外层VLAN Tag中携带的802.1p优先级之间的映射关系。

表1-6 配置内、外层VLAN Tag中802.1p优先级的映射关系

操作

命令

说明

进入系统视图

system-view

-

创建类并进入类视图

traffic classifier classifier-name [ operator { and | or } ]

必选

缺省情况下,类视图下各规则之间的关系为and,即逻辑与

配置匹配报文的规则

配置内层VLAN ID作为匹配规则

if-match customer-vlan-id vlan-id-list

二者选其一

配置内层VLAN Tag中的802.1p优先级作为匹配规则

if-match customer-dot1p 8021p-list

退出至系统视图

quit

-

创建流行为并进入流行为视图

traffic behavior behavior-name

必选

定义流行为,重标记外层VLAN Tag中的802.1p优先级

remark dot1p 8021p

必选

退出至系统视图

quit

-

创建QoS策略并进入QoS策略视图

qos policy policy-name

必选

将之前定义的流分类和指定的流行为进行绑定,组成QoS策略

classifier classifier-name  behavior behavior-name

必选

退出至系统视图

quit

-

进入连接用户网络的以太网端口视图或端口组视图

进入二层以太网端口视图

interface interface-type interface-number

二者必选其一

进入端口组视图

port-group manual port-group-name

开启端口的基本QinQ功能

qinq enable

必选

在端口的入方向应用QoS策略

qos apply policy policy-name inbound

必选

 

1.4.3  配置内层VLAN ID替换关系

在设备连接用户网络的端口上应用基本QinQ功能或灵活QinQ配置外层VLAN Tag的添加策略可以为报文添加外层VLAN Tag,但不能修改报文的内层VLAN ID。如果需要修改报文的内层VLAN ID,可以在设备连接运营商网络侧的端口上进行如下配置:

·     配置匹配报文内、外层VLAN ID的流分类;

·     配置修改报文内层VLAN ID的流行为;

·     将上述流分类和流行为在QoS策略中进行关联;

·     将QoS策略应用到设备连接运营商网络侧的端口的出方向上。

表1-7 配置内层VLAN ID替换关系

操作

命令

说明

进入系统视图

system-view

-

创建类并进入类视图

traffic classifier classifier-name [ operator and ]

必选

缺省情况下,类视图下各规则之间的关系为and,即逻辑与

配置匹配报文的规则,指定报文的内层VLAN ID

if-match customer-vlan-id vlan-id-list

必选

配置匹配报文的规则,指定报文的外层VLAN ID

if-match service-vlan-id vlan-id

必选

退出至系统视图

quit

-

创建流行为并进入流行为视图

traffic behavior behavior-name

必选

定义流行为,即修改报文内层VLAN ID

remark customer-vlan-id vlan-id

必选

退出至系统视图

quit

-

创建QoS策略并进入QoS策略视图

qos policy policy-name

必选

将之前定义的流分类和指定的流行为进行绑定,组成QoS策略

classifier classifier-name  behavior behavior-name

必选

退出至系统视图

quit

-

进入连接运营商网络的以太网端口视图或端口组视图

进入二层以太网端口视图

interface interface-type interface-number

二者必选其一

进入端口组视图

port-group manual port-group-name

在端口的出方向应用QoS策略

qos apply policy policy-name outbound

必选

 

1.5  配置VLAN TagTPID

操作

命令

说明

进入系统视图

system-view

-

配置用户网络中的TPID值

qinq ethernet-type customer-tag hex-value

可选

缺省情况下,用户网络中的TPID值为0x8100

进入连接运营商网络的以太网端口视图、二层聚合端口视图或端口组视图

进入二层以太网端口视图或二层聚合端口组视图

interface interface-type interface-number

二者必选其一

进入端口组视图

port-group manual port-group-name

配置运营商网络中的TPID值

qinq ethernet-type service-tag hex-value

可选

缺省情况下,运营商网络的TPID值为0x8100

 

说明

·     运营商网络中的TPID值和QinQ功能不能在端口上同时配置。

·     对于没有配置基本QinQ功能或用户侧QinQ功能的端口,交换机将根据端口上配置的运营商网络的TPID值来判断接收到的报文是否携带VLAN Tag。

·     对于配置了基本QinQ功能或用户侧QinQ功能的端口,交换机将根据全局配置的用户网络的TPID值来判断接收到的报文是否携带VLAN Tag。

·     关于用户侧QinQ功能的介绍,请参见“二层技术-以太网交换配置指导”中的“VLAN映射配置”。

 

1.6  QinQ典型配置举例

1.6.1  基本QinQ配置举例

1. 组网需求

·     公司A的两个分支机构Site 1和Site 2通过运营商网络进行通信,该公司各业务使用的VLAN为VLAN 10~70;公司B的两个分支机构Site 3和Site 4也通过运营商网络进行通信,该公司各业务使用的VLAN为VLAN 30~90。

·     PE 1和PE 2为运营商网络的边缘设备,且二者通过TPID值为0x8200的第三方厂商设备进行连接。

·     通过配置,利用运营商提供的VLAN 100使公司A的两个分支机构之间实现互通,利用运营商提供的VLAN 200使公司B的两个分支机构之间实现互通。

2. 组网图

图1-4 基本QinQ配置组网图

 

3. 配置步骤

说明

用户必须通过配置保证运营商网络中的设备之间允许QinQ报文通过。

 

(1)     配置PE 1

·     配置端口GigabitEthernet1/0/1

# 配置端口为Trunk端口,且允许VLAN 100的报文通过。

<PE1> system-view

[PE1] interface gigabitethernet 1/0/1

[PE1-GigabitEthernet1/0/1] port link-type trunk

[PE1-GigabitEthernet1/0/1] port trunk permit vlan 100

# 配置端口的缺省VLAN为VLAN 100。

[PE1-GigabitEthernet1/0/1] port trunk pvid vlan 100

# 使能端口的基本QinQ功能。

[PE1-GigabitEthernet1/0/1] qinq enable

[PE1-GigabitEthernet1/0/1] quit

·     配置端口GigabitEthernet1/0/2

# 配置端口为Trunk端口,且允许VLAN 100和VLAN 200的报文通过。

[PE1] interface gigabitethernet 1/0/2

[PE1-GigabitEthernet1/0/2] port link-type trunk

[PE1-GigabitEthernet1/0/2] port trunk permit vlan 100 200

# 配置端口添加的外层VLAN Tag的TPID值为0x8200。

[PE1-GigabitEthernet1/0/2] qinq ethernet-type service-tag 8200

[PE1-GigabitEthernet1/0/2] quit

·     配置端口GigabitEthernet1/0/3

# 配置端口为Trunk端口,且允许VLAN 200的报文通过。

[PE1] interface gigabitethernet 1/0/3

[PE1-GigabitEthernet1/0/3] port link-type trunk

[PE1-GigabitEthernet1/0/3] port trunk permit vlan 200

# 配置端口的缺省VLAN为VLAN 200。

[PE1-GigabitEthernet1/0/3] port trunk pvid vlan 200

# 使能端口的基本QinQ功能。

[PE1-GigabitEthernet1/0/3] qinq enable

[PE1-GigabitEthernet1/0/3] quit

(2)     配置PE 2

·     配置端口GigabitEthernet1/0/1

# 配置端口为Trunk端口,且允许VLAN 200的报文通过。

<PE2> system-view

[PE2] interface gigabitethernet 1/0/1

[PE2-GigabitEthernet1/0/1] port link-type trunk

[PE2-GigabitEthernet1/0/1] port trunk permit vlan 200

# 配置端口的缺省VLAN为VLAN 200。

[PE2-GigabitEthernet1/0/1] port trunk pvid vlan 200

# 使能端口的基本QinQ功能。

[PE2-GigabitEthernet1/0/1] qinq enable

[PE2-GigabitEthernet1/0/1] quit

·     配置端口GigabitEthernet1/0/2

# 配置端口为Trunk端口,且允许VLAN 100和VLAN 200的报文通过。

[PE2] interface gigabitethernet 1/0/2

[PE2-GigabitEthernet1/0/2] port link-type trunk

[PE2-GigabitEthernet1/0/2] port trunk permit vlan 100 200

# 配置端口添加的外层VLAN Tag的TPID值为0x8200。

[PE2-GigabitEthernet1/0/2] qinq ethernet-type service-tag 8200

[PE2-GigabitEthernet1/0/2] quit

·     配置端口GigabitEthernet1/0/3

# 配置端口为Trunk端口,且允许VLAN 100的报文通过。

[PE2] interface gigabitethernet 1/0/3

[PE2-GigabitEthernet1/0/3] port link-type trunk

[PE2-GigabitEthernet1/0/3] port trunk permit vlan 100

# 配置端口的缺省VLAN为VLAN 100。

[PE2-GigabitEthernet1/0/3] port trunk pvid vlan 100

# 使能端口的基本QinQ功能。

[PE2-GigabitEthernet1/0/3] qinq enable

[PE2-GigabitEthernet1/0/3] quit

(3)     配置第三方厂商设备

对于PE 1与PE 2之间的第三方厂商设备,其关键配置如下:在连通PE 1与PE 2的端口上,都允许VLAN 100和200的报文携带VLAN Tag通过。

1.6.2  VLAN透传配置举例

1. 组网需求

·     某公司的两个分支机构Site 1和Site 2通过运营商网络进行通信,该公司各业务使用的VLAN为VLAN 10~50。

·     PE 1和PE 2为运营商网络的边缘设备,且二者通过TPID值为0x8200的第三方厂商设备进行连接。

·     通过配置,使这两个分支机构之间不利用运营商提供的VLAN就能实现互通。

2. 组网图

图1-5 VLAN透传配置组网图

 

3. 配置步骤

说明

用户必须通过配置保证运营商网络中的设备之间允许QinQ报文和透传VLAN的报文通过。

 

(1)     配置PE 1

·     配置端口GigabitEthernet1/0/1

# 配置端口为Trunk端口,且允许VLAN 10~50的报文通过。

<PE1> system-view

[PE1] interface gigabitethernet 1/0/1

[PE1-GigabitEthernet1/0/1] port link-type trunk

[PE1-GigabitEthernet1/0/1] port trunk permit vlan 10 to 50

# 使能端口的基本QinQ功能。

[PE1-GigabitEthernet1/0/1] qinq enable

# 配置端口对VLAN 10~50的报文进行透传。

[PE1-GigabitEthernet1/0/1] qinq transparent-vlan 10 to 50

[PE1-GigabitEthernet1/0/1] quit

·     配置端口GigabitEthernet1/0/2

# 配置端口为Trunk端口,且允许VLAN 10~50的报文通过。

[PE1] interface gigabitethernet 1/0/2

[PE1-GigabitEthernet1/0/2] port link-type trunk

[PE1-GigabitEthernet1/0/2] port trunk permit vlan 10 to 50

# 配置端口添加的外层VLAN Tag的TPID值为0x8200。

[PE1-GigabitEthernet1/0/2] qinq ethernet-type service-tag 8200

[PE1-GigabitEthernet1/0/2] quit

(2)     配置PE 2

·     配置端口GigabitEthernet1/0/1

# 配置端口为Trunk端口,且允许VLAN 10~50的报文通过。

<PE2> system-view

[PE2] interface gigabitethernet 1/0/1

[PE2-GigabitEthernet1/0/1] port link-type trunk

[PE2-GigabitEthernet1/0/1] port trunk permit vlan 10 to 50

# 使能端口的基本QinQ功能。

[PE2-GigabitEthernet1/0/1] qinq enable

# 配置端口对VLAN 10~50的报文进行透传。

[PE2-GigabitEthernet1/0/1] qinq transparent-vlan 10 to 50

[PE2-GigabitEthernet1/0/1] quit

·     配置端口GigabitEthernet1/0/2

# 配置端口为Trunk端口,且允许VLAN 10~50的报文通过。

[PE2] interface gigabitethernet 1/0/2

[PE2-GigabitEthernet1/0/2] port link-type trunk

[PE2-GigabitEthernet1/0/2] port trunk permit vlan 10 to 50

# 配置端口添加的外层VLAN Tag的TPID值为0x8200。

[PE2-GigabitEthernet1/0/2] qinq ethernet-type service-tag 8200

[PE2-GigabitEthernet1/0/2] quit

(3)     配置第三方厂商设备

对于PE 1与PE 2之间的第三方厂商设备,其关键配置如下:在连通PE 1与PE 2的端口上,都允许VLAN 10~50的报文携带VLAN Tag通过。

1.6.3  灵活QinQ配置举例一

1. 组网需求

·     某公司的两个分支机构Site 1和Site 2通过运营商网络进行通信,该公司的语音和数据业务分别使用VLAN 10和VLAN 20加以区分。

·     PE 1和PE 2为运营商网络的边缘设备,且二者通过TPID值为0x8200的第三方厂商设备进行连接。

·     通过配置,利用运营商提供的VLAN 100和VLAN 200分别使这两个分支机构间的语音和数据业务实现互通。

2. 组网图

图1-6 灵活QinQ配置组网图一

 

3. 配置步骤

说明

用户必须通过配置保证运营商网络中的设备之间允许QinQ报文通过。

 

(1)     配置PE 1

·     配置端口GigabitEthernet1/0/1

# 配置端口为Hybrid端口,且允许VLAN 100和200的报文不带Tag通过。

<PE1> system-view

[PE1] interface gigabitethernet 1/0/1

[PE1-GigabitEthernet1/0/1] port link-type hybrid

[PE1-GigabitEthernet1/0/1] port hybrid vlan 100 200 untagged

[PE1-GigabitEthernet1/0/1] quit

# 创建流分类规则,将来自Site 1VLAN10的报文定义为“A10”类。

[PE1] traffic classifier A10

[PE1-classifier-A10] if-match customer-vlan-id 10

[PE1-classifier-A10] quit

# 定义流行为,为报文封装VLAN100的外层VLAN Tag,流行为命名为“P100”。

[PE1] traffic behavior P100

[PE1-behavior-P100] nest top-most vlan-id 100

[PE1-behavior-P100] quit

# 与以上配置类似,创建流分类“A20”匹配用户VLAN ID为20的报文,并创建流行为“P200”,为此类报文封装外层VLAN200的Tag。

[PE1] traffic classifier A20

[PE1-classifier-A20] if-match customer-vlan-id 20

[PE1-classifier-A20] quit

[PE1] traffic behavior P200

[PE1-behavior-P200] nest top-most vlan-id 200

[PE1-behavior-P200] quit

# 创建QoS策略,将流分类“A10”和流行为“P100”进行关联,将流分类“A20”和流行为“P200”关联,策略命名为“qinq”。

[PE1] qos policy qinq

[PE1-qospolicy-qinq] classifier A10 behavior P100

[PE1-qospolicy-qinq] classifier A20 behavior P200

[PE1-qospolicy-qinq] quit

# 使能端口的基本QinQ功能。

[PE1] interface Gigabitethernet1/0/1

[PE1-GigabitEthernet1/0/1] qinq enable

# GigabitEthernet1/0/1端口的接收方向应用“qinq”规则。

[PE1-GigabitEthernet1/0/1] qos apply policy qinq inbound

·     配置端口GigabitEthernet1/0/2

# 配置端口为Trunk端口,且允许VLAN 100和200的报文通过。

[PE1] interface gigabitethernet 1/0/2

[PE1-GigabitEthernet1/0/2] port link-type trunk

[PE1-GigabitEthernet1/0/2] port trunk permit vlan 100 200

# 配置端口添加的外层Tag的TPID值为0x8200。

[PE1-GigabitEthernet1/0/2] qinq ethernet-type service-tag 8200

[PE1-GigabitEthernet1/0/2] quit

(2)     配置PE 2

·     配置端口GigabitEthernet1/0/1

# 配置端口为Hybrid端口,且允许VLAN 100和200的报文不带Tag通过。

<PE2> system-view

[PE2] interface gigabitethernet 1/0/1

[PE2-GigabitEthernet1/0/1] port link-type hybrid

[PE2-GigabitEthernet1/0/1] port hybrid vlan 100 200 untagged

[PE2-GigabitEthernet1/0/1] quit

# 创建流分类规则,将来自Site 2VLAN10的报文定义为“A10”类。

[PE2] traffic classifier A10

[PE2-classifier-A10] if-match customer-vlan-id 10

[PE2-classifier-A10] quit

# 定义流行为,为报文封装VLAN100的外层VLAN Tag,流行为命名为“P100”。

[PE2] traffic behavior P100

[PE2-behavior-P100] nest top-most vlan-id 100

[PE2-behavior-P100] quit

# 与以上配置类似,创建流分类“A20”匹配用户VLAN ID为20的报文,并创建流行为“P200”,为此类报文封装外层VLAN200的Tag。

[PE2] traffic classifier A20

[PE2-classifier-A20] if-match customer-vlan-id 20

[PE2-classifier-A20] quit

[PE2] traffic behavior P200

[PE2-behavior-P200] nest top-most vlan-id 200

[PE2-behavior-P200] quit

# 创建QoS策略,将流分类“A10”和流行为“P100”进行关联,将流分类“A20”和流行为“P200”关联,策略命名为“qinq”。

[PE2] qos policy qinq

[PE2-qospolicy-qinq] classifier A10 behavior P100

[PE2-qospolicy-qinq] classifier A20 behavior P200

[PE2-qospolicy-qinq] quit

# 使能端口的基本QinQ功能。

[PE2-GigabitEthernet1/0/1] qinq enable

# GigabitEthernet1/0/1端口的接收方向应用“qinq”规则。

[PE2-GigabitEthernet1/0/1] qos apply policy qinq inbound

·     配置端口GigabitEthernet1/0/2

# 配置端口为Trunk端口,且允许VLAN 100和200的报文通过。

[PE2] interface gigabitethernet 1/0/2

[PE2-GigabitEthernet1/0/2] port link-type trunk

[PE2-GigabitEthernet1/0/2] port trunk permit vlan 100 200

# 配置端口添加的外层Tag的TPID值为0x8200。

[PE2-GigabitEthernet1/0/2] qinq ethernet-type service-tag 8200

[PE2-GigabitEthernet1/0/2] quit

(3)     配置第三方厂商设备

对于PE 1与PE 2之间的第三方厂商设备,其关键配置如下:在连通PE 1与PE 2的端口上,都允许VLAN 100和200的报文携带VLAN Tag通过。

1.6.4  灵活QinQ配置举例二

1. 组网需求

·     公司A的语音和数据业务分别使用VLAN 10和VLAN 20加以区分,而公司B的语音和数据业务则分别使用VLAN 30和VLAN 40加以区分。随着这两家公司的合并,需要在不改变现有VLAN划分的前提下将其网络进行整合。

·     PE 1和PE 2为运营商网络的边缘设备,且二者通过TPID值为0x8200的第三方厂商设备进行连接。

·     通过配置,利用运营商提供的VLAN 100和VLAN 200分别使这两家公司间的语音和数据业务实现互通。

2. 组网图

图1-7 灵活QinQ配置组网图二

 

3. 配置步骤

说明

用户必须通过配置保证运营商网络中的设备之间允许QinQ报文通过。

 

(1)     配置PE 1

·     配置端口GigabitEthernet1/0/1

# 配置端口为Hybrid端口,且允许VLAN 100和200的报文不带Tag通过。

<PE1> system-view

[PE1] interface gigabitethernet 1/0/1

[PE1-GigabitEthernet1/0/1] port link-type hybrid

[PE1-GigabitEthernet1/0/1] port hybrid vlan 100 200 untagged

[PE1-GigabitEthernet1/0/1] quit

# 创建流分类规则,将来自VLAN10的报文定义为“A10”类。

[PE1] traffic classifier A10

[PE1-classifier-A10] if-match customer-vlan-id 10

[PE1-classifier-A10] quit

# 定义流行为,为报文封装VLAN100的外层VLAN Tag,流行为命名为“P100”。

[PE1] traffic behavior P100

[PE1-behavior-P100] nest top-most vlan-id 100

[PE1-behavior-P100] quit

# 与以上配置类似,创建流分类“A20”匹配用户VLAN ID为20的报文,并创建流行为“P200”,为此类报文封装外层VLAN200的Tag

[PE1] traffic classifier A20

[PE1-classifier-A20] if-match customer-vlan-id 20

[PE1-classifier-A20] quit

[PE1] traffic behavior P200

[PE1-behavior-P200] nest top-most vlan-id 200

[PE1-behavior-P200] quit

# 创建QoS策略,将流分类“A10”和流行为“P100”进行关联,将流分类“A20”和流行为“P200”关联,策略命名为“qinq”。

[PE1] qos policy qinq

[PE1-qospolicy-qinq] classifier A10 behavior P100

[PE1-qospolicy-qinq] classifier A20 behavior P200

[PE1-qospolicy-qinq] quit

# 使能端口的基本QinQ功能。

[PE1-GigabitEthernet1/0/1] qinq enable

# GigabitEthernet1/0/1端口的接收方向应用“qinq”规则。

[PE1-GigabitEthernet1/0/1] qos apply policy qinq inbound

·     配置端口GigabitEthernet1/0/2

# 配置端口为Trunk端口,且允许VLAN 100和200的报文通过。

[PE1] interface gigabitethernet 1/0/2

[PE1-GigabitEthernet1/0/2] port link-type trunk

[PE1-GigabitEthernet1/0/2] port trunk permit vlan 100 200

# 创建流分类规则,将内层VLAN ID是10,外层VLAN ID100的报文定义为“A100”类。

[PE1] traffic classifier A100

[PE1-classifier-A100] if-match customer-vlan-id 10

[PE1-classifier-A100] if-match service-vlan-id 100

[PE1-classifier-A100] quit

# 定义流行为,修改报文的内层VLAN ID为30,流行为命名为“T100”。

[PE1] traffic behavior T100

[PE1-behavior-T100] remark customer-vlan-id 30

[PE1-behavior-T100] quit

# 创建流分类规则,将内层VLAN ID是20,外层VLAN ID200的报文定义为“A200”类。

[PE1] traffic classifier A200

[PE1-classifier-A200] if-match customer-vlan-id 20

[PE1-classifier-A200] if-match service-vlan-id 200

[PE1-classifier-A200] quit

# 定义流行为,修改报文的内层VLAN ID为40,流行为命名为“T200”。

[PE1] traffic behavior T200

[PE1-behavior-T200] remark customer-vlan-id 40

[PE1-behavior-T200] quit

# 创建QoS策略,将流分类“A100”和流行为“T100”进行关联,流分类“A200”和流行为“T200”进行关联,策略命名为“sqinq”。

[PE1] qos policy sqinq

[PE1-qospolicy- sqinq] classifier A100 behavior T100

[PE1-qospolicy- sqinq] classifier A200 behavior T200

[PE1-qospolicy- sqinq] quit

# GigabitEthernet1/0/2端口的发送方向应用“sqinq”规则。

[PE1-GigabitEthernet1/0/2] qos apply policy sqinq outbound

# 配置端口添加的外层VLAN Tag的TPID值为0x8200。

[PE1-GigabitEthernet1/0/2] qinq ethernet-type service-tag 8200

[PE1-GigabitEthernet1/0/2] quit

(2)     配置PE 2

·     配置端口GigabitEthernet1/0/1

# 配置端口为Hybrid端口,且允许VLAN 100和200的报文不带Tag通过。

<PE2> system-view

[PE2] interface gigabitethernet 1/0/1

[PE2-GigabitEthernet1/0/1] port link-type hybrid

[PE2-GigabitEthernet1/0/1] port hybrid vlan 100 200 untagged

[PE2-GigabitEthernet1/0/1] quit

# 创建流分类规则,将来自VLAN30的报文定义为“A30”类。

[PE2] traffic classifier A30

[PE2-classifier-A30] if-match customer-vlan-id 30

[PE2-classifier-A30] quit

# 定义流行为,为报文封装VLAN100的外层VLAN Tag,流行为命名为“P100”。

[PE2] traffic behavior P100

[PE2-behavior-P100] nest top-most vlan-id 100

[PE2-behavior-P100] quit

# 与以上配置类似,创建流分类“A40”匹配用户VLAN ID为40的报文,并创建流行为“P200”,为此类报文封装外层VLAN200的Tag。

[PE2] traffic classifier A40

[PE2-classifier-A40] if-match customer-vlan-id 40

[PE2-classifier-A40] quit

[PE2] traffic behavior P200

[PE2-behavior-P200] nest top-most vlan-id 200

[PE2-behavior-P200] quit

# 创建QoS策略,将流分类“A30”和流行为“P100”进行关联,将流分类“A40”和流行为“P200”关联,策略命名为“qinq”。

[PE2] qos policy qinq

[PE2-qospolicy-qinq] classifier A30 behavior P100

[PE2-qospolicy-qinq] classifier A40 behavior P200

[PE2-qospolicy-qinq] quit

# 使能端口的基本QinQ功能。

[PE2-GigabitEthernet1/0/1] qinq enable

# GigabitEthernet1/0/1端口的接收方向应用“qinq”规则。

[PE2-GigabitEthernet1/0/1] qos apply policy qinq inbound

·     配置端口GigabitEthernet1/0/2

# 配置端口为Trunk端口,且允许VLAN 100和200的报文通过。

[PE2] interface gigabitethernet 1/0/2

[PE2-GigabitEthernet1/0/2] port link-type trunk

[PE2-GigabitEthernet1/0/2] port trunk permit vlan 100 200

# 创建流分类规则,将内层VLAN ID是30,外层VLAN ID100的报文定义为“A100”类。

[PE2] traffic classifier A100

[PE2-classifier-A100] if-match customer-vlan-id 30

[PE2-classifier-A100] if-match service-vlan-id 100

[PE2-classifier-A100] quit

# 定义流行为,修改报文的内层VLAN ID为10,流行为命名为“T100”。

[PE2] traffic behavior T100

[PE2-behavior-T100] remark customer-vlan-id 10

[PE2-behavior-T100] quit

# 创建流分类规则,将内层VLAN ID是40,外层VLAN ID200的报文定义为“A200”类。

[PE2] traffic classifier A200

[PE2-classifier-A200] if-match customer-vlan-id 40

[PE2-classifier-A200] if-match service-vlan-id 200

[PE2-classifier-A200] quit

# 定义流行为,修改报文的内层VLAN ID为20,流行为命名为“T200”。

[PE2] traffic behavior T200

[PE2-behavior-T200] remark customer-vlan-id 20

[PE2-behavior-T200] quit

# 创建QoS策略,将流分类“A100”和流行为“T100”进行关联,流分类“A200”和流行为“T200”进行关联,策略命名为“sqinq”。

[PE2] qos policy sqinq

[PE2-qospolicy- sqinq] classifier A100 behavior T100

[PE2-qospolicy- sqinq] classifier A200 behavior T200

[PE2-qospolicy- sqinq] quit

# GigabitEthernet1/0/2端口的发送方向应用“sqinq”规则。

[PE2] interface gigabitethernet 1/0/2

[PE2-GigabitEthernet1/0/2] qos apply policy sqinq outbound

# 配置端口添加的外层VLAN Tag的TPID值为0x8200。

[PE2-GigabitEthernet1/0/2] qinq ethernet-type service-tag 8200

[PE2-GigabitEthernet1/0/2] quit

(3)     配置第三方厂商设备

对于PE 1与PE 2之间的第三方厂商设备,其关键配置如下:在连通PE 1与PE 2的端口上,都允许VLAN 100和200的报文携带VLAN Tag通过。

 

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们