用于第 3 层 VPN 的 BGP PIC
为 MPLS 第 3 层 VPN 配置 BGP PIC 边缘
在 MPLS VPN 第 3 层环境中,客户通常会将其网络多宿主以提供链路冗余。尽管内部网关协议 (IGP) 可以提供快速收敛,但在某些情况下,解决链路故障并提供备用路由的时间可能非常耗时。例如,提供商边缘 (PE) 路由器可能配置了 200,000 个或更多的 IP 前缀,而 PE 路由器故障可能会影响其中许多前缀。
BGP 前缀无关融合 (PIC) Edge 允许您在转转发表中安装第 3 层 VPN 路由作为备用路径,以便在 PE 路由器发生故障或您断开与 PE 路由器的连接时实现快速故障切换。在通过 IGP 解决全局收敛问题之前,将一直使用此已安装的路径。在完成全局融合之前,使用备用 VPN 路由进行转发可减少流量丢失。
BGP PIC 边缘支持使用以下任一 IGP 协议解析的多协议 BGP IPv4 或 IPv6 VPN 网络层可达性信息 (NLRI):
OSPF
IS-IS
自民党
回复
BGP PIC 边缘不支持组播流量。
开始之前:
配置 LDP 或 RSVP。
配置 IGP:OSPF 或 IS-IS。
配置第 3 层 VPN。
为 IPv4 VPN 或 IPv6 VPN 配置多协议 BGP。
要在 MPLS 第 3 层 VPN 中配置 BGP PIC Edge,请执行以下作:
在配备模块化端口集中器 (MPC) 的 MX 系列 5G 通用路由平台上,强烈建议启用增强型 IP 网络服务。
要启用增强的 IP 网络服务,请执行以下作:
[edit chassis] user@host# set network-services enhanced-ip
示例:为 MPLS 第 3 层 VPN 配置 BGP PIC 边缘
此示例说明如何配置 BGP 前缀无关融合 (PIC) 边缘,以便将第 3 层 VPN 路由安装在转转发表中作为备用路径。这样可在提供商边缘 (PE) 路由器发生故障或失去与 PE 路由器的连接时进行快速故障切换。在通过内部网关协议 (IGP) 解决全局融合问题之前,将一直使用此已安装的路径。在完成全局融合之前,使用备用 VPN 路由进行转发可减少流量丢失。
要求
配置此示例之前,不需要除设备初始化之外的特殊配置。
此示例使用以下硬件和软件组件:
-
一个具有 MPC 接口的 MX 系列 5G 通用路由平台,用于配置 BGP PIC 边缘功能。
-
五台路由器,可以是 M Series 多业务边缘路由器、MX 系列 5G 通用路由平台或 T Series 核心路由器的组合。
-
配置了 BGP PIC 边缘的设备上的 Junos OS 13.2 或更高版本。
概述
在 MPLS VPN 第 3 层环境中,客户通常会将其网络多宿主以提供链路冗余。尽管内部网关协议 (IGP) 可以提供快速收敛,但在某些情况下,解决链路故障并提供备用路由的时间可能非常耗时。例如,提供商边缘 (PE) 路由器可能配置了 200,000 个或更多的 IP 前缀,而 PE 路由器故障可能会影响其中许多前缀。
此示例显示了两个客户边缘 (CE) 路由器:设备 CE1 和设备 CE2。设备 PE1、PE2 和 PE3 都是 PE 路由器。设备 P1 是提供商核心路由器。只有设备 PE1 配置了 BGP PIC 边缘。该示例使用 P1-PE2 链路 (P-PE) 链路来模拟网络中某一部分的丢失。
为进行测试,将地址 172.16.1.5/24 添加为设备 CE2 上的环路接口地址。该地址将通告给设备 PE2 和设备 PE3,并通过内部 BGP (IBGP) IBGP 中继到设备 PE1。在设备 PE1 上,有两条通往 172.16.1.5/24 网络的路径。这些是主路径和备用路径。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层 [edit] 级的 CLI 中。
设备 CE1
set interfaces ge-1/2/0 unit 0 family inet address 10.0.0.1/30
set interfaces lo0 unit 0 family inet address 192.168.0.1/32
set protocols bgp group ebgp type external
set protocols bgp group ebgp export send-direct
set protocols bgp group ebgp neighbor 10.0.0.2
set policy-options policy-statement send-direct from protocol direct
set policy-options policy-statement send-direct then accept
set routing-options autonomous-system 101
设备 CE2
set interfaces ge-1/2/4 unit 0 family inet address 10.0.0.42/30
set interfaces ge-1/2/3 unit 0 family inet address 10.0.0.46/30
set interfaces lo0 unit 0 family inet address 192.168.0.8/32
set interfaces lo0 unit 0 family inet address 172.16.1.5/24
set protocols bgp group ebgp type external
set protocols bgp group ebgp export send-direct
set protocols bgp group ebgp neighbor 10.0.0.45
set protocols bgp group ebgp neighbor 10.0.0.41
set policy-options policy-statement send-direct from protocol direct
set policy-options policy-statement send-direct then accept
set routing-options autonomous-system 102
设备 P1
set interfaces ge-1/2/1 unit 0 family inet address 10.0.0.5/30
set interfaces ge-1/2/1 unit 0 family mpls
set interfaces ge-1/2/5 unit 0 family inet address 10.0.0.17/30
set interfaces ge-1/2/5 unit 0 family mpls
set interfaces ge-1/2/2 unit 0 family inet address 10.0.0.33/30
set interfaces ge-1/2/2 unit 0 family mpls
set interfaces lo0 unit 0 family inet address 192.168.0.3/32
set protocols mpls interface ge-1/2/1.0
set protocols mpls interface ge-1/2/5.0
set protocols mpls interface ge-1/2/2.0
set protocols ospf area 0.0.0.0 interface ge-1/2/1.0
set protocols ospf area 0.0.0.0 interface ge-1/2/5.0
set protocols ospf area 0.0.0.0 interface ge-1/2/2.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ldp interface ge-1/2/1.0
set protocols ldp interface ge-1/2/5.0
set protocols ldp interface ge-1/2/2.0
set protocols ldp interface lo0.0
set routing-options autonomous-system 100
设备 PE1
set interfaces ge-1/2/0 unit 0 family inet address 10.0.0.2/30
set interfaces ge-1/2/1 unit 0 family inet address 10.0.0.6/30
set interfaces ge-1/2/1 unit 0 family mpls
set interfaces lo0 unit 0 family inet address 192.168.0.2/32
set protocols mpls interface ge-1/2/1.0
set protocols bgp group ibgp type internal
set protocols bgp group ibgp local-address 192.168.0.2
set protocols bgp group ibgp family inet unicast
set protocols bgp group ibgp family inet-vpn unicast
set protocols bgp group ibgp export nhs
set protocols bgp group ibgp neighbor 192.168.0.7
set protocols bgp group ibgp neighbor 192.168.0.6
set protocols ospf area 0.0.0.0 interface ge-1/2/1.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ldp interface ge-1/2/1.0
set protocols ldp interface lo0.0
set policy-options policy-statement lb then load-balance per-packet
set policy-options policy-statement nhs then next-hop self
set routing-instances customer1 instance-type vrf
set routing-instances customer1 interface ge-1/2/0.0
set routing-instances customer1 route-distinguisher 100:1
set routing-instances customer1 vrf-target target:100:1
set routing-instances customer1 routing-options protect core
set routing-instances customer1 protocols bgp group ebgp type external
set routing-instances customer1 protocols bgp group ebgp neighbor 10.0.0.1
set routing-options router-id 192.168.0.2
set routing-options autonomous-system 100
set routing-options forwarding-table export lb
设备 PE2
set interfaces ge-1/2/2 unit 0 family inet address 10.0.0.34/30
set interfaces ge-1/2/2 unit 0 family mpls
set interfaces ge-1/2/3 unit 0 family inet address 10.0.0.45/30
set interfaces lo0 unit 0 family inet address 192.168.0.7/32
set protocols mpls interface ge-1/2/2.0
set protocols bgp group ibgp type internal
set protocols bgp group ibgp local-address 192.168.0.7
set protocols bgp group ibgp family inet unicast
set protocols bgp group ibgp family inet-vpn unicast
set protocols bgp group ibgp export nhs
set protocols bgp group ibgp neighbor 192.168.0.2
set protocols bgp group ibgp neighbor 192.168.0.6
set protocols ospf area 0.0.0.0 interface ge-1/2/2.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ldp interface ge-1/2/2.0
set protocols ldp interface lo0.0
set routing-instances customer1 instance-type vrf
set routing-instances customer1 interface ge-1/2/3.0
set routing-instances customer1 route-distinguisher 100:1
set routing-instances customer1 vrf-target target:100:1
set routing-instances customer1 protocols bgp group ebgp type external
set routing-instances customer1 protocols bgp group ebgp neighbor 10.0.0.46
set routing-options autonomous-system 100
设备 PE3
set interfaces ge-1/2/5 unit 0 family inet address 10.0.0.18/30
set interfaces ge-1/2/5 unit 0 family mpls
set interfaces ge-1/2/4 unit 0 family inet address 10.0.0.41/30
set interfaces ge-1/2/4 unit 0 family mpls
set interfaces lo0 unit 0 family inet address 192.168.0.6/32
set protocols mpls interface ge-1/2/5.0
set protocols mpls interface ge-1/2/4.0
set protocols bgp group ibgp type internal
set protocols bgp group ibgp local-address 192.168.0.6
set protocols bgp group ibgp family inet unicast
set protocols bgp group ibgp family inet-vpn unicast
set protocols bgp group ibgp export nhs
set protocols bgp group ibgp neighbor 192.168.0.7
set protocols bgp group ibgp neighbor 192.168.0.2
set protocols ospf area 0.0.0.0 interface ge-1/2/5.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ldp interface ge-1/2/5.0
set protocols ldp interface lo0.0
set routing-instances customer1 instance-type vrf
set routing-instances customer1 interface ge-1/2/4.0
set routing-instances customer1 route-distinguisher 100:1
set routing-instances customer1 vrf-target target:100:1
set routing-instances customer1 protocols bgp group ebgp type external
set routing-instances customer1 protocols bgp group ebgp neighbor 10.0.0.42
set routing-options autonomous-system 100
程序
分步过程
下面的示例要求您在各个配置层级中进行导航。有关 CLI 导航的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置设备 R1,请执行以下作:
-
配置设备接口。
[edit interfaces] user@PE1# set ge-1/2/0 unit 0 family inet address 10.0.0.2/30 user@PE1# set ge-1/2/1 unit 0 family inet address 10.0.0.6/30 user@PE1# set ge-1/2/1 unit 0 family mpls user@PE1# set lo0 unit 0 family inet address 192.168.0.2/32 -
在面向核心的接口上配置 MPLS 和 LDP。
[edit protocols] user@PE1# set mpls interface ge-1/2/1.0 user@PE1# set ldp interface ge-1/2/1.0 user@PE1# set ldp interface lo0.0 -
在面向核心的接口上配置 IGP。
[edit protocols ospf area 0.0.0.0] user@PE1# set interface ge-1/2/1.0 user@PE1# set interface lo0.0 passive -
配置与其他 PE 设备的 IBGP 连接。
[edit protocols bgp group ibgp] user@PE1# set type internal user@PE1# set local-address 192.168.0.2 user@PE1# set family inet unicast user@PE1# set family inet-vpn unicast user@PE1# set export nhs user@PE1# set neighbor 192.168.0.7 user@PE1# set neighbor 192.168.0.6 -
配置负载均衡策略。
[edit policy-options policy-statement lb] user@PE1# set then load-balance per-packet -
(选答)配置下一跃点自我策略。
[edit policy-options policy-statement nhs] user@PE1# set then next-hop self -
配置路由实例以创建 CE-PE EBGP 连接。
[edit routing-instances customer1] user@PE1# set instance-type vrf user@PE1# set interface ge-1/2/0.0 user@PE1# set route-distinguisher 100:1 user@PE1# set vrf-target target:100:1 user@PE1# set protocols bgp group ebgp type external user@PE1# set protocols bgp group ebgp neighbor 10.0.0.1 -
启用 BGP PIC 边缘功能。
[edit routing-instances customer1] user@PE1# set routing-options protect core -
应用负载均衡策略。
[edit routing-options forwarding-table] user@PE1# set export lb -
分配路由器 ID 和自治系统 (AS) 编号。
[edit routing-options] user@PE1# set router-id 192.168.0.2 user@PE1# set autonomous-system 100
结果
在配置模式下,输入show interfaces、show routing-instancesshow protocolsshow policy-options和show routing-options命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
user@PE1# show interfaces
ge-1/2/0 {
unit 0 {
family inet {
address 10.0.0.2/30;
}
}
}
ge-1/2/1 {
unit 0 {
family inet {
address 10.0.0.6/30;
}
family mpls;
}
}
lo0 {
unit 0 {
family inet {
address 192.168.0.2/32;
}
}
}
user@PE1# show protocols
mpls {
interface ge-1/2/1.0;
}
bgp {
group ibgp {
type internal;
local-address 192.168.0.2;
family inet {
unicast;
}
family inet-vpn {
unicast;
}
export nhs;
neighbor 192.168.0.7;
neighbor 192.168.0.6;
}
}
ospf {
area 0.0.0.0 {
interface ge-1/2/1.0;
interface lo0.0 {
passive;
}
}
}
ldp {
interface ge-1/2/1.0;
interface lo0.0;
}
user@PE1# show policy-options
policy-statement lb {
then {
load-balance per-packet;
}
}
policy-statement nhs {
then {
next-hop self;
}
}
user@PE1# show routing-instances
customer1 {
instance-type vrf;
interface ge-1/2/0.0;
route-distinguisher 100:1;
vrf-target target:100:1;
routing-options {
protect core;
}
protocols {
bgp {
group ebgp {
type external;
peer-as 101;
neighbor 10.0.0.1;
}
}
}
}
user@PE1# show routing-options
router-id 192.168.0.2;
autonomous-system 100;
forwarding-table {
export lb;
}
如果完成设备配置,请从配置模式输入 commit 。
验证
确认配置工作正常。
显示广泛的路由信息
目的
确认 BGP PIC Edge 工作正常。
行动
从设备 PE1 运行 show route extensive table customer1.inet.0 172.16.1/24 命令。
user@PE1> show route extensive table customer1.inet.0 172.16.1/24
customer1.inet.0: 7 destinations, 12 routes (7 active, 0 holddown, 0 hidden)
172.16.1.0/24 (3 entries, 2 announced)
State: <CalcForwarding>
TSI:
KRT in-kernel 172.16.1.0/24 -> {indirect(262146), indirect(262142)}
Page 0 idx 0, (group ebgp type External) Type 1 val 0x950a62c (adv_entry)
Advertised metrics:
Nexthop: Self
AS path: [100] 102 I
Communities: target:100:1
Path 172.16.1.0 from 192.168.0.6 Vector len 4. Val: 0
@BGP Preference: 170/-101
Route Distinguisher: 100:1
Next hop type: Indirect
Address: 0x9514a74
Next-hop reference count: 7
Source: 192.168.0.6
Next hop type: Router, Next hop index: 990
Next hop: 10.0.0.5 via ge-1/2/1.0, selected
Label operation: Push 299824, Push 299856(top)
Label TTL action: prop-ttl, prop-ttl(top)
Load balance label: Label 299824: None; Label 299856: None;
Session Id: 0x280002
Protocol next hop: 192.168.0.6
Label operation: Push 299824
Label TTL action: prop-ttl
Load balance label: Label 299824: None;
Indirect next hop: 0x96bc104 262146 INH Session ID: 0x280006
State: <Secondary Active Int Ext ProtectionPath ProtectionCand>
Local AS: 100 Peer AS: 100
Age: 1:38:13 Metric2: 1
Validation State: unverified
Task: BGP_100.192.168.0.6+45824
Announcement bits (1): 1-BGP_RT_Background
AS path: 102 I
Communities: target:100:1
Import Accepted
VPN Label: 299824
Localpref: 100
Router ID: 192.168.0.6
Primary Routing Table bgp.l3vpn.0
Indirect next hops: 1
Protocol next hop: 192.168.0.6 Metric: 1
Label operation: Push 299824
Label TTL action: prop-ttl
Load balance label: Label 299824: None;
Indirect next hop: 0x96bc104 262146 INH Session ID: 0x280006
Indirect path forwarding next hops: 1
Next hop type: Router
Next hop: 10.0.0.5 via ge-1/2/1.0
Session Id: 0x280002
192.168.0.6/32 Originating RIB: inet.3
Metric: 1 Node path count: 1
Forwarding nexthops: 1
Nexthop: 10.0.0.5 via ge-1/2/1.0
BGP Preference: 170/-101
Route Distinguisher: 100:1
Next hop type: Indirect
Address: 0x9515570
Next-hop reference count: 7
Source: 192.168.0.7
Next hop type: Router, Next hop index: 933
Next hop: 10.0.0.5 via ge-1/2/1.0, selected
Label operation: Push 299856, Push 299872(top)
Label TTL action: prop-ttl, prop-ttl(top)
Load balance label: Label 299856: None; Label 299872: None;
Session Id: 0x280002
Protocol next hop: 192.168.0.7
Label operation: Push 299856
Label TTL action: prop-ttl
Load balance label: Label 299856: None;
Indirect next hop: 0x96bc000 262142 INH Session ID: 0x280005
State: <Secondary NotBest Int Ext ProtectionPath ProtectionCand>
Inactive reason: Not Best in its group - Router ID
Local AS: 100 Peer AS: 100
Age: 1:38:13 Metric2: 1
Validation State: unverified
Task: BGP_100.192.168.0.7+10985
AS path: 102 I
Communities: target:100:1
Import Accepted
VPN Label: 299856
Localpref: 100
Router ID: 192.168.0.7
Primary Routing Table bgp.l3vpn.0
Indirect next hops: 1
Protocol next hop: 192.168.0.7 Metric: 1
Label operation: Push 299856
Label TTL action: prop-ttl
Load balance label: Label 299856: None;
Indirect next hop: 0x96bc000 262142 INH Session ID: 0x280005
Indirect path forwarding next hops: 1
Next hop type: Router
Next hop: 10.0.0.5 via ge-1/2/1.0
Session Id: 0x280002
192.168.0.7/32 Originating RIB: inet.3
Metric: 1 Node path count: 1
Forwarding nexthops: 1
Nexthop: 10.0.0.5 via ge-1/2/1.0
#Multipath Preference: 255
Next hop type: Indirect
Address: 0x9578010
Next-hop reference count: 4
Next hop type: Router, Next hop index: 990
Next hop: 10.0.0.5 via ge-1/2/1.0, selected
Label operation: Push 299824, Push 299856(top)
Label TTL action: prop-ttl, prop-ttl(top)
Load balance label: Label 299824: None; Label 299856: None;
Session Id: 0x280002
Next hop type: Router, Next hop index: 933
Next hop: 10.0.0.5 via ge-1/2/1.0
Label operation: Push 299856, Push 299872(top)
Label TTL action: prop-ttl, prop-ttl(top)
Load balance label: Label 299856: None; Label 299872: None;
Session Id: 0x280002
Protocol next hop: 192.168.0.6
Label operation: Push 299824
Label TTL action: prop-ttl
Load balance label: Label 299824: None;
Indirect next hop: 0x96bc104 262146 INH Session ID: 0x280006 Weight 0x1
Protocol next hop: 192.168.0.7
Label operation: Push 299856
Label TTL action: prop-ttl
Load balance label: Label 299856: None;
Indirect next hop: 0x96bc000 262142 INH Session ID: 0x280005 Weight 0x4000
State: <ForwardingOnly Int Ext>
Inactive reason: Forwarding use only
Age: 1:38:13 Metric2: 1
Validation State: unverified
Task: RT
Announcement bits (1): 0-KRT
AS path: 102 I
Communities: target:100:1
意义
包含权重的间接下一跃点输出行紧跟下一跃点之后,软件可以使用这些下一跃点来修复发生链路故障的路径。
下一跳权重具有以下值之一:
-
0x1表示活动的下一跃点。
-
0x4000表示被动下一跃点。
显示转发表
目的
使用 show route forwarding-table检查转发和内核路由表状态。
行动
从设备 PE1 运行 show route forwarding-table table customer1 destination 172.16.1.0/24 命令。
user@PE1> show route forwarding-table table customer1 destination 172.16.1.0/24
Routing table: customer1.inet
Internet:
Destination Type RtRef Next hop Type Index NhRef Netif
172.16.1.0/24 user 0 ulst 262147 2
indr 262146 3
10.0.0.5 Push 299824, Push 299856(top) 990 2 ge-1/2/1.0
indr 262144 3
10.0.0.5 Push 300080, Push 299920(top) 1000 2 ge-1/2/1.0
意义
除了转发和内核路由表状态之外,此命令还显示数据包转发引擎使用的单列表索引 (262147)。
显示 OSPF 路由
目的
显示 OSPF 路由状态。
行动
从设备 PE1 运行 show (ospf | ospf3) route detail 命令。
user@PE1> show ospf route detail
betsy@tp0:PE1> show ospf route detail
Topology default Route Table:
Prefix Path Route NH Metric NextHop Nexthop
Type Type Type Interface Address/LSP
192.168.0.3 Intra Router IP 1 ge-1/2/1.0 10.0.0.5
area 0.0.0.0, origin 192.168.0.3, optional-capability 0x0
192.168.0.6 Intra Router IP 2 ge-1/2/1.0 10.0.0.5
area 0.0.0.0, origin 192.168.0.6, optional-capability 0x0
192.168.0.7 Intra Router IP 2 ge-1/2/1.0 10.0.0.5
area 0.0.0.0, origin 192.168.0.7, optional-capability 0x0
10.0.0.4/30 Intra Network IP 1 ge-1/2/1.0
area 0.0.0.0, origin 192.168.0.3, priority low
10.0.0.16/30 Intra Network IP 2 ge-1/2/1.0 10.0.0.5
area 0.0.0.0, origin 192.168.0.6, priority medium
10.0.0.32/30 Intra Network IP 2 ge-1/2/1.0 10.0.0.5
area 0.0.0.0, origin 192.168.0.7, priority medium
192.168.0.2/32 Intra Network IP 0 lo0.0
area 0.0.0.0, origin 192.168.0.2, priority low
192.168.0.3/32 Intra Network IP 1 ge-1/2/1.0 10.0.0.5
area 0.0.0.0, origin 192.168.0.3, priority medium
192.168.0.6/32 Intra Network IP 2 ge-1/2/1.0 10.0.0.5
area 0.0.0.0, origin 192.168.0.6, priority medium
session-id: 2621446, version: 1
192.168.0.7/32 Intra Network IP 2 ge-1/2/1.0 10.0.0.5
area 0.0.0.0, origin 192.168.0.7, priority medium
session-id: 2621450, version: 1
意义
输出显示设备 PE2 和 PE3 上环路接口地址的跟踪会话 ID。
