示例:配置基于 MPLS 的第 2 层 VPN
此示例说明如何在运行 Junos OS 的路由器或交换机上配置和验证基于 MPLS 的第 2 层 VPN。
我们的内容测试团队已验证并更新了此示例。
您可以使用运行 Junos OS 的路由器和交换机部署基于 MPLS 的第 2 层虚拟专用网,从而将客户站点与第 2 层连接互连。第 2 层 VPN 让客户可以完全控制他们选择的传输和路由协议。
基于 MPLS 的 VPN 需要提供商网络中的基准 MPLS 功能。基本 MPLS 正常运行后,您就可以配置使用标签交换路径 (LSP) 通过提供商核心进行传输的 VPN。
添加 VPN 服务不会影响提供商网络中的基本 MPLS 交换作。事实上,提供商 (P) 设备不需要基准 MPLS 配置,因为它们不支持 VPN。VPN 状态仅在 PE 设备上维护。这也是基于 MPLS 的 VPN 具有可扩展性的关键原因。
要求
此示例使用以下硬件和软件组件:
Junos OS 15.1 或更高版本
在 Junos OS 20.1R1 版上重新验证
两个提供商边缘 (PE) 设备
一个提供商 (P) 设备
两台客户边缘 (客户边缘) 设备
此示例重点介绍如何将第 2 层 VPN 添加到预先存在的 MPLS 基准。如果您的网络尚未部署 MPLS,将提供基本 MPLS 配置。
要支持基于 MPLS 的 VPN,底层 MPLS 基准必须提供以下功能:
面向核心和环路接口,支持 MPLS 系列
一种内部网关协议,例如 OSPF 或 IS-IS,用于在提供商(P 和 PE)设备的环路地址之间提供可达性
一种 MPLS 信令协议,例如 LDP 或 RSVP,用于向 LSP 发出信号
在 PE 设备环路地址之间建立的 LSP
在加入给定 VPN 的每对 PE 设备之间都需要 LSP。最好在所有 PE 设备之间构建 LSP,以适应未来的 VPN 增长。您在层次结构级别配置 [edit protocols mpls] LSP。与电路交叉连接 (CCC) 的 MPLS 配置不同,您无需手动将 LSP 与 PE 设备的面向客户(边缘)接口相关联。相反,第 2 层 VPN 使用 BGP 信令来传达第 2 层站点可达性。此 BGP 信令可自动将远程第 2 层 VPN 站点映射到 LSP 转发下一跃点。这意味着,使用 L2 VPN 时,不需要将 LSP 显式映射到 PE 设备面向边缘的接口。
有关 CCC 的详细信息,请参阅 使用第 2 层电路配置基于 MPLS 的 VLAN CCC。
概述和拓扑
第 2 层 VPN 可以在提供商网络和客户网络之间实现完全隔离。第 2 层 VPN 的优势包括支持非标准传输协议,以及隔离客户和提供商网络之间的链路寻址和路由协议作。
VPN 的定义仅涉及对本地和远程 PE 设备的更改。提供商设备不需要进行其他配置(除了基准 MPLS 支持),因为这些设备仅提供基本的 MPLS 交换功能。客户边缘设备不使用 MPLS。它们只需要一个基本接口,并根据需要进行协议配置,即可通过第 2 层 VPN 运行。对于第 2 层 VPN,您可以将客户边缘设备作为连接到共享链路一样进行配置。
建立 MPLS 基准后,您必须在 PE 设备上配置以下功能,以建立基于 MPLS 的第 2 层 VPN:
一个 BGP 组
family l2vpn signaling实例类型为
l2vpnPE 设备上面向客户的接口必须按如下方式配置:
指定或
vlan-ccc物理ethernet-ccc层封装,具体取决于是否使用 VLAN 标记。在路由实例配置中配置匹配的封装类型。
使用
family ccc配置用于第 2 层 VPN 的逻辑接口(单元)。
图 1 提供了此基于 MPLS 的第 2 层 VPN 示例的拓扑结构。该图详细介绍了提供商网络中使用的接口名称、IP 寻址和协议。报告还强调了客户边缘设备寻址和协议堆栈作的端到端性质。与第 3 层 VPN 不同,客户边缘设备作对第 2 层 VPN 中的提供商网络不透明。客户边缘设备与提供商网络之间没有对等关系。因此,您希望客户边缘设备跨提供商网络(而不是提供商网络)形成 OSPF 邻接。
快速配置
使用本部分中的配置快速启动并运行基于 MPLS 的第 2 层 VPN。这些配置包括一个有效的 MPLS 基准,可支持您的第 2 层 VPN。此示例重点介绍配置的 VPN 方面。有关此示例中使用的基准 MPLS 功能的更多信息,请参阅以下链接:
CLI 快速配置
设备配置省略了管理接口、静态路由、系统日志记录、系统服务和用户登录信息。配置的这些部分因位置而异,并且与 MPLS 或 VPN 功能没有直接关系。
根据环境的具体情况编辑以下命令,并将其粘贴到本地客户边缘 (CE1) 设备终端窗口中:
CE1 设备的完整配置。
set system host-name ce1 set interfaces ge-0/0/0 description "Link from CE1 to PE1" set interfaces ge-0/0/0 unit 0 family inet address 172.16.1.1/30 set interfaces lo0 unit 0 family inet address 172.16.255.1/32 set protocols ospf area 0.0.0.0 interface lo0.0 set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
根据环境细节编辑以下命令,并将其粘贴到本地 PE (PE1) 设备终端窗口中:
PE1 设备的完整配置。
set system host-name pe1 set interfaces ge-0/0/0 description "Link from PE1 to CE1" set interfaces ge-0/0/0 encapsulation ethernet-ccc set interfaces ge-0/0/0 unit 0 family ccc set interfaces ge-0/0/1 description "Link from PE1 to P-router" set interfaces ge-0/0/1 mtu 4000 set interfaces ge-0/0/1 unit 0 family inet address 10.1.23.1/24 set interfaces ge-0/0/1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.0.1/32 set routing-instances l2vpn1 protocols l2vpn interface ge-0/0/0.0 description "EDGE LINK BETWEEN PE1 AND CE1" set routing-instances l2vpn1 protocols l2vpn site CE-1 interface ge-0/0/0.0 remote-site-id 2 set routing-instances l2vpn1 protocols l2vpn site CE-1 site-identifier 1 set routing-instances l2vpn1 protocols l2vpn encapsulation-type ethernet set routing-instances l2vpn1 instance-type l2vpn set routing-instances l2vpn1 interface ge-0/0/0.0 set routing-instances l2vpn1 route-distinguisher 192.168.0.1:12 set routing-instances l2vpn1 vrf-target target:65412:12 set routing-options autonomous-system 65412 set protocols bgp group ibgp type internal set protocols bgp group ibgp local-address 192.168.0.1 set protocols bgp group ibgp family l2vpn signaling set protocols bgp group ibgp neighbor 192.168.0.3 set protocols mpls label-switched-path lsp_to_pe2 to 192.168.0.3 set protocols mpls interface ge-0/0/1.0 set protocols ospf traffic-engineering set protocols ospf area 0.0.0.0 interface lo0.0 set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 set protocols rsvp interface lo0.0 set protocols rsvp interface ge-0/0/1.0
P 设备的完整配置。
set system host-name p set interfaces ge-0/0/0 description "Link from P-router to PE1" set interfaces ge-0/0/0 mtu 4000 set interfaces ge-0/0/0 unit 0 family inet address 10.1.23.2/24 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 description "Link from P-router to PE2" set interfaces ge-0/0/1 mtu 4000 set interfaces ge-0/0/1 unit 0 family inet address 10.1.34.1/24 set interfaces ge-0/0/1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.0.2/32 set protocols mpls interface ge-0/0/0.0 set protocols mpls interface ge-0/0/1.0 set protocols ospf traffic-engineering set protocols ospf area 0.0.0.0 interface lo0.0 set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 set protocols rsvp interface lo0.0 set protocols rsvp interface ge-0/0/0.0 set protocols rsvp interface ge-0/0/1.0
PE2 设备的完整配置。
set system host-name pe2 set interfaces ge-0/0/0 description "Link from PE2 to CE2" set interfaces ge-0/0/0 encapsulation ethernet-ccc set interfaces ge-0/0/0 unit 0 family ccc set interfaces ge-0/0/1 description "Link from PE2 to P-router" set interfaces ge-0/0/1 mtu 4000 set interfaces ge-0/0/1 unit 0 family inet address 10.1.34.2/24 set interfaces ge-0/0/1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.0.3/32 set routing-instances l2vpn1 protocols l2vpn interface ge-0/0/0.0 description "EDGE LINK BETWEEN PE2 AND CE2" set routing-instances l2vpn1 protocols l2vpn site CE-2 interface ge-0/0/0.0 remote-site-id 1 set routing-instances l2vpn1 protocols l2vpn site CE-2 site-identifier 2 set routing-instances l2vpn1 protocols l2vpn encapsulation-type ethernet set routing-instances l2vpn1 instance-type l2vpn set routing-instances l2vpn1 interface ge-0/0/0.0 set routing-instances l2vpn1 route-distinguisher 192.168.0.3:12 set routing-instances l2vpn1 vrf-target target:65412:12 set routing-options autonomous-system 65412 set protocols bgp group ibgp type internal set protocols bgp group ibgp local-address 192.168.0.3 set protocols bgp group ibgp family l2vpn signaling set protocols bgp group ibgp neighbor 192.168.0.1 set protocols mpls label-switched-path lsp_to_pe1 to 192.168.0.1 set protocols mpls interface ge-0/0/1.0 set protocols ospf traffic-engineering set protocols ospf area 0.0.0.0 interface lo0.0 set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 set protocols rsvp interface lo0.0 set protocols rsvp interface ge-0/0/1.0
CE2 设备的完整配置。
set system host-name ce2 set interfaces ge-0/0/0 description "Link from CE2 to PE2" set interfaces ge-0/0/0 unit 0 family inet address 172.16.1.2/30 set interfaces lo0 unit 0 family inet address 172.16.255.2/32 set protocols ospf area 0.0.0.0 interface lo0.0 set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
在对工作感到满意时,请务必提交所有设备上的配置更改。恭喜您拥有全新的基于 MPLS 的第 2 层 VPN!请参阅 验证 部分,了解确认您的 VPN 是否按预期工作所需的步骤。
为基于 MPLS 的第 2 层 VPN 配置本地 PE (PE1) 设备
本节介绍为此示例配置 PE1 设备所需的步骤。有关此示例中使用的客户边缘设备和 P 设备配置,请参阅 示例:配置基于 MPLS 的第 2 层 VPN 部分。
配置 MPLS 基准(如果需要)
配置第 2 层 VPN 之前,请确保 PE 设备具有有效的 MPLS 基准。如果您已经有了 MPLS 基准,则可以跳到将第 2 层 VPN 添加到本地 PE 设备的分步过程。
-
配置主机名。
[edit] user@pe1# set system host-name pe1
-
配置接口。
[edit] user@pe1# set interfaces ge-0/0/1 description "Link from PE1 to P-router" [edit] user@pe1# set interfaces ge-0/0/1 mtu 4000 [edit] user@pe1# set interfaces ge-0/0/1 unit 0 family inet address 10.1.23.1/24 [edit] user@pe1# set interfaces ge-0/0/1 unit 0 family mpls [edit] user@pe1# set interfaces lo0 unit 0 family inet address 192.168.0.1/32
注意:第 2 层 VPN 不支持提供商网络中的分段。提供商网络必须支持 PE 设备添加MPLS和虚拟路由和转发 (VRF) 标签 后 客户边缘设备可生成的最大帧,这一点至关重要。此示例将客户边缘设备保留为默认的 1500 字节最大传输单元 (MTU),同时将提供商核心配置为支持 4000 字节 MTU。此配置可确保客户边缘设备不会超过提供商网络中的 MTU,从而避免丢弃。
-
配置协议。
注意:RSVP 信号 LSP 支持流量工程,但基本 MPLS 交换或 VPN 部署不需要流量工程。提供的 MPLS 基准使用 RSVP 向 LSP 发出信号,并支持 OSPF 的流量工程。但是,未配置任何路径约束,因此您希望 LSP 通过内部网关协议的最短路径进行路由。
[edit ]user@pe1# set protocols ospf area 0.0.0.0 interface lo0.0 [edit] user@pe1# set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 [edit] user@pe1# set protocols ospf traffic-engineering [edit] user@pe1# set protocols mpls interface ge-0/0/1.0 [edit] user@pe1# set protocols rsvp interface lo0.0 [edit] user@pe1# set protocols rsvp interface ge-0/0/1.0
-
将 LSP 定义到远程 PE 设备的环路地址。
[edit] user@pe1# set protocols mpls label-switched-path lsp_to_pe2 to 192.168.0.3
过程
分步程序
请按照以下步骤为第 2 层 VPN 配置 PE1 设备。
配置面向边缘的接口。在单元 0 上指定物理
ethernet-ccc封装类型 withfamily ccc。这是未标记以太网接口的唯一有效单元号。如果使用 VLAN 标记,请指定vlan-ccc封装并将 CCC 系列添加到所需单元。提示:您可以在同一 PE 设备上配置基于 MPLS 的第 2 层 VPN 和基于 MPLS 的第 3 层 VPN。但是,您不能将同一个面向边缘的客户接口配置为同时支持第 2 层 VPN 和第 3 层 VPN。
[edit]user@pe1# set interfaces ge-0/0/0 encapsulation ethernet-ccc [edit] user@pe1# set interfaces ge-0/0/0 unit 0 family ccc [edit] user@pe1# set interfaces ge-0/0/0 description "Link from PE1 to CE1"
注意:第 2 层 VPN 要求 PE 设备的面向边缘的接口在物理设备级别配置 CCC 封装,并在单元级别配置 CCC 系列。无论您是部署 CCC、基于 MPLS 的第 2 层 VPN 还是基于 MPLS 的第 3 层 VPN,提供商设备的配置方式都相同。这是因为它们没有面向边缘的接口或 VPN 感知功能。
为本地和远程 PE 设备之间的对等关系配置 BGP 组。使用 PE 设备的环路地址作为本地地址并启用
family l2vpn signaling。[edit protocols bgp] user@pe1# set group ibgp local-address 192.168.0.1 family l2vpn signaling
将 BGP 组类型配置为内部。
[edit protocols bgp] user@pe1# set group ibgp type internal
将远程 PE 设备的环路地址配置为 BGP 邻接方。
[edit protocols bgp] user@pe1# set group ibgp neighbor 192.168.0.3
配置 BGP 自治系统编号。
[edit routing-options] user@pe1# set autonomous-system 65412
配置路由实例。首先指定实例名称 l2vpn1,并带有
instance-type的l2vpn。[edit routing-instances] user@pe1# set l2vpn1 instance-type l2vpn
将 PE 设备的面向客户的接口配置为属于路由实例。
[edit routing-instances] user@pe1# set l2vpn1 interface ge-0/0/0
配置路由实例的路由识别符。此设置用于区分从特定 PE 设备上的特定 VRF 发送的路由。对于每个 PE 设备上的每个路由实例,它应该是唯一的。
[edit routing-instances] user@pe1# set l2vpn1 route-distinguisher 192.168.0.1:12
配置实例的虚拟路由和转发 (VRF) 表路由目标。该
vrf-target语句会将指定的社区标记添加到所有播发的路由,同时自动匹配相同的值以进行路由导入。为了实现正确的路由交换,需要在共享给定 VPN 的 PE 设备上配置匹配的路由目标。[edit routing-instances] user@pe1# set l2vpn1 vrf-target target:65412:12
注意:您可以使用导入和导出选项显式配置 VRF 导入和导出策略,从而创建更复杂的策略。有关详细信息,请参阅 vrf-import 和 vrf-export 。
在实例中配置
l2vpn协议并指定在面向边缘的链路上使用的封装。如果 Edge 接口已标记 VLAN,请务必指定ethernet-vlan。[edit routing-instances] user@pe1# set l2vpn1 protocols l2vpn encapsulation-type ethernet
在实例的
l2vpn节下添加面向边缘的接口以及描述。[edit routing-instances] user@pe1# set l2vpn1 protocols l2vpn interface ge-0/0/0.0 description "L2vpn Link Between PE1 and CE1"
配置第 2 层 VPN 站点信息,并将面向边缘的接口与本地客户站点相关联。
[edit routing-instances] user@pe1# set l2vpn1 protocols l2vpn site CE-1 site-identifier 1 interface ge-0/0/0.0 remote-site-id 2
注意:在此示例中,PE1 设备的站点 ID 为 1,PE2 设备的站点 ID 为 2。对于本地 PE 设备 (PE1),远程站点已正确配置
remote-site-id为值 2。在 PE1 设备上提交更改并返回到 CLI作模式。
[edit] user@pe1# commit and-quit
结果
显示 PE1 设备上的配置结果。输出仅反映此示例中添加的功能配置。
user@pe1> show configuration
interfaces {
ge-0/0/0 {
description "Link from PE1 to CE1";
encapsulation ethernet-ccc;
unit 0 {
family ccc;
}
}
ge-0/0/1 {
description "Link from PE1 to P-router";
mtu 4000;
unit 0 {
family inet {
address 10.1.23.1/24;
}
family mpls;
}
}
lo0 {
unit 0 {
family inet {
address 192.168.0.1/32;
}
}
}
}
routing-instances {
l2vpn1 {
protocols {
l2vpn {
interface ge-0/0/0.0 {
description "L2vpn Link Between PE1 and CE1" ;
}
site CE-1 {
interface ge-0/0/0.0 {
remote-site-id 2;
}
site-identifier 1;
}
encapsulation-type ethernet;
}
}
instance-type l2vpn;
interface ge-0/0/0.0;
route-distinguisher 192.168.0.1:12;
vrf-target target:65412:12;
}
}
routing-options {
autonomous-system 65412;
}
protocols {
bgp {
group ibgp {
type internal;
local-address 192.168.0.1;
family l2vpn {
signaling;
}
neighbor 192.168.0.3;
}
}
mpls {
label-switched-path lsp_to_pe2 {
to 192.168.0.3;
}
interface ge-0/0/1.0;
}
ospf {
traffic-engineering;
area 0.0.0.0 {
interface lo0.0;
interface ge-0/0/1.0;
}
}
rsvp {
interface lo0.0;
interface ge-0/0/1.0;
}
}
为基于 MPLS 的第 2 层 VPN 配置远程 PE (PE2) 设备
本节介绍为此示例配置 PE2 设备所需的步骤。有关此示例中使用的客户边缘设备和 P 设备配置,请参阅 示例:配置基于 MPLS 的第 2 层 VPN 部分。
配置 MPLS 基准(如果需要)
配置第 2 层 VPN 之前,请确保 PE 设备具有有效的 MPLS 基准。如果您已经有了 MPLS 基准,则可以跳到将第 2 层 VPN 添加到本地 PE 设备的分步过程。
-
配置主机名。
[edit] user@pe2# set system host-name pe2
-
配置接口。
[edit] user@pe2# set interfaces ge-0/0/1 description "Link from PE2 to P-router" [edit] user@pe2# set interfaces ge-0/0/1 mtu 4000 [edit] user@pe2# set interfaces ge-0/0/1 unit 0 family inet address 10.1.34.2/24 [edit] user@pe2# set interfaces ge-0/0/1 unit 0 family mpls [edit] user@pe2# set interfaces lo0 unit 0 family inet address 192.168.0.3/32
注意:第 2 层 VPN 不支持提供商网络中的分段。提供商网络必须支持 PE 设备添加MPLS和虚拟路由和转发 (VRF) 标签 后 客户边缘设备可生成的最大帧,这一点至关重要。此示例将客户边缘设备保留为默认的 1500 字节最大传输单元 (MTU),同时将提供商核心配置为支持 4000 字节 MTU。此配置可确保客户边缘设备不会超过提供商网络中的 MTU,从而避免丢弃。
-
配置协议。
注意:RSVP 信号 LSP 支持流量工程,但基本 MPLS 交换或 VPN 部署不需要流量工程。提供的 MPLS 基准使用 RSVP 向 LSP 发出信号,并支持 OSPF 的流量工程。但是,未配置任何路径约束,因此您希望 LSP 通过内部网关协议的最短路径进行路由。
[edit] user@pe2# set protocols ospf area 0.0.0.0 interface lo0.0 [edit] user@pe2# set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 [edit] user@pe2# set protocols ospf traffic-engineering [edit] user@pe2# set protocols mpls interface ge-0/0/1.0 [edit] user@pe2# set protocols rsvp interface lo0.0 [edit] user@pe2# set protocols rsvp interface ge-0/0/1.0
-
将 LSP 定义到远程 PE 设备的环路地址。
[edit] user@pe2# set protocols mpls label-switched-path lsp_to_pe1 to 192.168.0.1
过程
分步程序
请按照以下步骤为第 2 层 VPN 配置 PE2 设备。
配置面向边缘的接口封装和家族。回想一下,这是一个未标记的接口,因此只有单元 0 对
ccc家族有效。[edit]user@pe2# set interfaces ge-0/0/0 encapsulation ethernet-ccc [edit] user@pe2# set interfaces ge-0/0/0 unit 0 family ccc [edit] user@pe1# set interfaces ge-0/0/0 description "Link from PE2 to CE2"
配置 BGP 组。将 PE 设备的环路地址指定为本地地址并启用
family l2vpn signaling。[edit protocols bgp] user@pe2# set group ibgp local-address 192.168.0.3 family l2vpn signaling
将 BGP 组类型配置为内部。
[edit protocols bgp] user@pe2# set group ibgp type internal
将 PE1 设备配置为 BGP 邻接方。请务必将 PE1 的环路地址指定为 BGP 邻接方。
[edit protocols bgp] user@pe2# set group ibgp neighbor 192.168.0.1
配置 BGP 自治系统编号。
[edit routing-options] user@pe2# set autonomous-system 65412
配置路由实例。首先使用 of
l2vpn指定实例名称。l2vpn1instance-type[edit routing-instances] user@pe2# set l2vpn1 instance-type l2vpn
将 PE 设备的面向客户边缘的接口配置为属于路由实例。
[edit routing-instances] user@pe2# set l2vpn1 interface ge-0/0/0
配置实例的路由识别符。
[edit routing-instances] user@pe2# set l2vpn1 route-distinguisher 192.168.0.3:12
配置实例的 VPN 虚拟路由和转发 (VRF) 表路由目标。分配的目标必须与在 PE1 设备上配置的目标匹配。
[edit routing-instances] user@pe2# set l2vpn1 vrf-target target:65412:12
为协议配置
l2vpn实例并指定在面向边缘的链路上使用的封装。[edit routing-instances] user@pe2# set l2vpn1 protocols l2vpn encapsulation-type ethernet
在实例的
l2vpn层次结构下添加 PE 设备的面向边缘的接口以及说明。[edit routing-instances] user@pe2# set l2vpn1 protocols l2vpn interface ge-0/0/0.0 description "L2vpn Link Between PE2 and CE2"
配置实例的第 2 层 VPN 站点信息,并在本地站点下列出 PE 设备的面向边缘的接口。PE2 设备上配置的本地站点 ID 必须与您在 PE1 设备上配置的远程站点 ID 匹配,反之亦然。
[edit routing-instances] user@pe1# set l2vpn1 protocols l2vpn site CE-2 site-identifier 2 interface ge-0/0/0.0 remote-site-id 1
注意:在此示例中,PE2 设备的站点 ID 为 2,PE1 设备的站点 ID 为 1。对于 PE2 设备,远程站点已正确配置
remote-site-id为值 1。在 PE2 设备上提交更改并返回到 CLI作模式。
[edit] user@pe1# commit and-quit
结果
显示 PE2 设备上的配置结果。
user@pe2# show
interfaces {
ge-0/0/0 {
description "Link from PE2 to CE2";
encapsulation ethernet-ccc;
unit 0 {
family ccc;
}
}
ge-0/0/1 {
description "Link from PE2 to P-router";
mtu 4000;
unit 0 {
family inet {
address 10.1.34.2/24;
}
family mpls;
}
}
lo0 {
unit 0 {
family inet {
address 192.168.0.3/32;
}
}
}
}
routing-instances {
l2vpn1 {
protocols {
l2vpn {
interface ge-0/0/0.0 {
description "L2vpn Link Between PE2 and CE2" ;
}
site CE-2 {
interface ge-0/0/0.0 {
remote-site-id 1;
}
site-identifier 2;
}
encapsulation-type ethernet;
}
}
instance-type l2vpn;
interface ge-0/0/0.0;
route-distinguisher 192.168.0.3:12;
vrf-target target:65412:12;
}
}
routing-options {
autonomous-system 65412;
}
protocols {
bgp {
group ibgp {
type internal;
local-address 192.168.0.3;
family l2vpn {
signaling;
}
neighbor 192.168.0.1;
}
}
mpls {
label-switched-path lsp_to_pe1 {
to 192.168.0.1;
}
interface ge-0/0/1.0;
}
ospf {
traffic-engineering;
area 0.0.0.0 {
interface lo0.0;
interface ge-0/0/1.0;
}
}
rsvp {
interface lo0.0;
interface ge-0/0/1.0;
}
}
验证
执行以下任务以验证基于 MPLS 的第 2 层 VPN 是否正常工作:
- 验证提供商 OSPF 邻接和路由交换
- 验证 MPLS 和 RSVP 接口设置
- 验证 RSVP 信号 LSP
- 验证 BGP 会话状态
- 验证路由表中的第 2 层 VPN 路由
- 验证第 2 层 VPN 连接状态
- 使用第 2 层 VPN 连接对远程 PE 设备 Ping
- 验证客户边缘设备通过第 2 层 VPN 的端到端作
验证提供商 OSPF 邻接和路由交换
目的
通过验证邻接状态和 OSPF 获知到远程提供商设备环路地址的路由,确认 OSPF 协议在提供商网络中正常工作。正确的 IGP作对于成功建立 MPLS LSP 至关重要。
行动
user@pe1> show ospf neighbor Address Interface State ID Pri Dead 10.1.23.2 ge-0/0/1.0 Full 192.168.0.2 128 38
user@pe1> show route protocol ospf | match 192.168 192.168.0.2/32 *[OSPF/10] 1w5d 20:48:59, metric 1 192.168.0.3/32 *[OSPF/10] 2w0d 00:08:30, metric 2
意义
输出显示 PE1 设备已建立与 P 设备 (192.168.0.2) 的 OSPF 邻接关系。它还显示,P 和远程 PE 设备环路地址 (192.168.0.2) 和 (192.168.0.3) 是通过本地 PE 设备上的 OSPF 获知的。
验证 MPLS 和 RSVP 接口设置
目的
验证是否配置了 RSVP 和 MPLS 协议,以便在 PE 设备面向内核的接口上运行。此步骤还会验证是否 family mpls 在面向核心的接口的单元级别上配置是否正确。
行动
user@pe1> show mpls interface Interface State Administrative groups (x: extended) ge-0/0/1.0 Up <none>
user@pe1> show rsvp interface
RSVP interface: 2 active
Active Subscr- Static Available Reserved Highwater
Interface State resv iption BW BW BW mark
ge-0/0/1.0 Up 1 100% 1000Mbps 1000Mbps 0bps 0bps
lo0.0 Up 0 100% 0bps 0bps 0bps 0bps
意义
输出显示,在本地 PE 设备的面向核心和环路接口上正确配置了 MPLS 和 RSVP。
验证 RSVP 信号 LSP
目的
验证 PE 设备之间是否已正确建立 RSVP 会话(入口和出口)。
行动
user@pe1> show rsvp session To From State Rt Style Labelin Labelout LSPname 192.168.0.3 192.168.0.1 Up 0 1 FF - 299888 lsp_to_pe2 Total 1 displayed, Up 1, Down 0 Egress RSVP: 1 sessions To From State Rt Style Labelin Labelout LSPname 192.168.0.1 192.168.0.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 会话均已在 PE 设备之间正确建立。成功建立 LSP 表示 MPLS 基准可运行。
验证 BGP 会话状态
目的
验证是否在支持 2 层 VPN 网络层可达性信息 (NLRI) 的情况下正确建立 PE 设备之间的 BGP 会话。
行动
user@pe1> show bgp summary
Threading mode: BGP I/O
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.168.0.3 65412 6 5 0 0 1:34 Establ
bgp.l2vpn.0: 1/1/1/0
l2vpn1.l2vpn.0: 1/1/1/0
意义
输出显示与远程 PE 设备 (192.168.0.3) 的 BGP 会话已正确建立 (Establ),并通过该 Up/Dwn 字段显示会话处于当前状态的时间 (1:34)。它还显示发送到 (5) 和从远程 PE 设备 (6) 接收的 BGP 数据包数。该 flaps 字段确认未发生状态转换 (),0表示会话是稳定的。另请注意,第 2 层 VPN NLRI 可在 PE 设备之间正确交换。此输出确认 PE 设备之间的 BGP 对等已准备好支持第 2 层 VPN。
验证路由表中的第 2 层 VPN 路由
目的
验证 PE1 设备上的路由表是否填充了用于在客户边缘设备之间转发流量的第 2 层 VPN 路由。
行动
user@pe1> show route table bgp.l2vpn.0
bgp.l2vpn.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
192.168.0.3:12:2:1/96
*[BGP/170] 00:51:36, localpref 100, from 192.168.0.3
AS path: I, validation-state: unverified
> to 10.1.23.2 via ge-0/0/1.0, label-switched-path lsp_to_pe2
user@pe1> show route table l2vpn1.l2vpn.0
l2vpn1.l2vpn.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
192.168.0.1:12:1:1/96
*[L2VPN/170/-101] 01:48:30, metric2 1
Indirect
192.168.0.3:12:2:1/96
*[BGP/170] 00:51:57, localpref 100, from 192.168.0.3
AS path: I, validation-state: unverified
> to 10.1.23.2 via ge-0/0/1.0, label-switched-path lsp_to_pe2
意义
该命令 show route table bgp.l2vpn.0 显示 PE 设备上已接收的所有第 2 层 VPN 路由。该命令 show route table l2vpn1.l2vpn.0 显示由于路由目标匹配而导入到路由实例中的 l2vpn1 第 2 层 VPN 路由。该 l2vpn1.l2vpn.0 表包含本地 PE 设备的第 2 层 VPN 路由,以及通过远程 PE 设备的 BGP 对等互连获知的远程路由。两个表都显示,远程第 2 层 VPN 路由作为转发下一跃点与 LSP 正确 lsp_to_pe2 关联。输出确认本地 PE 设备已从 PE2 设备获知了远程客户站点。它还表明,它可以通过提供商网络使用 MPLS 传输将第 2 层 VPN 流量转发到 PE2 设备。
验证第 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 available
BK -- Backup connection ST -- Standby connection
PF -- Profile parse failure PB -- Profile busy
RS -- remote site standby SN -- Static Neighbor
LB -- Local site not best-site RB -- Remote site not best-site
VM -- VLAN ID mismatch HS -- Hot-standby Connection
Legend for interface status
Up -- operational
Dn -- down
Instance: l2vpn1
Edge protection: Not-Primary
Local site: CE-1 (1)
connection-site Type St Time last up # Up trans
2 rmt Up Jul 28 10:47:18 2020 1
Remote PE: 192.168.0.3, Negotiated control-word: Yes (Null)
Incoming label: 800009, Outgoing label: 800006
Local interface: ge-0/0/0.0, Status: Up, Encapsulation: ETHERNET
Flow Label Transmit: No, Flow Label Receive: No
意义
St输出中的字段显示与 的2connection-site第 2 层 VPN 连接Remote PE192.168.0.3为 Up。输出还确认 PE 设备的面向边缘的接口名称ge-0/0/0.0和作状态为 up。还要验证是否在 PE 设备面向客户的接口上配置了以太网封装。这是此示例中使用的未标记以太网接口的正确封装。到目前为止执行的验证步骤表明,第 2 层 VPN 的控制平面可以正常运行。在以下步骤中验证第 2 层 VPN 的数据平面。
使用第 2 层 VPN 连接对远程 PE 设备 Ping
目的
验证本地和远程 PE 设备之间的第 2 层 VPN 连接。显示了命令的 ping mpls l2vpn 两种形式。两者都测试 PE 设备之间的第 2 层 VPN 路由和 MPLS 转发。第一个命令假定一个远程站点,而第二个命令指定本地和远程站点标识符,这在测试多站点第 2 层 VPN 时非常有用。这是因为远程站点 ID 可用于面向所需的远程 PE 设备。
该 ping mpls l2vpn 命令可验证 PE 设备之间的第 2 层 VPN 路由交换和 MPLS 转发。方法是生成从本地 PE 的第 2 层 VPN 路由实例到远程 PE 设备的 127.0.0.1 环路地址的流量。此命令不会验证客户边缘设备接口的作或其配置。这是因为客户边缘设备作对第 2 层 VPN 中的提供商网络不透明。
行动
user@pe1> ping mpls l2vpn interface ge-0/0/0.0 reply-mode ip-udp !!!!! --- lsping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss
user@pe1> ping mpls l2vpn instance l2vpn1 remote-site-id 2 local-site-id 1 detail
Request for seq 1, to interface 334, labels <800002, 299840>, packet size 88
Reply for seq 1, return code: Egress-ok, time: 593.784 ms
Local transmit time: 2020-07-13 16:15:55 UTC 241.357 ms
Remote receive time: 2020-07-13 16:15:55 UTC 835.141 ms
Request for seq 2, to interface 334, labels <800002, 299840>, packet size 88
Reply for seq 2, return code: Egress-ok, time: 591.700 ms
Local transmit time: 2020-07-13 16:15:56 UTC 241.405 ms
Remote receive time: 2020-07-13 16:15:56 UTC 833.105 ms
Request for seq 3, to interface 334, labels <800002, 299840>, packet size 88
Reply for seq 3, return code: Egress-ok, time: 626.084 ms
Local transmit time: 2020-07-13 16:15:57 UTC 241.407 ms
Remote receive time: 2020-07-13 16:15:57 UTC 867.491 ms
Request for seq 4, to interface 334, labels <800002, 299840>, packet size 88
Reply for seq 4, return code: Egress-ok, time: 593.061 ms
Local transmit time: 2020-07-13 16:15:58 UTC 241.613 ms
Remote receive time: 2020-07-13 16:15:58 UTC 834.674 ms
Request for seq 5, to interface 334, labels <800002, 299840>, packet size 88
Reply for seq 5, return code: Egress-ok, time: 594.192 ms
Local transmit time: 2020-07-13 16:15:59 UTC 241.357 ms
Remote receive time: 2020-07-13 16:15:59 UTC 835.549 ms
--- lsping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
意义
输出确认第 2 层 VPN 转发平面在 PE 设备之间工作正常。
验证客户边缘设备通过第 2 层 VPN 的端到端作
目的
验证客户边缘设备之间的第 2 层 VPN 连接。此步骤将确认客户边缘设备具有作接口,并已正确配置用于第 2 层连接。方法是验证客户边缘设备是否已建立 OSPF 邻接关系,并且能够在其环路地址之间端到端传递流量。
行动
user@ce1> show ospf neighbor Address Interface State ID Pri Dead 172.16.1.2 ge-0/0/0.0 Full 172.16.255.2 128 32
user@ce1> show ospf route | match 172
172.16.255.2/32 *[OSPF/10] 01:34:50, metric 1
> to 172.16.1.2 via ge-0/0/0.0
user@ce1> ping 172.16.255.2 size 1472 do-not-fragment count 2 PING 172.16.255.2 (172.16.255.2): 1472 data bytes 1480 bytes from 172.16.255.2: icmp_seq=0 ttl=64 time=4.404 ms 1480 bytes from 172.16.255.2: icmp_seq=1 ttl=64 time=5.807 ms --- 172.16.255.2 ping statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max/stddev = 4.404/5.106/5.807/0.702 ms
意义
输出显示,第 2 层 VPN 连接在客户边缘设备之间工作正常。它确认本地客户边缘设备已通过提供商核心与远程客户边缘设备 172.16.1.2建立了 OSPF 邻接关系,并且本地客户边缘设备已通过 OSPF 获知到远程客户边缘设备环路地址 172.16.255.2 的路由。输出还显示,客户边缘设备能够传递 1500 字节的 IP 数据包,而不会引起本地分段。成功的 ping 还会验证帧是否超过提供商网络支持的 MTU。
size添加到命令的ping参数生成 1472 字节的回显数据。额外添加了 8 个字节的互联网控制消息协议 (ICMP) 和 20 个字节的 IP 报头,使数据包总大小达到 1500 字节。添加交换机可do-not-fragment确保客户边缘设备无法基于其本地 MTU 执行分段。此方法可确认在客户边缘设备之间发送标准长度的以太网帧时,不可能或不需要分段。