ON THIS PAGE
示例:配置基于 MPLS 的第2层 Vpn
您可以使用 Junos OS 路由设备实施基于 MPLS 的2层虚拟专用网(VPN),以2层技术互连客户站点。2层 Vpn 让客户能够完全控制自己的路由。要支持基于 MPLS 的第2层 VPN,您需要向两个提供商边缘(PE)路由设备的配置中添加组件。您无需更改提供商设备的配置。
此示例演示如何配置基于 MPLS 的第2层 VPN。
您可以在同一设备上同时配置基于 MPLS 的 l2 vpn 和基于 MPLS 的第3层 VPN。但是,您不能将相同的客户边缘接口配置为同时支持第2层 VPN 和第3层 VPN。核心接口和回传接口的配置方式与第2层 Vpn 和第3层 Vpn 相同。
要求
此示例使用以下硬件和软件组件:
如果您使用 EX 系列交换机,则 Junos OS 版本11.1 或更高版本
两个 PE 路由设备
配置第2层 VPN 组件之前,请配置 MPLS 网络的基本组件:
配置两个 PE 路由设备。请参阅使用电路交叉连接在提供商边缘 EX8200 和 EX4500 交换机上配置 MPLS (CLI 过程)。
配置一个或多个提供商设备。请参阅在 EX8200 和 EX4500 提供商交换机上配置 MPLS (CLI 过程)。
第2层 VPN 要求使用电路交叉连接(CCC)配置 PE 路由设备。提供商路由设备的配置方式与使用 CCC 和 MPLS 上的 IP 的 MPLS 相同。
概述和拓扑
第2层 VPN 提供提供商’网络和客户’网络—之间的完全分离,PE 设备和 CE 设备不交换路由信息。第2层 VPN 的一些优势是私有、安全且灵活。
此示例说明如何在本地和远程 PE 设备上配置2层 VPN 组件。此示例不包括配置提供商设备,因为提供商设备上没有特定的第2层 VPN 组件。
在使用电路交叉连接(CCC)的 PE 设备的基本 MPLS 配置中,PE 设备配置为使用内部网关协议(IGP)(如 OSPF 或 IS-IS)作为 MPLS 设备和 LDP 或 RSVP 之间的路由协议作为信号传输protocol. 流量工程已启用。在[edit protocols]层次结构内配置标签交换路径(LSP)。但是,与使用 CCC 的基本 MPLS 配置不同,您无需将 LSP 与客户边缘接口相关联。配置第2层 VPN 时,必须使用 BGP 信号。BGP 信号实现了连接自动化,因此不需要手动配置 LSP 与客户边缘接口之间的关联。
以下组件必须添加到基于 MPLS 的第 2 层 VPN 的 PE 路由设备中:
BGP 组,family l2vpn signaling
使用实例类型的路由实例l2vpn
物理层封装类型(ethernet)必须在客户边缘接口上指定,而且必须在路由实例的配置中指定封装类型。
图 1展示了此基于 MPLS 的第2层 VPN 的拓扑结构。

表 1显示了本地 CE 设备上的客户边缘接口的设置。
表 1: 基于 MPLS 的第2层 VPN 拓扑中的本地 CE 路由设备
财产 | 设置 | Description |
---|---|---|
本地 CE 路由设备硬件 | 路由设备 | CE1 |
客户边缘接口 | ge-0/0/0 unit 0 | 用于将 CE1 连接到 PE1 的接口。 |
表 2显示了远程 CE 路由设备上的客户边缘接口的设置。
表 2: 基于 MPLS 的第2层 VPN 拓扑中的远程 CE 路由设备
财产 | 设置 | Description |
---|---|---|
远程 CE 路由设备硬件 | 路由设备 | CE2 |
客户边缘接口 | ge-0/0/0 unit 0 | 用于将 CE2 连接到 PE2 的接口。 |
表 3显示了本地 PE 路由设备的第2层 VPN 组件。
表 3: 本地 PE 路由设备的第2层 VPN 组件
财产 | 设置 | Description |
---|---|---|
本地 PE 路由设备硬件 | 路由设备 | PE1 |
客户边缘接口 | ge-5/0/0 | 将 PE1 连接到 CE1。 对于第2层 VPN,添加ethernet-ccc为物理层封装类型。 注意: family ccc已作为 PE 路由设备基本 MPLS 配置的一部分完成了电路交叉连接。此处包含的内容显示了为该部分配置指定的情况。 |
核心接口 | xe-6/0/0 unit 0 | 将 PE1 连接到 P。 注意: 配置的这一部分已作为基本 MPLS 配置的一部分完成。此处包含的内容显示了为该部分配置指定的情况。 |
环回接口 | lo0 unit 0 | 注意: 配置的这一部分已作为基本 MPLS 配置的一部分完成。此处包含的内容显示了为该部分配置指定的情况。 |
BGP | bgp | 为第2层 VPN 配置添加。 |
路由实例 | vpn1 | 为第2层 VPN 配置添加 |
表 4显示了远程 PE 路由设备的第2层 VPN 组件。
表 4: 远程 PE 路由设备的第2层 VPN 组件
财产 | 设置 | Description |
---|---|---|
PE 路由设备硬件 | 路由设备 | PE2 |
客户边缘接口 | ge-11/0/0 | 将 PE2 连接到 CE2。 对于第2层 VPN,添加ethernet-ccc为物理层封装类型。 注意: family ccc已作为 PE 路由设备基本 MPLS 配置的一部分完成了电路交叉连接。此处包含的内容显示了为该部分配置指定的情况。 |
核心接口 | xe-6/0/0 unit 0 | 将 PE2 连接到 P。 注意: 配置的这一部分已作为基本 MPLS 配置的一部分完成。此处包含的内容显示了为该部分配置指定的情况。 |
环回接口 | lo0 unit 0 | 注意: 配置的这一部分已作为基本 MPLS 配置的一部分完成。此处包含的内容显示了为该部分配置指定的情况。 |
BGP | bgp | 为第2层 VPN 配置添加。 |
路由实例 | vpn1 | 为第2层 VPN 配置添加。 |
配置本地 PE 路由设备
CLI 快速配置
要在本地 PE 路由设备上快速配置第2层 VPN 组件,请复制以下命令并将其粘贴到路由设备的终端窗口中:
[edit]
set interfaces ge-5/0/0
encapsulation ethernet-ccc
set protocols bgp group ibgp local-address 192.0.2.0 family l2vpn
signaling
set protocols
bgp group ibgp type internal
set protocols bgp group ibgp neighbor 192.0.2.3
set routing-instances vpn1 instance-type l2vpn
set routing-instances vpn1 interface
ge-5/0/0
set routing-instances
vpn1 route-distinguisher 192.0.2.0:21
set routing-instances vpn1 vrf-target target:21:21
set routing-instances vpn1 protocols
l2vpn encapsulation-type ethernet
set routing-instances vpn1 protocols l2vpn interface ge-5/0/0.0 description
"BETWEEN PE1 AND CE1"
set routing-instances vpn1 protocols l2vpn
site JE-V21 site-identifier 21 interface ge-5/0/0 remote-site-id 26
分步过程
要在本地 PE 路由设备上配置第2层 VPN 组件:
- 将客户边缘接口配置为使用物理封装类型ethernet-ccc:
[edit]
user@PE1# set interfaces ge-5/0/0 encapsulation ethernet-ccc - 配置 BGP,将回传地址指定为本地地址并启用family l2vpn signaling:
[edit protocols bgp]
user@PE1# set group ibgp local-address 192.0.2.0 family l2vpn signaling - 配置 BGP 组,指定组名称和类型:
- 配置 BGP 邻居,并将远程 PE 路由设备的回传地址指定为邻居’地址:
[edit protocols bgp]
user@PE1# set group ibgp neighbor 192.0.2.3/24 - 配置路由实例,指定路由实例名称并使用l2vpn as 实例类型:
[edit routing-instances]
user@PE1# set vpn1 instance-type l2vpn - 配置要应用于客户边缘接口的路由实例:
[edit routing-instances]
user@PE1# set vpn1 interface ge-5/0/0 - 将路由实例配置为使用路由 distinguisher:
[edit routing-instances]
user@PE1# set vpn1 route-distinguisher 192.0.2.0:21 - 配置路由实例的 VPN 路由和转发(VRF)目标:
[edit routing-instances]
user@PE1# set vpn1 vrf-target target:21:21注意 您可以使用导入和导出选项来显式配置 VRF 的导入和导出策略,从而创建更复杂的策略。请参阅《 Junos OS Vpn 配置指南》。
- 配置路由实例使用的协议和封装类型:
[edit routing-instances]
user@PE1# set vpn1 protocols l2vpn encapsulation-type ethernet - 将路由实例应用于客户边缘接口并指定其说明:
[edit routing-instances]
user@PE1# set vpn1 protocols interface ge-5/0/0.0 description "BETWEEN PE1 AND CE1" - 配置路由实例协议站点:
[edit routing-instances]
user@PE1# set vpn1 protocols l2vpn site JE-V21 site-identifier 21remote-site-id 26注意 远程站点 ID (与remote-site-id语句一起配置)对应于在其他 PE 路由设备上配置的site-identifier站点 ID (配置为语句)。
结果
显示配置结果:
user@PE1# show
配置远程 PE 路由设备
CLI 快速配置
要在远程 PE 路由设备上快速配置2层 VPN 组件,请复制以下命令并将其粘贴到路由设备的终端窗口中:
[edit]
set interfaces ge-11/0/0
encapsulation ethernet-ccc
set protocols bgp group ibgp local-address 192.0.2.3 family l2vpn
signaling
set protocols
bgp group ibgp type internal
set protocols bgp group ibgp neighbor 192.0.2.0
set routing-instances vpn1 instance-type l2vpn
set routing-instances vpn1 interface
ge-11/0/0
set routing-instances
vpn1 route-distinguisher 192.0.2.0:21
set routing-instances vpn1 vrf-target target:21:21
set routing-instances vpn1 protocols
l2vpn encapsulation-type ethernet
set routing-instances vpn1 protocols l2vpn interface ge-11/0/0.0
description "BETWEEN PE1 AND CE1"
set routing-instances vpn1 protocols l2vpn
site T26-VPN1 site-identifier 26 remote-site-id 21
分步过程
要在远程 PE 路由设备上配置第2层 VPN 组件:
- 将客户边缘接口配置为使用物理封装类型ethernet-ccc:
[edit]
user@PE1# set interfaces ge-11/0/0 encapsulation ethernet-ccc - 配置 BGP,将回传地址指定为local-address并指定: family l2vpn signaling
[edit protocols bgp]
user@PE2# set group ibgp local-address 192.0.2.3 family l2vpn signaling - 配置 BGP 组,指定组名称和类型:
[edit protocols bgp]
user@PE2# set group ibgp type internal - 配置 BGP 邻居,并将远程 PE 路由设备的回传地址指定为邻居’地址:
[edit protocols bgp]
user@PE2# set group ibgp neighbor 192.0.2.0 - 配置路由实例,指定路由实例名称并使用l2vpn作为: instance-type
[edit routing-instances]
user@PE2# set vpn1 instance-type l2vpn - 配置要应用于客户边缘接口的路由实例:
[edit routing-instances]
user@PE2# set vpn1 interface ge-11/0/0.0 - 将路由实例配置为使用路由 distinguisher,格式为 ip 地址:编号可以:
[edit routing-instances]
user@PE2# set vpn1 route-distinguisher 192.0.2.0:21 - 配置路由实例的 VPN 路由和转发(VRF)目标:
[edit routing-instances]
user@PE2# set vpn1 vrf-target target:21:21 - 配置路由实例使用的协议和封装类型:
[edit routing-instances]
user@PE2# set vpn1 protocols l2vpn encapsulation-type ethernet - 将路由实例应用于客户边缘接口并指定其说明:
[edit routing-instances]
user@PE1# set vpn1 protocols interface ge-11/0/0.0 description "BETWEEN PE1 AND CE1" - 配置路由实例协议站点:
[edit routing-instances]
user@PE2# set vpn1 protocols l2vpn site T26-VPN1 site-identifier 26 remote-site-id 21注意 远程站点 ID (与remote-site-id语句一起配置)对应于在其他 PE 路由设备上配置的site-identifier站点 ID (配置为语句)。
结果
显示配置结果:
user@PE2# show
针对
要确认基于 MPLS 的第2层 VPN 是否正常工作,请执行以下任务:
验证2层 VPN 连接
用途
验证2层 VPN 连接是否正常。
操作
user@PE1> show l2vpn connections
Layer-2 VPN connections: Legend for connection status (St) EI -- encapsulation invalid NC -- interface encapsulation not CCC/TCC/VPLS EM -- encapsulation mismatch WE -- interface and instance encaps not same VC-Dn -- Virtual circuit down NP -- interface hardware not present CM -- control-word mismatch -> -- only outbound connection is up CN -- circuit not provisioned <- -- only inbound connection is up OR -- out of range Up -- operational OL -- no outgoing label Dn -- down LD -- local site signaled down CF -- call admission control failure RD -- remote site signaled down SC -- local and remote site ID collision LN -- local site not designated LM -- local site ID not minimum designated RN -- remote site not designated RM -- remote site ID not minimum designated XX -- unknown connection status IL -- no incoming label MM -- MTU mismatch MI -- Mesh-Group ID not availble BK -- Backup connection ST -- Standby connection PF -- Profile parse failure PB -- Profile busy RS -- remote site standby SN -- Static Neighbor Legend for interface status Up -- operational Dn -- down Instance: vpn1 Local site: JE-V21 (21) connection-site Type St Time last up # Up trans 26 rmt Up Apr 16 05:53:21 2010 1 Remote PE: 192.0.2.3, Negotiated control-word: Yes (Null) Incoming label: 800000, Outgoing label: 800001 Local interface: ge-5/0/0.0, Status: Up, Encapsulation: ETHERNET
含义
输出St中的字段显示为Remote PE (192.0.2.3)的第2层 VPN 连接已启动。
验证 MPLS 标签交换路径的状态
用途
验证 MPLS 标签交换路径(入口和出口)是否正常。
操作
user@PE1> 显示 mpls lsp
Ingress LSP: 1 sessions To From State Rt P ActivePath LSPname 192.0.2.3 192.0.2.0 Up 0 * lsp_to_pe2 Total 1 displayed, Up 1, Down 0 Egress LSP: 1 sessions To From State Rt Style Labelin Labelout LSPname 192.0.2.0 192.0.2.3 Up 0 1 FF 3 - lsp_to_pe1 Total 1 displayed, Up 1, Down 0 Transit LSP: 0 sessions Total 0 displayed, Up 0, Down 0
含义
输出State中的字段显示入口 lsp 到Remote PE (192.0.2.3)已开启,而从远程 PE 路由设备到此 PE 路由设备(192.0.2.0)的出口 LSP 也为 up。
验证 BGP 状态
用途
验证 BGP 是否开启。
操作
user@PE1> 显示 bgp 摘要
Groups: 1 Peers: 1 Down peers: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending bgp.l2vpn.0 1 1 0 0 0 0 Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped... 192.0.2.3 10 33 34 0 1 13:24 Establ bgp.l2vpn.0: 1/1/1/0 vpn2.l2vpn.0: 1/1/1/0
含义
输出显示远程 PE 路由设备(192.0.2.3)列出为 BGP 对等体,并且已建立协议会话。它还显示从远程 PE 路由设备(33)接收的数据包数,以及发送34到远程 pe 路由设备的数据包数量。
验证 RSVP 会话的状态
用途
验证 RSVP 会话(入口和出口)是否正常。
操作
user@PE1> 显示 rsvp 会话
Ingress RSVP: 1 sessions To From State Rt Style Labelin Labelout LSPname 192.0.2.3 192.0.2.0 Up 0 1 FF - 462880 lsp_to_pe2 Total 1 displayed, Up 1, Down 0 Egress RSVP: 1 sessions To From State Rt Style Labelin Labelout LSPname 192.0.2.0 192.0.2.3 Up 0 1 FF 3 - lsp_to_pe1 Total 1 displayed, Up 1, Down 0 Transit RSVP: 0 sessions Total 0 displayed, Up 0, Down 0
含义
输出显示入口 RSVP 会话和出局 RSVP 会话均已启动。
验证路由表中的路由
用途
在路由设备 PE 1 上,使用show route table命令验证路由表是否使用用于转发信息流的第2层 VPN 路由进行填充。
操作
user@PE1> 显示路由表 bgp.l2vpn.0
bgp.l2vpn.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 192:2:27:27/96 *[BGP/170] 00:13:55, localpref 100, from 192.0.2.3 AS path: I > to 10.2.0.24 via ge-6/0/46.0, label-switched-path lsp_to_pe2
user@PE1> 显示路由表 vpn1.l2vpn.0
vpn1.l2vpn.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 192:2:27:27/96 *[BGP/170] 00:14:00, localpref 100, from 192.0.2.3 AS path: I > to 10.2.0.24 via ge-6/0/46.0, label-switched-path lsp_to_pe2 192:2:28:27/96 *[L2VPN/170/-101] 00:15:55, metric2 1 Indirect
含义
此命令show route table bgp.l2vpn.0显示在此路由设备上创建的所有第2层 VPN 路由。此命令show route table vpn1.l2vpn.0显示为路由实例vpn1创建的第2层 VPN 路由。
Ping 第2层 VPN 连接
用途
验证连接。
操作
user@PE1> ping mpls l2vpn interface xe-6/0/0.0 reply-mode ip-udp
!!!!! --- lsping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss
user@PE1> ping mpls l2vpn instance vpn1 remote-site-id 26 local-site-id 21
detail
Request for seq 1, to interface 68, labels <800001, 100176> Reply for seq 1, return code: Egress-ok Request for seq 2, to interface 68, labels <800001, 100176> Reply for seq 2, return code: Egress-ok Request for seq 3, to interface 68, labels <800001, 100176> Reply for seq 3, return code: Egress-ok Request for seq 4, to interface 68, labels <800001, 100176> Reply for seq 4, return code: Egress-ok Request for seq 5, to interface 68, labels <800001, 100176> Reply for seq 5, return code: Egress-ok --- lsping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss
含义
输出显示连接已建立。