为第 3 层 VPN 配置 AS
配置第 3 层 VPN 以承载 IBGP 流量
独立 AS 域与主路由实例域分开。AS 是一组由单一技术管理且通常使用单个 IGP 和指标在路由器集内传播路由信息的路由器。在其他 AS 上,AS 似乎具有一个一致的内部路由计划,并呈现可通过它到达的目标的一致图。
配置独立域允许您阻止独立域的 AS 路径与其他域(包括主路由实例域)的 AS 路径属性共享。
如果在路由器上使用 BGP,则必须配置 AS 编号。
将 BGP 配置为第 3 层 VPN 中的 PE 路由器与 CE 路由器之间的路由协议时,通常会在第 3 层 VPN 服务提供商与客户网络 AS 之间配置外部对等会话。
如果客户网络有多个站点通过外部 BGP 会话向服务提供商网络播发路由,并且所有客户站点均使用相同的 AS,则 CE 路由器将拒绝来自其他 CE 路由器的路由。它们检测到 BGP AS 路径属性中的环路。
为防止 CE 路由器拒绝对方的路由,您可以配置以下内容:
通过远程 PE 路由器接收路由的 PE 路由器可将客户网络 AS 编号重拍为自己的 AS 编号。
AS 路径环路可配置。
客户网络可以在每个站点使用不同的 AS 编号进行配置。
当客户网络和其他网络之间没有 BGP 路由交换时,这些类型的配置可以发挥作用。但是,对于在内部出于目的而使用 BGP 的客户网络,除了在 CE 路由器和 PE 路由器之间传输流量之外,它们确实存在限制。当这些路由在客户网络外部通告时,服务提供商 AS 会出现在 AS 路径中。
为了提高客户网络第 3 层 VPN 服务的透明度,您可以为第 3 层 VPN 配置路由实例,以便将客户的网络属性与服务提供商的网络属性隔离。
将语句包含 independent-domain
在第 3 层 VPN 路由实例配置中时,从客户网络(从 CE 路由器)接收的 BGP 属性存储在 BGP 属性 (ATTRSET) 中,该属性像堆栈一样工作。当该路由从远程 PE 路由器通告至远程 CE 路由器时,将恢复原始 BGP 属性。这是通告至位于不同域的第 3 层 VPN 的 BGP 路由的默认行为。
此功能在 Internet 草案 draft-marques-ppvpn-ibgp-version.txt、 RFC 2547bis Networks 使用内部 BGP 作为 PE-CE 协议中进行了介绍。
要允许第 3 层 VPN 传输 IBGP 流量,请包括以下 independent-domain
语句:
independent-domain;
您可以在以下层次结构级别中包含此语句:
[edit routing-instances routing-instance-name routing-options autonomous-system number]
[edit logical-systems logical-system-name routing-instances routing-instance-name routing-options autonomous-system number]
注意:参与第 3 层 VPN
independent-domain
及其配置中语句的所有 PE 路由器都必须运行 Junos OS 版本 6.3 或更高版本。
层次 [edit logical-systems]
结构级别不适用于 ACX 系列路由器。
独立域使用传输路径属性 128(属性集)通过内部 BGP (IBGP) 核心为独立域的 BGP 属性建立隧道。在 Junos OS 版本 10.3 和更高版本中,如果 BGP 接收属性 128 且您未在任何路由实例中配置独立域,BGP 会将收到的属性 128 视为未知属性。
每个域都有 16 个 AS 的限制。
另请参阅
示例:使用路由反射和 AS 覆盖配置第 3 层 VPN
假设您是提供基于 MPLS 的托管第 3 层 VPN 服务的服务提供商。您的客户有几个站点,需要在每个站点将 BGP 路由到客户边缘 (CE) 设备。
要求
配置此示例之前,无需设备初始化以外的特殊配置。
概述
此示例包含两台 CE 设备、两台提供商边缘 (PE) 设备和多台提供商核心设备。提供商网络还使用 IS-IS 支持 LDP 和 BGP 回传可达性 设备 P2 用作路由反射器 (RR)。两个 CE 设备均处于自治系统 (AS) 64512 中。提供商网络处于 AS 65534 中。
该 as-override
语句应用于 PE 设备,从而将 CE 设备的 AS 编号替换为 PE 设备的 AS 编号。这样,客户 AS 编号就无法多次出现在 AS 路径属性中。
图 1 显示了此示例中使用的拓扑。
CLI 快速配置 显示 图 1 中所有设备的配置。该部分 逐步步骤 介绍了设备 PE1 上的步骤。
拓扑
配置
程序
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,移除任何换行符,更改与网络配置匹配所需的任何详细信息,然后将命令复制粘贴到层次结构级别的 [edit]
CLI 中。
设备 CE1
set interfaces ge-1/2/0 unit 0 family inet address 10.0.0.1/30 set interfaces ge-1/2/0 unit 0 family iso set interfaces lo0 unit 0 family inet address 10.255.1.1/32 set interfaces lo0 unit 0 family iso address 49.0001.0010.0000.0101.00 set protocols bgp group PE type external set protocols bgp group PE family inet unicast set protocols bgp group PE export ToBGP set protocols bgp group PE peer-as 65534 set protocols bgp group PE neighbor 10.0.0.2 set policy-options policy-statement ToBGP term Direct from protocol direct set policy-options policy-statement ToBGP term Direct then accept set routing-options router-id 10.255.1.1 set routing-options autonomous-system 64512
设备 P1
set interfaces ge-1/2/0 unit 0 family inet address 10.0.0.6/30 set interfaces ge-1/2/0 unit 0 family iso set interfaces ge-1/2/0 unit 0 family mpls set interfaces ge-1/2/1 unit 0 family inet address 10.0.0.9/30 set interfaces ge-1/2/1 unit 0 family iso set interfaces ge-1/2/1 unit 0 family mpls set interfaces ge-1/2/2 unit 0 family inet address 10.0.0.25/30 set interfaces ge-1/2/2 unit 0 family iso set interfaces ge-1/2/2 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.255.3.3/32 set interfaces lo0 unit 0 family iso address 49.0001.0010.0000.0303.00 set protocols mpls interface all set protocols mpls interface fxp0.0 disable set protocols bgp group l3vpn type internal set protocols bgp group l3vpn local-address 10.255.3.3 set protocols bgp group l3vpn family inet-vpn unicast set protocols bgp group l3vpn peer-as 65534 set protocols bgp group l3vpn local-as 65534 set protocols bgp group l3vpn neighbor 10.255.4.4 set protocols isis interface all level 2 metric 10 set protocols isis interface all level 1 disable set protocols isis interface fxp0.0 disable set protocols isis interface lo0.0 level 2 metric 0 set protocols ldp deaggregate set protocols ldp interface all set protocols ldp interface fxp0.0 disable set routing-options router-id 10.255.3.3
设备 P2
set interfaces ge-1/2/0 unit 0 family inet address 10.0.0.10/30 set interfaces ge-1/2/0 unit 0 family iso set interfaces ge-1/2/0 unit 0 family mpls set interfaces ge-1/2/1 unit 0 family inet address 10.0.0.13/30 set interfaces ge-1/2/1 unit 0 family iso set interfaces ge-1/2/1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.255.4.4/32 set interfaces lo0 unit 0 family iso address 49.0001.0010.0000.0404.00 set protocols mpls interface all set protocols mpls interface fxp0.0 disable set protocols bgp group Core-RRClients type internal set protocols bgp group Core-RRClients local-address 10.255.4.4 set protocols bgp group Core-RRClients family inet-vpn unicast set protocols bgp group Core-RRClients cluster 10.255.4.4 set protocols bgp group Core-RRClients peer-as 65534 set protocols bgp group Core-RRClients neighbor 10.255.3.3 set protocols bgp group Core-RRClients neighbor 10.255.7.7 set protocols bgp group Core-RRClients neighbor 10.255.2.2 set protocols bgp group Core-RRClients neighbor 10.255.5.5 set protocols isis interface all level 2 metric 10 set protocols isis interface all level 1 disable set protocols isis interface fxp0.0 disable set protocols isis interface lo0.0 level 2 metric 0 set protocols ldp deaggregate set protocols ldp interface all set protocols ldp interface fxp0.0 disable set routing-options router-id 10.255.4.4 set routing-options autonomous-system 65534
设备 P3
set interfaces ge-1/2/0 unit 0 family inet address 10.0.0.22/30 set interfaces ge-1/2/0 unit 0 family iso set interfaces ge-1/2/0 unit 0 family mpls set interfaces ge-1/2/1 unit 0 family inet address 10.0.0.26/30 set interfaces ge-1/2/1 unit 0 family iso set interfaces ge-1/2/1 unit 0 family mpls set interfaces ge-1/2/2 unit 0 family inet address 10.0.0.30/30 set interfaces ge-1/2/2 unit 0 family iso set interfaces ge-1/2/2 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.255.7.7/32 set interfaces lo0 unit 0 family iso address 49.0001.0010.0000.0707.00 set protocols mpls interface all set protocols mpls interface fxp0.0 disable set protocols bgp group l3vpn type internal set protocols bgp group l3vpn local-address 10.255.7.7 set protocols bgp group l3vpn family inet-vpn unicast set protocols bgp group l3vpn peer-as 65534 set protocols bgp group l3vpn local-as 65534 set protocols bgp group l3vpn neighbor 10.255.4.4 set protocols isis interface all level 2 metric 10 set protocols isis interface all level 1 disable set protocols isis interface fxp0.0 disable set protocols isis interface lo0.0 level 2 metric 0 set protocols ldp deaggregate set protocols ldp interface all set protocols ldp interface fxp0.0 disable set routing-options router-id 10.255.7.7
设备 PE1
set interfaces ge-1/2/0 unit 0 family inet address 10.0.0.2/30 set interfaces ge-1/2/0 unit 0 family iso set interfaces ge-1/2/0 unit 0 family mpls 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 iso set interfaces ge-1/2/1 unit 0 family mpls set interfaces ge-1/2/2 unit 0 family inet address 10.0.0.21/30 set interfaces ge-1/2/2 unit 0 family iso set interfaces ge-1/2/2 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.255.2.2/32 set interfaces lo0 unit 0 family iso address 49.0001.0010.0000.0202.00 set protocols mpls interface ge-1/2/2.0 set protocols mpls interface ge-1/2/1.0 set protocols mpls interface lo0.0 set protocols mpls interface fxp0.0 disable set protocols bgp group l3vpn type internal set protocols bgp group l3vpn local-address 10.255.2.2 set protocols bgp group l3vpn family inet-vpn unicast set protocols bgp group l3vpn peer-as 65534 set protocols bgp group l3vpn local-as 65534 set protocols bgp group l3vpn neighbor 10.255.4.4 set protocols isis interface ge-1/2/1.0 level 2 metric 10 set protocols isis interface ge-1/2/1.0 level 1 disable set protocols isis interface ge-1/2/2.0 level 2 metric 10 set protocols isis interface ge-1/2/2.0 level 1 disable set protocols isis interface fxp0.0 disable set protocols isis interface lo0.0 level 2 metric 0 set protocols ldp deaggregate set protocols ldp interface ge-1/2/1.0 set protocols ldp interface ge-1/2/2.0 set protocols ldp interface fxp0.0 disable set protocols ldp interface lo0.0 set routing-instances VPN-A instance-type vrf set routing-instances VPN-A interface ge-1/2/0.0 set routing-instances VPN-A route-distinguisher 65534:1234 set routing-instances VPN-A vrf-target target:65534:1234 set routing-instances VPN-A protocols bgp group CE type external set routing-instances VPN-A protocols bgp group CE family inet unicast set routing-instances VPN-A protocols bgp group CE neighbor 10.0.0.1 peer-as 64512 set routing-instances VPN-A protocols bgp group CE neighbor 10.0.0.1 as-override set routing-options router-id 10.255.2.2 set routing-options autonomous-system 65534
设备 PE2
set interfaces ge-1/2/0 unit 0 family inet address 10.0.0.14/30 set interfaces ge-1/2/0 unit 0 family iso set interfaces ge-1/2/0 unit 0 family mpls set interfaces ge-1/2/1 unit 0 family inet address 10.0.0.17/30 set interfaces ge-1/2/1 unit 0 family iso set interfaces ge-1/2/2 unit 0 family inet address 10.0.0.29/30 set interfaces ge-1/2/2 unit 0 family iso set interfaces ge-1/2/2 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.255.5.5/32 set interfaces lo0 unit 0 family iso address 49.0001.0010.0000.0505.00 set protocols mpls interface ge-1/2/0.0 set protocols mpls interface ge-1/2/2.0 set protocols mpls interface lo0.0 set protocols mpls interface fxp0.0 disable set protocols bgp group l3vpn type internal set protocols bgp group l3vpn local-address 10.255.5.5 set protocols bgp group l3vpn family inet-vpn unicast set protocols bgp group l3vpn peer-as 65534 set protocols bgp group l3vpn local-as 65534 set protocols bgp group l3vpn neighbor 10.255.4.4 set protocols isis interface ge-1/2/0.0 level 2 metric 10 set protocols isis interface ge-1/2/0.0 level 1 disable set protocols isis interface ge-1/2/2.0 level 2 metric 10 set protocols isis interface ge-1/2/2.0 level 1 disable set protocols isis interface fxp0.0 disable set protocols isis interface lo0.0 level 2 metric 0 set protocols ldp deaggregate set protocols ldp interface ge-1/2/0.0 set protocols ldp interface ge-1/2/2.0 set protocols ldp interface fxp0.0 disable set protocols ldp interface lo0.0 set routing-instances VPN-A instance-type vrf set routing-instances VPN-A interface ge-1/2/1.0 set routing-instances VPN-A route-distinguisher 65534:1234 set routing-instances VPN-A vrf-target target:65534:1234 set routing-instances VPN-A protocols bgp group CE type external set routing-instances VPN-A protocols bgp group CE family inet unicast set routing-instances VPN-A protocols bgp group CE neighbor 10.0.0.18 peer-as 64512 set routing-instances VPN-A protocols bgp group CE neighbor 10.0.0.18 as-override set routing-options router-id 10.255.5.5 set routing-options autonomous-system 65534
设备 CE2
set interfaces ge-1/2/0 unit 0 family inet address 10.0.0.18/30 set interfaces ge-1/2/0 unit 0 family iso set interfaces lo0 unit 0 family inet address 10.255.6.6/32 set interfaces lo0 unit 0 family iso address 49.0001.0010.0000.0606.00 set protocols bgp group PE type external set protocols bgp group PE family inet unicast set protocols bgp group PE export ToBGP set protocols bgp group PE peer-as 65534 set protocols bgp group PE neighbor 10.0.0.17 set policy-options policy-statement ToBGP term Direct from protocol direct set policy-options policy-statement ToBGP term Direct then accept set routing-options router-id 10.255.6.6 set routing-options autonomous-system 64512
逐步过程
以下示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅 CLI 用户指南中的配置模式下使用 CLI 编辑器。
要配置 AS 覆盖:
-
配置接口。
要启用 MPLS,请在接口上包含协议家族,以便接口不会丢弃传入的 MPLS 信息流。
[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/0 unit 0 family iso user@PE1# set ge-1/2/0 unit 0 family mpls user@PE1# set ge-1/2/1 unit 0 family inet address 10.0.0.5/30 user@PE1# set ge-1/2/1 unit 0 family iso user@PE1# set ge-1/2/1 unit 0 family mpls user@PE1# set ge-1/2/2 unit 0 family inet address 10.0.0.21/30 user@PE1# set ge-1/2/2 unit 0 family iso user@PE1# set ge-1/2/2 unit 0 family mpls user@PE1# set lo0 unit 0 family inet address 10.255.2.2/32 user@PE1# set lo0 unit 0 family iso address 49.0001.0010.0000.0202.00
-
将接口添加至 MPLS 协议以建立控制平面级别连接。
设置 IGP,以便提供商设备可以相互通信。
要建立分配 MPLS 标签的机制,请启用 LDP。或者,对于 LDP,支持转发同等类 (FEC) 分解,从而加快全球融合速度。
[edit protocols] user@PE1# set mpls interface ge-1/2/2.0 user@PE1# set mpls interface ge-1/2/1.0 user@PE1# set mpls interface lo0.0 user@PE1# set mpls interface fxp0.0 disable user@PE1# set isis interface ge-1/2/1.0 level 2 metric 10 user@PE1# set isis interface ge-1/2/1.0 level 1 disable user@PE1# set isis interface ge-1/2/2.0 level 2 metric 10 user@PE1# set isis interface ge-1/2/2.0 level 1 disable user@PE1# set isis interface fxp0.0 disable user@PE1# set isis interface lo0.0 level 2 metric 0 user@PE1# set ldp deaggregate user@PE1# set ldp interface ge-1/2/1.0 user@PE1# set ldp interface ge-1/2/2.0 user@PE1# set ldp interface fxp0.0 disable user@PE1# set ldp interface lo0.0
-
仅使用 IPv4 VPN 单播地址族,启用与 RR 对等的内部 BGP (IBGP) 连接。
[edit protocols bgp group l3vpn] user@PE1# set type internal user@PE1# set local-address 10.255.2.2 user@PE1# set family inet-vpn unicast user@PE1# set peer-as 65534 user@PE1# set local-as 65534 user@PE1# set neighbor 10.255.4.4
-
配置路由实例,包括语
as-override
句。在 PE 设备上创建路由实例 (VRF),将 BGP 配置设置为与设备 CE1 对等。
[edit routing-instances VPN-A] user@PE1# set instance-type vrf user@PE1# set interface ge-1/2/0.0 user@PE1# set route-distinguisher 65534:1234 user@PE1# set vrf-target target:65534:1234 user@PE1# set protocols bgp group CE type external user@PE1# set protocols bgp group CE family inet unicast user@PE1# set protocols bgp group CE neighbor 10.0.0.1 peer-as 64512 user@PE1# set protocols bgp group CE neighbor 10.0.0.1 as-override
-
配置路由器 ID 和 AS 编号。
[edit routing-options] user@PE1# set router-id 10.255.2.2 user@PE1# set autonomous-system 65534
结果
在配置模式下,输入 show interfaces
、 show protocols
、 show routing-instances
和 show routing-options
命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明以将其更正。
user@PE1# show interfaces
ge-1/2/0 {
unit 2 {
family inet {
address 10.0.0.2/30;
}
family iso;
family mpls;
}
}
ge-1/2/1 {
unit 5 {
family inet {
address 10.0.0.5/30;
}
family iso;
family mpls;
}
}
ge-1/2/2 {
unit 21 {
family inet {
address 10.0.0.21/30;
}
family iso;
family mpls;
}
}
lo0 {
unit 0 {
family inet {
address 10.255.2.2/32;
}
family iso {
address 49.0001.0010.0000.0202.00;
}
}
}
user@PE1# show protocols
mpls {
interface ge-1/2/2.0;
interface ge-1/2/1.0;
interface lo0.0;
interface fxp0.0 {
disable;
}
}
bgp {
group l3vpn {
type internal;
local-address 10.255.2.2;
family inet-vpn {
unicast;
}
peer-as 65534;
local-as 65534;
neighbor 10.255.4.4;
}
}
isis {
interface ge-1/2/1.0 {
level 2 metric 10;
level 1 disable;
}
interface ge-1/2/2.0 {
level 2 metric 10;
level 1 disable;
}
interface fxp0.0 {
disable;
}
interface lo0.0 {
level 2 metric 0;
}
}
ldp {
deaggregate;
interface ge-1/2/1.0;
interface ge-1/2/2.0;
interface fxp0.0 {
disable;
}
interface lo0.0;
}
user@PE1# show routing-instances
VPN-A {
instance-type vrf;
interface ge-1/2/0.0;
route-distinguisher 65534:1234;
vrf-target target:65534:1234;
protocols {
bgp {
group CE {
type external;
family inet {
unicast;
}
neighbor 10.0.0.1 {
peer-as 64512;
as-override;
}
}
}
}
}
user@PE1# show routing-options
router-id 10.255.2.2;
autonomous-system 65534;
如果完成设备配置,请在配置模式下输入 commit 。
验证
确认配置工作正常。
检查到 CE 设备的 AS 路径
目的
显示设备 PE1 上有关到设备 CE2 环路接口的路由的 AS 路径属性的信息。
行动
在设备 PE1 上,在操作模式下输入 show route table VPN-A.inet.0 10.255.6.6
命令。
user@PE1> show route table VPN-A.inet.0 10.255.6.6 VPN-A.inet.0: 5 destinations, 6 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.255.6.6/32 *[BGP/170] 02:19:35, localpref 100, from 10.255.4.4 AS path: 64512 I, validation-state: unverified > to 10.0.0.22 via ge-1/2/2.0, Push 300032, Push 299776(top)
意义
输出显示,设备 PE1 的 AS 路径为 10.255.6.6/32,来自 AS 64512。
检查设备 CE2 的路由如何通告
目的
确保设备 CE2 的路由通告至设备 CE1,就好像其来自 MPLS 核心一样。
行动
在设备 PE1 上,在操作模式下输入 show route advertising-protocol bgp 10.0.0.1
命令。
user@PE1> show route advertising-protocol bgp 10.0.0.1 VPN-A.inet.0: 5 destinations, 6 routes (5 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.16/30 Self I * 10.255.1.1/32 10.0.0.1 65534 I * 10.255.6.6/32 Self 65534 I
意义
输出表示设备 PE1 仅在 AS 路径中播示自己的 AS 编号。
检查设备 CE1 上的路由
目的
确保设备 CE1 在到设备 CE2 的路由的 AS 路径中仅包含提供商 AS 编号。
行动
在操作模式下,输入 show route table inet.0 terse 10.255.6.6
命令。
user@CE1> show route table inet.0 terse 10.255.6.6 inet.0: 5 destinations, 6 routes (5 active, 0 holddown, 1 hidden) + = Active Route, - = Last Active, * = Both A V Destination P Prf Metric 1 Metric 2 Next hop AS path * ? 10.255.6.6/32 B 170 100 65534 65534 I unverified >10.0.0.2
意义
输出表示设备 CE1 有到设备 CE2 的路由。环路问题通过使用 as-override
语句来解决。
一条路由在 CE 设备上隐藏。这是因为 Junos OS 不会执行 BGP 分割视界。一般来说,BGP 中的分割视图是没有必要的,因为由于 AS 路径长度(对于 EBGP)、AS 路径环路检测 (IBGP) 或其他 BGP 指标,发起方可能收到的任何路由的首选程度较低。将路由播发回其获知的邻接方会对路由器的性能产生可忽略的影响,并且正确的做法。
配置用于确定活动路由的算法,以评估 VPN 路由 AS 路径中的 AS 编号
默认情况下,用于确定活动路由的算法的第三步会评估 AS 路径的长度,但不是 AS 路径的内容。在具有 BGP 多个路径路由的某些 VPN 场景中,比较 AS 路径的 AS 编号并让算法选择 AS 编号匹配的路由也很有用。
要配置选择活动路径以评估 VPN 路由 AS 路径中的 AS 编号的算法:
as-path-compare
在层次结构级别中[edit routing-instances routing-instance-name routing-options multipath]
包含语句。
默认路由实例不支持该 as-path-compare
语句。