用于第 3 层 VPN 的 BGP PIC
为 MPLS 第 3 层 VPN 配置 BGP PIC 边缘
在 MPLS VPN 第 3 层环境中,客户经常多宿主其网络来提供链路冗余。尽管内部网关协议 (IGP) 可以提供快速融合,但在某些情况下,解决链路故障和提供替代路由的时间可能很耗时。例如,提供商边缘 (PE) 路由器可能配置了 200,000 个或更多 IP 前缀,而 PE 路由器故障可能会影响其中的许多前缀。
BGP 独立于前缀的融合 (PIC) 边缘允许您将第 3 层 VPN 路由作为备用路径安装在转发表中,从而在 PE 路由器发生故障或与 PE 路由器失去连接时实现快速故障切换。此已安装的路径在通过 IGP 的全局融合解决之前一直使用。使用替代 VPN 路由进行转发,直至完成全局融合,从而减少流量丢失。
BGP PIC Edge 支持使用以下任何 IGP 协议解决的多协议 BGP IPv4 或 IPv6 VPN 网络层可访问性信息 (NLRI):
Ospf
IS-IS
自民党
Rsvp
BGP PIC Edge 不支持组播信息流。
开始之前:
配置 LDP 或 RSVP。
配置 IGP:OSPF 或 IS-IS。
配置第 3 层 VPN。
为 IPv4 VPN 或 IPv6 VPN 配置多协议 BGP。
要在 MPLS 第 3 层 VPN 中配置 BGP PIC 边缘:
在带有模块化端口集中器 (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 系列多服务边缘路由器、MX 系列 5G 通用路由平台或 T 系列核心路由器。
配置了 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 protocols
、 show policy-options
、 show routing-instances
和 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。