中心辐式 VPN
配置中心辐式 VPN 拓扑:一个接口
使用单接口配置从中心或中心播发默认路由。
图 1 展示了第 3 层 VPN 客户边缘 中心辐式应用程序,其中中枢接口 (CE1) 和中心 PE (PE1) 之间只有一个接口。这是配置中心辐式拓扑的推荐方法。
在此配置中,默认路由从中心通告到辐。如果在分支客户边缘路由器之间需要交换更具体的分支客户边缘,那么中心路由器与中心 PE客户边缘两个接口。有关 两个接口的示例,请参阅 Configuring Hub-spoke VPN 拓扑: 两个接口 。
在此配置示例中,辐路由分配如下所示:
辐 CE2 将路由通告给分支 PE2。
辐 PE2 将 CE2 的路由安装到其 VPN 路由和转发 (VRF) 表中。
辐 PE2 将检查其 VRF 导出策略,添加路由目标社区,并将路由通知到中心 PE1。
中心 PE1 可检查其 VRF 导入策略,并安装与导入策略相符的路由,放入表 bgp.l3vpn.0 中。
中心 PE1 将路由从表 bgp.l3vpn.0 安装到中心 VRF 表中。
中心 PE1 公布从中心 VRF 表到中心 CE1 的路由。
在此配置示例中,默认路由分配如下所示:
中心 CE1 公布到中心 PE1 的默认路由。
中心 PE1 将默认路由安装到中心 VRF 表中。
中心 PE1 将检查其 VRF 导出策略,添加路由目标社区,并通知到分支 PE2 和 PE3 的默认路由。
辐 PE2 和 PE3 检查其 VRF 导入策略,将默认路由安装到表 bgp.l3vpn.0 中。
辐 PE2 和 PE3 将路由从表 bgp.l3vpn.0 安装到其分支 VRF 表中。
辐 PE2 和 PE3 从分支 VRF 表中公布到分支 CE2 和 CE3 的默认路由。
以下部分介绍如何使用一个接口基于图 1中所示的拓扑配置中心辐式拓扑:
配置中心 CE1
按如下方式配置中心 CE1:
[edit routing-options] static { route 0.0.0.0/0 discard; } autonomous-system 100; [edit protocols] bgp { group hub { type external; export default; peer-as 200; neighbor 10.49.4.1; } } [edit policy-options] policy-statement default { term 1 { from { protocol static; route-filter 0.0.0.0/0 exact; } then accept; } term 2 { then reject; } }
配置中心 PE1
配置中心 PE1,如下所示:
[edit] routing-instances { hub { instance-type vrf; interface t3-0/0/0; route-distinguisher 10.255.14.176:2; vrf-target { import target:200:100; export target:200:101; } protocols { bgp { group hub { type external; peer-as 100; as-override; neighbor 10.49.4.2; } } } } }
配置 P 路由器
按如下方式配置 P 路由器:
[edit] interfaces { t3-0/1/1 { unit 0 { family inet { address 10.49.2.1/30; } family mpls; } } t3-0/1/3 { unit 0 { family inet { address 10.49.0.2/30; } family mpls; } } t1-0/2/0 { unit 0 { family inet { address 10.49.1.2/30; } family mpls; } } } [edit] protocols { ospf { area 0.0.0.0 { interface t3-0/1/3.0; interface t1-0/2/0.0; interface t3-0/1/1.0; interface lo0.0 { passive; } } } ldp { interface t3-0/1/1.0; interface t3-0/1/3.0; interface t1-0/2/0.0; } }
配置辐辐 PE2
配置辐 PE2,如下所示:
[edit] interfaces { t3-0/0/0 { unit 0 { family inet { address 10.49.0.1/30; } family mpls; } } t1-0/1/2 { unit 0 { family inet { address 10.49.3.1/30; } } } } [edit protocols] bgp { group ibgp { type internal; local-address 10.255.14.182; peer-as 200; neighbor 10.255.14.176 { family inet-vpn { unicast; } } } } ospf { area 0.0.0.0 { interface t3-0/0/0.0; interface lo0.0 { passive; } } } ldp { interface t3-0/0/0.0; } [edit] routing-instances { spoke { instance-type vrf; interface t1-0/1/2.0; route-distinguisher 10.255.14.182:20; vrf-target { import target:200:101; export target:200:100; } protocols { bgp { group spoke { type external; peer-as 100; as-override; neighbor 10.49.3.2; } } } } }
配置辐辐 PE3
配置辐 PE3,如下所示:
[edit] interfaces { t3-0/0/0 { unit 0 { family inet { address 10.49.6.1/30; } } } t3-0/0/1 { unit 0 { family inet { address 10.49.2.2/30; } family mpls; } } } [edit protocols} bgp { group ibgp { type internal; local-address 10.255.14.178; peer-as 200; neighbor 10.255.14.176 { family inet-vpn { unicast; } } } } ospf { area 0.0.0.0 { interface t3-0/0/1.0; interface lo0.0 { passive; } } } ldp { interface t3-0/0/1.0; } [edit] routing-instances { spoke { instance-type vrf; interface t3-0/0/0.0; route-distinguisher 10.255.14.178:30; vrf-target { import target:200:101; export target:200:100; } protocols { bgp { group spoke { type external; peer-as 100; as-override; neighbor 10.49.6.2; } } } } }
配置辐 CE2
配置辐 CE2,如下所示:
[edit routing-options] autonomous-system 100; {edit protocols] bgp { group spoke { type external; export loopback; peer-as 200; neighbor 10.49.3.1; } }
配置辐 CE3
配置辐 CE3,如下所示:
[edit routing-options] autonomous-system 100; [edit protocols] bgp { group spoke { type external; export loopback; peer-as 200; neighbor 10.49.6.1; } }
在此配置示例中,轮辐 CE2 和中心 CE1 之间的流量转发如下所示:
辐 CE2 使用从分支 PE2 到路由学习的默认路由来转发BGP。
0.0.0.0/0 *[BGP/170] 02:24:15, localpref 100 AS path: 200 200 I > to 10.49.3.1 via t1-3/0/1.0
轮辐 PE2 在轮辐 VRF 表中执行路由查找,使用通过路由学习的默认路由将流量转发至中心 PE2(通过 P 路由器 — PE BGP 2 推送两个标签)。
0.0.0.0/0 *[BGP/170] 01:35:45, localpref 100, from 10.255.14.176 AS path: 100 I > via t3-0/0/1.0, Push 100336, Push 100224(top)
中心 PE1 在 mpls.0 表中为 VPN 标签进行路由查找
100336
。100336 *[VPN/170] 01:37:03 > to 10.49.4.2 via t3-0/0/0.0, Pop
中心 PE1 将流量从接口转发至
t3-0/0/0.0
中心 CE1。
在此配置示例中,中心 CE1 和轮辐 CE2 之间的流量转发如下所示:
中心 CE1 使用通过路由学习到的路由将流量转发到中心 BGP PE1。
10.49.10.250/32 *[BGP/170] 02:28:46, localpref 100 AS path: 200 200 I > to 10.49.4.1 via t3-3/1/0.0
中心 PE1 在中心 VRF 表中进行路由查找,将流量转发给轮辐 PE2(通过 P 路由器 —PE1 推送两个标签)。
10.49.10.250/32 *[BGP/170] 01:41:05, localpref 100, from 10.255.14.182 AS path: 100 I > via t1-0/1/0.0, Push 100352, Push 100208(top)
辐式 PE2 在 mpls.0 表中为 VPN 标签进行路由查找
100352
。100352 *[VPN/170] 02:31:39 > to 10.49.3.2 via t1-0/1/2.0, Pop
辐 PE2 将流量从接口转发至
t1-0/1/2.0
分支 CE2。
在此配置示例中,辐 CE2 和辐 CE3 之间的流量转发如下所示:
辐 CE2 使用从分支 PE2 到路由学习的默认路由来转发BGP。
0.0.0.0/0 *[BGP/170] 02:24:15, localpref 100 AS path: 200 200 I > to 10.49.3.1 via t1-3/0/1.0
轮辐 PE2 在轮辐 VRF 表中进行路由查找,使用通过路由学习的默认路由将流量转发至中心 PE1(通过 P 路由器 — PE BGP 2 推送两个标签)。
0.0.0.0/0 *[BGP/170] 01:35:45, localpref 100, from 10.255.14.176 AS path: 100 I > via t3-0/0/1.0, Push 100336, Push 100224(top)
中心 PE1 在 mpls.0 表中为 VPN 标签进行路由查找
100336
。100336 *[VPN/170] 01:37:03 > to 10.49.4.2 via t3-0/0/0.0, Pop
中心 PE1 将流量从接口转发
t3-0/0/0.0
至中心 CE1。中心 CE1 使用通过路由学习的路由器将流量转发至中心 PE1 BGP。
10.49.10.253/32 *[BGP/170] 02:40:03, localpref 100 AS path: 200 200 I > to 10.49.4.1 via t3-3/1/0.0
中心 PE1 在中心 VRF 表中进行路由查找,将流量转发给轮辐 PE3(通过 P 路由器 —PE1 推送两个标签)。
10.49.10.253/32 *[BGP/170] 01:41:05, localpref 100, from 10.255.14.178 AS path: 100 I > via t1-0/1/0.0, Push 100128, Push 100192(top)
辐式 PE3 在 mpls.0 表中对 VPN 标签进行路由查找
100128
。100128 *[VPN/170] 02:41:30 > to 10.49.6.2 via t3-0/0/0.0, Pop
辐 PE3 将流量从接口转发至
t3-0/0/0.0
分支 CE3。
如果在中枢 PE 上需要 IP 转发查找的中心 VRF 路由表上的出口功能,请参阅 在中心 PE 路由器上启用出口 功能。
在中心 PE 路由器上启用出口功能
此示例与 Configuring Hub-spoke VPN 拓扑:一个接口 一起提供。此示例还使用 图 1中说明的拓扑。
如果中心 PE 上需要出口功能,且需要在中心 VRF 路由表中进行 IP 转发查找,则配置中心辐式 VPN 拓扑结构中详细的配置 : 一个接口将不起作用。将语句应用于中心路由实例将强制来自远程轮辐 PE 的流量转发至中心 vrf-table-label
PE,并强制执行 IP 查找。由于中心 VRF 表中包含特定轮辐路由,因此流量将转发到轮辐 PE,而无需经过中心 pe客户边缘。
中心 PE 按照以下方式通告默认路由,使用 VPN 标签 1028:
hub.inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden) * 0.0.0.0/0 (1 entry, 1 announced) BGP group ibgp type Internal Route Distinguisher: 10.255.14.176:2 VPN Label: 1028 Nexthop: Self Localpref: 100 AS path: 100 I Communities: target:200:101
传入信息流使用 VPN 标签 1028 进行转发。mpls.0 表显示需要表 hub.inet.0 中的 IP 查找:
1028 *[VPN/0] 00:00:27 to table hub.inet.0, Pop
但是,中心 VRF 表 hub.inet.0 包含特定轮辐路由:
10.49.10.250/32 *[BGP/170] 00:00:05, localpref 100, from 10.255.14.182 AS path: 100 I > via t1-0/1/0.0, Push 100352, Push 100208(top) 10.49.10.253/32 *[BGP/170] 00:00:05, localpref 100, from 10.255.14.178 AS path: 100 I > via t1-0/1/0.0, Push 100128, Push 100192(top)
因此,流量直接转发至轮辐 PES,不会通过中心站客户边缘。为了防止这种情况发生,您必须为中心 PE1 中的下游流量配置辅助路由实例。
配置中心 PE1
配置中心 PE1,如下所示:
[edit] routing-instances { hub { instance-type vrf; interface t3-0/0/0.0; route-distinguisher 10.255.14.176:2; vrf-target { import target:200:100; export target:200:101; } no-vrf-advertise; routing-options { auto-export; } protocols { bgp { group hub { type external; peer-as 100; as-override; neighbor 10.49.4.2; } } } } hub-downstream { instance-type vrf; route-guisher 10.255.14.176:3; vrf-target target:200:101; vrf-table-label; routing-options { auto-export; } } }
当 no-vrf-advertise
在 层次结构级别使用 [edit routing-instances hub]
语句时,无需路由表组或 VRF 导出策略。语句 no-vrf-advertise
配置中心 PE,不会从主路由实例播发 VPN 路由 hub
。这些路由改为从辅助路由实例播发 hub_downstream
。有关 Junos OS, 请参阅 路由协议库 no-vrf-advertise
。
层次结构级别的语句通过查看为每个路由实例定义的路由目标,识别从中心实例导出到中心下游 auto-export
[edit routing-instances hub-downstream routing-options]
实例的路由。有关 Junos OS, 请参阅 路由协议库 auto-export
。有关 导出策略的更多示例,请参阅 使用自动路由导出 配置重叠 VPN 。
使用中心 PE 上的此配置,辐辐客户边缘流量将经过中心 客户边缘,并允许在中心 PE 上启用出口功能(如过滤)。
在此配置示例中,辐 CE2 和辐 CE3 之间的流量转发如下所示:
辐 CE2 使用从分支 PE2 到路由学习的默认路由来转发BGP。
0.0.0.0/0 *[BGP/170] 02:24:15, localpref 100 AS path: 200 200 I > to 10.49.3.1 via t1-3/0/1.0
轮辐 PE2 在轮辐 VRF 表中进行路由查找,使用通过路由学习的默认路由将流量转发至中心 PE1(通过 P 路由器 — PE BGP 2 推送两个标签)。
spoke.inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 0.0.0.0/0 *[BGP/170] 00:00:09, localpref 100, from 10.255.14.176 AS path: 100 I > via t3-0/0/0.0, Push 1029, Push 100224(top)
中心 PE1 在 mpls.0 表中为 VPN 标签进行路由查找
1029
。mpls.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 1029 *[VPN/0] 00:11:49 to table hub_downstream.inet.0, Pop
VPN 标签
1029
通告是因为:语句
vrf-table-label
将应用于[edit routing-instances hub_downsteam]
中心 PE1 配置的层级。no-vrf-advertise
语句在 层次结构级别中应用,指示路由器从辅助[edit routing-instances hub]
表中通告路由。
因此,IP 查找在 hub_downstream.inet.0 表中执行,而不是在 hub.inet.0 表中。
将
show route advertising-protocol
中心 PE 上的 命令发出给轮辐 PE 以验证 VPN 标签1029
通告:user@host> show route advertising-protocol hub_downstream.inet.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden) * 0.0.0.0/0 (1 entry, 1 announced) BGP group ibgp type Internal Route Distinguisher: 10.255.14.176:3 VPN Label: 1029 Nexthop: Self Localpref: 100 AS path: 100 I Communities: target:200:101
中心 PE1 在表中执行 IP 查找,将信息流
hub_downstream.inet.0
出接口转发至t3-0/0/0.0
中心 CE1。hub_downstream.inet.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden) 0.0.0.0/0 (1 entry, 1 announced) *BGP Preference: 170/-101 Next-hop reference count: 4 Source: 10.49.4.2 Next hop: 10.49.4.2 via t3-0/0/0.0, selected State: <Secondary Active Ext> Peer AS: 100 Age: 3:03 Task: BGP_100.10.49.4.2+1707 Announcement bits (2): 0-KRT 2-BGP.0.0.0.0+179 AS path: 100 I Communities: target:200:101 Localpref: 100 Router ID: 10.49.10.251 Primary Routing Table hub.inet.0
主路由表是 ,表示由于层次结构级别的语句和中心 PE1 配置中层次结构级别的语句,此路由已从表中导出到此
hub.inet.0
hub.inet.0
hub_downstream.inet.0 表中no-vrf-advertise
[edit routing-instances hub]
auto-export
。[edit routing-instances hub-downstream routing-options]
中心 CE1 使用通过路由学习的路由器将流量转发回中心 BGP PE1。
10.49.10.253/32 *[BGP/170] 02:40:03, localpref 100 AS path: 200 200 I > to 10.49.4.1 via t3-3/1/0.0
中心 PE1 在中心 VRF 表中执行路由查找,将流量转发至轮辐 PE3(通过 P 路由器 — PE1 推送两个标签)。
10.49.10.253/32 *[BGP/170] 01:41:05, localpref 100, from 10.255.14.178 AS path: 100 I > via t1-0/1/0.0, Push 100128, Push 100192(top)
辐式 PE3 在 mpls.0 表中执行 VPN 标签的路由查找
100128
。100128 *[VPN/170] 02:41:30 > to 10.49.6.2 via t3-0/0/0.0, Pop
辐 PE3 将信息流出接口转发
t3-0/0/0.0
至分支 CE3。
配置中心辐式 VPN 拓扑:两个接口
使用两个接口配置来传播从辐辐到分支的路由。
本部分中的示例使用以下组件配置带两个接口的中心辐式拓扑(请参阅图 2):
一个中心 PE 路由器(路由器 D)。
一个客户边缘路由器连接到中心 PE 路由器。此中心辐式 VPN 拓扑要正常运行,必须有两个接口将中心 PE 路由器连接到中心 客户边缘 路由器,并且每个接口在 PE 路由器上都必须有其自己的 VRF 表:
第一个接口(此处为接口 ge-0/0/0.0)用于向中枢路由器客户边缘分支路由。与此接口关联的 VRF 表包含由轮辐 PE 路由器向中枢 PE 路由器客户边缘路由。
第二个接口(此处为接口 ge-0/0/1.0)用于接收发往中心轮辐路由器的中枢 客户边缘 的路由声明。与此接口关联的 VRF 表包含中心路由器客户边缘到轮辐 PE 路由器的路由。此示例使用两个独立的物理接口。如果要在中心 PE 路由器和中枢路由器之间配置共享相同物理接口的两个单独逻辑接口,客户边缘也正常工作。
两个辐 PE 路由器(路由器 E 和路由器 F)。
两个分支客户边缘路由器(CE1 和 CE2),一个连接到每个辐 PE 路由器。
LDP 作为信号协议。
在此配置中,由路由器 CE1 客户边缘分布路由,如下所示:
辐路由器 CE1 宣布其路由到分支 PE 路由器 E。
路由器 E 将 CE1 的路由安装到其 VRF 表中。
检查 VRF 导出策略后,路由器 E 会将辐辐目标社区添加到通过策略的路由器 CE1 的路由中,并通知其到中心 PE 路由器路由器 D。
路由器 D 检查与接口 ge-0/0/0.0 关联的 VRF 导入策略,将符合此策略的辐 PE 路由器的所有路由放入其 bgp.l3vpn 路由表中。(不匹配的任何路由都将被丢弃。)
路由器 D 检查其 VRF 导入策略与接口 ge-0/0/0.0 相关联,并安装与其分支 VRF 表中匹配的所有路由。路由将随辐辐目标社区一起安装。
路由器 D 通过接口 ge-0/0/0 客户边缘到中心路由器的路由。
中枢客户边缘路由器将路由返回中心 PE 路由器 D 通过第二个接口通知到中心路由器,接口 ge-0/0/1。
中心 PE 路由器将从中心路由器客户边缘的路由安装到其中心 VRF 表中,该表与接口 ge-0/0/1 相关联。
中心 PE 路由器检查与接口 ge-0/0/1.0 关联的 VRF 导出策略,并通知在添加中心目标社区后所有匹配所有辐的路由。
图 3 展示了如何将路由从此辐辐路由器分布到路由器 CE2 客户边缘其他分支路由器。如果从路由器 CE1 到路由器 CE2 发出命令, traceroute
则遵循相同的路径。
此示例的最后一节"中心辐 式 VPN配置"(由路由器汇总)整合了为图 2中所示的每个服务提供商路由器配置 VPN 功能所需的语句。
以下部分介绍如何为中心辐式 PE 路由器上的中心辐式拓扑配置 VPN 功能。路由器客户边缘 VPN 没有任何相关信息,因此您可以正常配置它们。
- 在中心IGP型 PE 路由器上启用交换
- 在中心辐式 PE 路由器上配置 LDP
- 在 PE 路由器上配置 IBGP
- 在中心辐式 PE 路由器上配置 VPN 路由实例
- 在 PE 路由器上配置 VPN 策略
- 路由器汇总的中心辐式 VPN 配置
在中心IGP辐 PE 路由器上启用配置
要允许中心辐式 PE 路由器交换路由信息,您必须在所有IGP上配置一个路由,或者必须配置静态路由。您可以在路由IGP (rpd) 的主实例(即层级)上配置 IGP,而不是在路由实例中(即不在层次结构级别)。 [edit protocols]
[edit routing-instances]
您可IGP标准方式配置网络。此配置示例不包括此配置部分。
在中心辐式拓扑中的路由分配中,如果中心站点的 客户边缘 和 PE 路由器之间使用的协议为 BGP,则中心 客户边缘 路由器将通知从中心 PE 路由器和轮辐路由器收到的所有路由回中心 PE 路由器及所有辐式路由器。这意味着中心辐式 PE 路由器接收包含其路由编号AS路由。通常,当路由包含此信息时,它表示已发生路由环路,并且路由器拒绝路由。但是,要运行 VPN 配置,中心 PE 路由器和轮辐路由器必须接受这些路由。要启用此功能,在中枢 PE 路由器AS所有轮辐路由器的层次结构级别配置组时,请 loops
[edit routing-options]
包括 选项。对于此示例配置,请指定一个值 1。您可以指定一个 0 到 10 的编号。
[edit routing-options] autonomous-system as-number loops 1;
在中心辐式 PE 路由器上配置 LDP
在参与 VPN 的中心到轮辐 PE 路由器之间的接口上配置 LDP。
在中心 PE 路由器 D 上,配置 LDP:
[edit protocols] ldp { interface so-1/0/0.0; interface t3-1/1/0.0; }
在辐 PE 路由器 E 上,配置 LDP:
[edit protocols] ldp { interface fe-0/1/2.0; }
在辐 PE 路由器 F 上,配置 LDP:
[edit protocols] ldp { interface fe-1/0/0.0; }
在 PE 路由器上配置 IBGP
在中心辐式 PE 路由器上,使用以下属性配置 IBGP 会话:
VPN 家族 - 要指示 IBGP 会话用于 VPN,请包含
family inet-vpn
该语句。环路地址 — 包括
local-address
语句,指定本地 PE 路由器的环路地址。VPN 的 IBGP 会话通过环路地址运行。您还必须在lo0
层次结构级别配置[edit interfaces]
接口。示例不包括路由器配置的这一部分。邻接地址 — 包括
neighbor
语句。在中心路由器上,指定每个轮辐 PE 路由器的 IP 地址,在轮辐路由器上指定中心 PE 路由器的地址。
对于中心路由器,您可为每个轮辐配置 IBGP 会话,对于每个轮辐路由器,您可与中心配置 IBGP 会话。两个分支路由器之间没有 IBGP 会话。
在中心路由器 D 上,配置 IBGP。第一个语句将 IBGP 会话配置为分支路由器 E,第二个语句配置会话 neighbor
以使用分支路由器 F。
[edit protocols] bgp { group Hub-to-Spokes { type internal; local-address 10.255.14.174; family inet-vpn { unicast; } neighbor 10.255.14.180; neighbor 10.255.14.182; } }
在轮辐路由器 E 上,配置到中心路由器的 IBGP 会话:
[edit protocols] bgp { group Spoke-E-to-Hub { type internal; local-address 10.255.14.180; neighbor 10.255.14.174 { family inet-vpn { unicast; } } } }
在轮辐路由器 F 上,配置到中心路由器的 IBGP 会话:
[edit protocols] bgp { group Spoke-F-to-Hub { type internal; local-address 10.255.14.182; neighbor 10.255.14.174 { family inet-vpn { unicast; } } } }
在中心辐式 PE 路由器上配置 VPN 路由实例
要区分要来自辐辐 PE 路由器的数据包,中心 PE 路由器必须使用两个路由实例进行配置:
一个路由实例(此示例中)与将数据包从中心 PE 路由器传输至中心 客户边缘 路由器(此示例中为接口)的接口
Spokes-to-Hub-CE
相关联ge-0/0/0.0
。其 VRF 表包含由轮辐 PE 路由器和中心 PE 路由器到中枢 PE 路由器客户边缘路由。第二个路由实例(此示例中)与将数据包从中心 客户边缘 路由器传输至中心 PE 路由器(此示例中的接口
Hub-CE-to-Spokes
)的接口相关联ge-0/0/1.0
。其 VRF 表包含从中枢路由器客户边缘到中心轮辐 PE 路由器的路由。
在每个分支路由器上,您必须配置一个路由实例。
您必须在路由实例中定义以下项:
路由区分器,用于区分一个 VPN 中的地址与其他 VPN 中的地址。
的实例类型
vrf
,在 PE 路由器上创建 VRF 表。作为 VPN 一部分的接口,用于将 PE 路由器连接到其客户边缘路由器。
VRF 导入和导出策略。两个导入策略都必须包括对社区的参考。否则,当您尝试提交配置时,提交失败。(此例外是导入策略仅包含一个
then reject
语句。)在 VRF 导出策略中,辐辐 PE 路由器会连接辐目标社区。PE 路由器与 客户边缘 路由器之间的路由,PE 路由器需要此路由将 VPN 相关路由分发至已连接路由器客户边缘路由。您可以配置路由协议(BGP、OSPF或 RIP)或者配置静态路由。
对于中心辐式拓扑,您必须在中枢路由器上的每个路由实例中配置客户边缘策略。对于与将数据包从中心 PE 路由器传输至中心 客户边缘 路由器的接口相关联的路由实例,导入策略必须接受在中心到轮辐 PE 路由器之间的 IBGP 会话中收到的所有路由,并且导出策略必须拒绝从中心 客户边缘 路由器 Spokes-to-Hub-CE
收到的所有路由。对于与将数据包从中心 客户边缘 路由器传输至中心 PE 路由器的接口相关联的路由实例(此例中为 ),导入策略必须拒绝从轮辐 PE 路由器接收到的所有路由,而且导出策略必须导出到所有轮辐路由器。 Hub-CE-to-Spokes
在中心 PE 路由器 D 上,配置以下路由实例。路由器 D OSPF路由用于将路由从中枢路由器客户边缘路由。
[edit] routing-instance { Spokes-to-Hub-CE { instance-type vrf; interface ge-0/0/0.0; route-distinguisher 10.255.1.174:65535; vrf-import spoke; vrf-export null; protocols { ospf { domain-id disable; export redistribute-vpn; domain-vpn-tag 0; area 0.0.0.0 { interface ge-0/0/0; } } } } Hub-CE-to-Spokes { instance-type vrf; interface ge-0/0/1.0; route-distinguisher 10.255.1.174:65534; vrf-import null; vrf-export hub; protocols { ospf { export redistribute-vpn; area 0.0.0.0 { interface ge-0/0/1.0; } } } } }
在辐 PE 路由器 E 上,配置以下路由实例。路由器 E 使用OSPF将路由从分支路由器 CE1 客户边缘分配。
[edit] routing-instance { Spoke-E-to-Hub { instance-type vrf; interface fe-0/1/0.0; route-distinguisher 10.255.14.80:65035; vrf-import hub; vrf-export spoke; protocols { ospf { export redistribute-vpn; area 0.0.0.0 { interface fe-0/1/0.0; } } } } }
在辐 PE 路由器 F 上,配置以下路由实例。路由器 F 使用OSPF将路由从分支路由器 CE2 客户边缘。
[edit] routing-instance { Spoke-F-to-Hub { instance-type vrf; interface fe-1/0/1.0; route-distinguisher 10.255.14.182:65135; vrf-import hub; vrf-export spoke; protocols { ospf { export redistribute-vpn; area 0.0.0.0 { interface fe-1/0/1.0; } } } } }
在 PE 路由器上配置 VPN 策略
您必须在每个中心辐式 PE 路由器上配置 VPN 导入和导出策略,以便它们在每个 VPN 中安装相应的路由。
在轮辐路由器上,您可定义与中心路由器交换路由的策略。
在中心路由器上,您可定义接受来自轮辐 PE 路由器的路由的策略,并将其客户边缘路由器,反之亦然。中心 PE 路由器有两个 VRF 表:
辐辐到中心 VRF 表 — 处理从辐式路由器收到的路由,并通知这些路由到中心路由器客户边缘路由。对于此 VRF 表,导入策略必须检查分支目标名称是否存在以及路由是否从中心 PE 和轮辐 PE 路由器之间的 IBGP 会话接收。此 VRF 表不得导出任何路由,因此其导出策略应拒绝所有路由。
中心到轮辐 VRF 表 — 处理从中枢路由器客户边缘路由,并通知给轮辐路由器。对于此 VRF 表,导出策略必须添加中心目标社区。此 VRF 表不得导入任何路由,因此其导入策略应拒绝所有路由。
在 VPN 策略中,您也可配置 VPN 目标社区。
在中心 PE 路由器 D 上,配置以下策略以应用到 VRF 表:
spoke
—接受从 IBGP 会话收到的路由,以及包含社区目标的辐 PE 路由器,拒绝spoke
所有其他路由。hub
—将社区目标中枢添加到从 OSPF接收的所有路由(即从该路由器与中枢路由器客户边缘路由)。它会拒绝所有其他路由。null
—拒绝所有路由。redistribute-vpn
—将OSPF路由重新分配至路由实例内的邻设备。[edit] policy-options { policy-statement spoke { term a { from { protocol bgp; community spoke; } then accept; } term b { then reject; } } policy-statement hub { term a { from protocol ospf; then { community add hub; accept; } } term b { then reject; } } policy-statement null { then reject; } policy-statement redistribute-vpn { term a { from protocol bgp; then accept; } term b { then reject; } } community hub members target:65535:1; community spoke members target:65535:2; }
要向路由器 D 应用 VRF 策略,在配置路由实例时请包括 vrf-export
vrf-import
和 语句:
[edit] routing-instance { Spokes-to-Hub-CE { vrf-import spoke; vrf-export null; } Hub-CE-to-Spokes { vrf-import null; vrf-export hub; } }
在辐 PE 路由器 E 和路由器 F 上,配置以下策略以应用到 VRF 表:
hub
—接受从 IBGP 会话收到的路由,以及包含社区目标的中心 PE 路由器,拒绝hub
所有其他路由。spoke
—将社区目标分支添加到从 OSPF接收的所有路由(即从该路由器与中枢路由器客户边缘会话)拒绝所有其他路由。redistribute-vpn
—将OSPF路由重新分配至路由实例内的邻设备。
在辐 PE 路由器 E 和路由器 F 上,配置以下 VPN 导入和导出策略:
[edit] policy-options { policy-statement hub { term a { from { protocol bgp; community hub; } then accept; } term b { then reject; } } policy-statement spoke { term a { from protocol ospf; then { community add spoke; accept; } } term b { then reject; } } policy-statement redistribute-vpn { term a { from protocol bgp; then accept; } term b { then reject; } } community hub members target:65535:1; community spoke members target 65535:2; }
要向辐路由器应用 VRF 策略,在配置路由实例时请包括 vrf-export
vrf-import
和 语句:
[edit] routing-instance { Spoke-E-to-Hub { vrf-import hub; vrf-export spoke; } } [edit] routing-instance { Spoke-F-to-Hub { vrf-import hub; vrf-export spoke; } }
路由器汇总的中心辐式 VPN 配置
路由器 D(中心 PE 路由器)
用于将轮辐路由分配至中心路由的路由客户边缘
Spokes-to-Hub-CE { instance-type vrf; interface fe-0/0/0.0; route-distinguisher 10.255.1.174:65535; vrf-import spoke; vrf-export null; }
实例路由协议
protocols { ospf { domain-id disable; domain-vpn-tag 0; export redistribute-vpn; area 0.0.0.0 { interface ge-0/0/0.0; } } }
用于将中心路由客户边缘到分支的路由实例
Hub-CE-to-Spokes { instance-type vrf; interface ge-0/0/1.0; route-distinguisher 10.255.1.174:65534; vrf-import null; vrf-export hub; }
路由实例路由协议
protocols { ospf { export redistribute-vpn; area 0.0.0.0 { interface ge-0/0/1.0; } } }
路由选项(主实例)
routing-options { autonomous-system 1 loops 1; }
协议(主实例)
protocols { }
启用 LDP
ldp { interface so-1/0/0.0; interface t3-1/1/0.0; }
配置 IBGP
bgp { group Hub-to-Spokes { type internal; local-address 10.255.14.174; family inet-vpn { unicast; } neighbor 10.255.14.180; neighbor 10.255.14.182; } }
配置 VPN 策略
policy-options { policy-statement spoke { term a { from { protocol bgp; community spoke; } then accept; } term b { then reject; } } policy-statement hub { term a { from protocol ospf; then { community add hub; accept; } } term b { then reject; } } policy-statement null { then reject; } policy-statement redistribute-vpn { term a { from protocol bgp; then accept; } term b { then reject; } } community hub members target:65535:1; community spoke members target:65535:2; }
路由器 E(辐 PE 路由器)
路由实例
routing-instance { Spoke-E-to-Hub { instance-type vrf; interface fe-0/1/0.0; route-distinguisher 10.255.14.80:65035; vrf-import hub; vrf-export spoke; } }
实例路由协议
protocols { ospf { export redistribute-vpn; area 0.0.0.0 { interface fe-0/1/0.0; } } }
路由选项(主实例)
routing-options { autonomous-system 1 loops 1; }
协议(主实例)
protocols { }
启用 LDP
ldp { interface fe-0/1/2.0; }
配置 IBGP
bgp { group Spoke-E-to-Hub { type internal; local-address 10.255.14.180; neighbor 10.255.14.174 { family inet-vpn { unicast; } } } }
配置 VPN 策略
policy-options { policy-statement hub { term a { from { protocol bgp; community hub; } then accept; } term b { then reject; } } policy-statement spoke { term a { from protocol ospf; then { community add spoke; accept; } } term b { then reject; } } policy-statement redistribute-vpn { term a { from protocol bgp; then accept; } term b { then reject; } } community hub members target:65535:1; community spoke members target:65535:2; }
路由器 F(辐 PE 路由器)
路由实例
routing-instance { Spoke-F-to-Hub { instance-type vrf; interface fe-1/0/1.0; route-distinguisher 10.255.14.182:65135; vrf-import hub; vrf-export spoke; } }
实例路由协议
protocols { ospf { export redistribute-vpn; area 0.0.0.0 { interface fe-1/0/1.0; } } }
路由选项(主实例)
routing-options { autonomous-system 1 loops 1; }
协议(主实例)
protocols { }
启用 LDP
ldp { interface fe-1/0/0.0; }
配置 IBGP
bgp { group Spoke-F-to-Hub { type internal; local-address 10.255.14.182; neighbor 10.255.14.174 { family inet-vpn { unicast; } } } }
配置 VPN 策略
policy-options { policy-statement hub { term a { from { protocol bgp; community hub; } then accept; } term b { then reject; } } policy-statement spoke { term a { from protocol ospf; then { community add spoke; accept; } } term b { then reject; } } policy-statement redistribute-vpn { term a { from { protocol bgp; } then accept; } term b { then reject; } } community hub members target:65535:1; community spoke members target:65535:2; }