通过 3 层 VPN 的 IPv6 流量
了解 IPv6 3 层 VPN
第 3 层 VPN 的 PE 和 CE 路由器之间的接口可配置为承载 IP 版本 6 (IPv6) 流量。IP 允许不同网络上的众多节点无缝互作。IPv4 目前用于 Intranet 和专用网络以及 Internet。IPv6 是 IPv4 的后继者,大部分基于 IPv4。
在瞻博网络实施 IPv6 的过程中,服务提供商实施了支持 MPLS 的 IPv4 骨干网,以便为 IPv6 客户提供 VPN 服务。PE 路由器同时具有 IPv4 和 IPv6 功能。它们为其 IPv6 站点维护 IPv6 VPN 路由和转发 (VRF) 表,并将 IPv6 流量封装在 MPLS 帧中,然后发送至 MPLS 核心网络。通过 MPLS 的 IPv6 VPN 路由也称为 6VPE。
BGP 和静态路由支持第 3 层 VPN 的 IPv6。
RFC 4659, 用于 IPv6 VPN 的 BGP-MPLS IP 虚拟专用网络 (VPN) 扩展中介绍了通过第 3 层 VPN 的 IPv6。
配置第 3 层 VPN 以传输 IPv6 流量
您可以在第 3 层 VPN 的 PE 和 CE 路由器之间配置 IP 版本 6 (IPv6)。PE 路由器必须使用语 family inet6-vpn
句配置 PE 路由器到 PE 路由器的 BGP 会话。CE 路由器必须能够接收 IPv6 流量。您可以在 PE 和 CE 路由器之间配置 BGP 或静态路由。
以下章节介绍了如何在 PE 路由器之间配置 IPv6 VPN:
在 PE 路由器上配置 IPv6
要在 PE 和 CE 路由器之间配置 IPv6,请在 PE 路由器的配置中包含以下 family inet6-vpn
语句:
family inet6-vpn { (any | multicast | unicast) { aggregate-label community community-name; prefix-limit maximum prefix-limit; rib-group rib-group-name; } }
有关可在其中配置此语句的层次结构级别列表,请参阅此语句的语句摘要部分。
您还必须包含以下 ipv6-tunneling
语句:
ipv6-tunneling;
您可以在以下层级包含此语句:
[edit protocols mpls]
[edit logical-systems logical-system-name protocols mpls]
配置 PE 和 CE 路由器之间的连接
要支持 IPv6 路由,您必须为第 3 层 VPN 中的 PE 和 CE 路由器之间的连接配置 BGP、OSPF 版本 3、IS-IS 或静态路由。您可以将 BGP 配置为仅处理 IPv6 路由,也可以同时处理 IP 版本 4 (IPv4) 和 IPv6 路由。
有关 IS-IS 的详细信息,请参阅示例:配置 IS-IS,
以下章节介绍了如何配置 BGP 和静态路由:
在 PE 路由器上配置 BGP 以处理 IPv6 路由
要在第 3 层 VPN 路由实例中配置 BGP 以处理 IPv6 路由,请添加以下 bgp
语句:
bgp { group group-name { local-address IPv6-address; family inet6 { unicast; } peer-as as-number; neighbor IPv6-address; } }
您可以在以下层级包含此语句:
[edit routing-instances routing-instance-name protocols]
[edit logical-systems logical-system-name routing-instances routing-instance-name protocols]
在 PE 路由器上为 IPv4 和 IPv6 路由配置 BGP
要在第 3 层 VPN 路由实例中将 BGP 配置为处理 IPv4 和 IPv6 路由,请添加以下 bgp
语句:
bgp { group group-name { local-address IPv4-address; family inet { unicast; } family inet6 { unicast; } peer-as as-number; neighbor address; } }
您可以在以下层级包含此语句:
[edit routing-instances routing-instance-name protocols]
[edit logical-systems logical-system-name routing-instances routing-instance-name protocols]
[edit logical-systems]
层次结构级别不适用于 ACX 系列路由器。
在 PE 路由器上配置 OSPF 版本 3
要在第 3 层 VPN 路由实例中配置 OSPF 版本 3 以处理 IPv6 路由,请添加 ospf3
以下语句:
ospf3 { area area-id { interface interface-name; } }
您可以在以下层级包含此语句:
[edit routing-instances routing-instance-name protocols]
[edit logical-systems logical-system-name routing-instances routing-instance-name protocols]
[edit logical-systems]
层次结构级别不适用于 ACX 系列路由器。
在 PE 路由器上配置静态路由
要在第 3 层 VPN 路由实例中配置到 CE 路由器的静态路由,请添加 routing-options
以下语句:
routing-options { rib routing-table.inet6.0 { static { defaults { static-options; } } } }
您可以在以下层级包含此语句:
[edit routing-instances routing-instance-name]
[edit logical-systems logical-system-name routing-instances routing-instance-name]
[edit logical-systems]
层次结构级别不适用于 ACX 系列路由器。
在接口上配置 IPv6
您需要在 PE 路由器到 CE 路由器的接口上以及 CE 路由器到 PE 路由器的接口上配置 IPv6。
要将接口配置为处理 IPv6 路由,请添加语 family inet6
句:
family inet6 { address ipv6-address; }
您可以在以下层级包含此语句:
[edit interfaces interface-name unit unit-number]
[edit logical-systems logical-system-name interfaces interface-name unit unit-number]
[edit logical-systems]
层次结构级别不适用于 ACX 系列路由器。
如果已将第 3 层 VPN 配置为同时处理 IPv4 和 IPv6 路由,请通过添加 unit
语句将接口配置为同时处理 IPv4 和 IPv6 路由:
unit unit-number { family inet { address ipv4-address; } family inet6 { address ipv6-address; } }
您可以在以下层级包含此语句:
[edit interfaces interface-name]
[edit logical-systems logical-system-name interfaces interface-name]
[edit logical-systems]
层次结构级别不适用于 ACX 系列路由器。
示例:使用 IBGP 和独立域在 IPv4 核心上建立隧道第 3 层 VPN IPv6 孤岛
此示例说明如何将 Junos OS 配置为通过第 3 层 VPN IPv4 网络建立 IPv6 隧道。如互联网草案 draft-marques-ppvpn-ibgp-version.txt RFC2547bis 网络中所述,使用内部 BGP 作为 PE-CE 协议,而不是更典型的外部 BGP (EBGP) PE-CE 连接,在客户边缘 (CE) 和提供商边缘 (PE) 设备之间使用内部 BGP (IBGP)。
要求
配置此示例之前,不需要除设备初始化之外的特殊配置。
加入第 3 层 VPN 且配置中包含该 independent-domain
语句的所有 PE 路由器都必须运行 Junos OS 6.3 或更高版本。
概述
此示例显示了一种方法,该方法使路由器能够加入客户 VPN 自治系统 (AS) 域,并通过第 3 层 VPN 透明地交换路由信息,而运营商网络属性不对运营商网络可见,运营商网络属性也不对客户网络可见。
作为附加要求,此示例中的客户网络基于 IPv6,而提供商网络使用 IPv4。
当需要通过 VPN 网络透明转发客户路由属性,而路由中甚至不显示服务提供商 (SP) AS 路径时,该 independent-domain
功能非常有用。在典型的第 3 层 VPN 中,路由属性(如发起方 ID、集群列表、路由指标和 AS 路径)从一台 CE 设备到另一台 CE 设备是不透明的。
例如,假设您的客户 VRF 的 AS 为 1。客户通过 BGP(IBGP 或 EBGP)向您播发路由。您的核心网络(主路由实例)使用 AS 3。如果 independent-domain
未配置,如果客户通过 BGP 向您播发 10.0.0.0/24,则前缀将在 AS 路径中包含客户的 AS 1。要将播发穿过核心传输到其他 PE 设备,可以通过多协议 BGP (MP-BGP) 将核心 AS 3 添加到 AS 路径中。AS 路径现在为 3 1。当前缀从核心播发回远程 PE 设备的第 3 层 VPN 时,系统会再次添加第 3 层 VPN AS 1,使 AS 路径 1 3 成为 1,即 AS 环路。该 independent-domain
语句可确保在环路检测期间仅检查路由实例中的 AS,而不考虑主主路由实例(核心的 AS 3)。这是通过使用属性 128(属性集)来完成的,该属性是可选的传递属性。属性集隐藏路由的 AS 路径、本地首选项等,以便在环路检查期间不会显示这些内容。
在 Junos OS 10.4 及更高版本中,您可以指定 no-attrset
选项, independent-domain
以便 Junos OS 仅对路由实例 AS 执行环路检查,而不考虑 MP-BGP 中使用的核心 AS,而不使用属性 128(属性集)。如果您正在使用该 local-as
功能,并且只想配置独立域以保持路由实例中本地 AS 的独立性,并且仅对路由实例中指定的本地 AS 执行 BGP 环路检测,则该功能很有用。在这种情况下,您可以禁用属性集消息。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层 [edit]
级的 CLI 中。
设备 CE1
set interfaces ge-1/2/1 unit 0 family inet6 address ::10.1.1.1/126 set interfaces ge-1/2/1 unit 0 family mpls set interfaces lo0 unit 0 family inet6 address ::192.0.2.1/32 set protocols bgp group toPE1 type internal set protocols bgp group toPE1 family inet6 unicast set protocols bgp group toPE1 export send-direct set protocols bgp group toPE1 neighbor ::10.1.1.2 set policy-options policy-statement send-direct from protocol direct set policy-options policy-statement send-direct then accept set routing-options router-id 192.0.2.1 set routing-options autonomous-system 64510
设备 CE2
set interfaces ge-1/2/4 unit 0 family inet6 address ::10.1.1.14/126 set interfaces ge-1/2/4 unit 0 family mpls set interfaces lo0 unit 0 family inet6 address ::192.0.2.5/32 set protocols bgp group toPE2 type internal set protocols bgp group toPE2 family inet6 unicast set protocols bgp group toPE2 export send-direct set protocols bgp group toPE2 neighbor ::10.1.1.13 set policy-options policy-statement send-direct from protocol direct set policy-options policy-statement send-direct then accept set routing-options router-id 192.0.2.5 set routing-options autonomous-system 64510
设备 PE1
set interfaces ge-1/2/1 unit 0 family inet6 address ::10.1.1.2/126 set interfaces ge-1/2/2 unit 0 family inet address 10.1.1.5/30 set interfaces ge-1/2/2 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.0.2.2/32 set protocols mpls ipv6-tunneling set protocols mpls interface ge-1/2/2.0 set protocols bgp group toPE2 type internal set protocols bgp group toPE2 local-address 192.0.2.2 set protocols bgp group toPE2 family inet6-vpn unicast set protocols bgp group toPE2 neighbor 192.0.2.4 set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface ge-1/2/2.0 set protocols ldp interface ge-1/2/2.0 set protocols ldp interface lo0.0 set routing-instances red instance-type vrf set routing-instances red interface ge-1/2/1.0 set routing-instances red route-distinguisher 64512:1 set routing-instances red vrf-target target:64512:1 set routing-instances red routing-options router-id 192.0.2.2 set routing-instances red routing-options autonomous-system 64510 set routing-instances red routing-options autonomous-system independent-domain set routing-instances red protocols bgp group toCE1 type internal set routing-instances red protocols bgp group toCE1 family inet6 unicast set routing-instances red protocols bgp group toCE1 neighbor ::10.1.1.1 set routing-options router-id 192.0.2.2 set routing-options autonomous-system 64512
设备 P
set interfaces ge-1/2/2 unit 0 family inet address 10.1.1.6/30 set interfaces ge-1/2/2 unit 0 family mpls set interfaces ge-1/2/3 unit 0 family inet address 10.1.1.9/30 set interfaces ge-1/2/3 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.0.2.3/32 set protocols mpls interface all set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface all set protocols ldp interface all set routing-options router-id 192.0.2.3
设备 PE2
set interfaces ge-1/2/3 unit 0 family inet address 10.1.1.10/30 set interfaces ge-1/2/3 unit 0 family mpls set interfaces ge-1/2/4 unit 0 family inet6 address ::10.1.1.13/126 set interfaces lo0 unit 0 family inet address 192.0.2.4/32 set protocols mpls ipv6-tunneling set protocols mpls interface ge-1/2/3.0 set protocols bgp group toPE1 type internal set protocols bgp group toPE1 local-address 192.0.2.4 set protocols bgp group toPE1 family inet6-vpn unicast set protocols bgp group toPE1 neighbor 192.0.2.2 set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface ge-1/2/3.0 set protocols ldp interface ge-1/2/3.0 set protocols ldp interface lo0.0 set routing-instances red instance-type vrf set routing-instances red interface ge-1/2/4.0 set routing-instances red route-distinguisher 64512:1 set routing-instances red vrf-target target:64512:1 set routing-instances red routing-options router-id 192.0.2.4 set routing-instances red routing-options autonomous-system 64510 set routing-instances red routing-options autonomous-system independent-domain set routing-instances red protocols bgp group toCE2 type internal set routing-instances red protocols bgp group toCE2 family inet6 unicast set routing-instances red protocols bgp group toCE2 neighbor ::10.1.1.14 set routing-options router-id 192.0.2.4 set routing-options autonomous-system 64512
配置设备 PE1
分步过程
下面的示例要求您在各个配置层级中进行导航。有关 CLI 导航的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置设备 PE1,请执行以下作:
-
配置接口。
[edit interfaces] user@PE1# set ge-1/2/1 unit 0 family inet6 address ::10.1.1.2/126 user@PE1# set ge-1/2/2 unit 0 family inet address 10.1.1.5/30 user@PE1# set ge-1/2/2 unit 0 family mpls user@PE1# set lo0 unit 0 family inet address 192.0.2.2/32
-
在接口上配置 MPLS。
[edit protocols mpls] user@PE1# set ipv6-tunneling user@PE1# set interface ge-1/2/2.0
-
配置 BGP。
[edit protocols bgp group toPE2] user@PE1# set type internal user@PE1# set local-address 192.0.2.2 user@PE1# set family inet6-vpn unicast user@PE1# set neighbor 192.0.2.4
-
配置内部网关协议 (IGP)。
[edit protocols ospf area 0.0.0.0] user@PE1# set interface lo0.0 passive user@PE1# set interface ge-1/2/2.0
-
配置信令协议。
[edit protocols] user@PE1# set ldp interface ge-1/2/2.0 user@PE1# set ldp interface lo0.0
-
配置路由实例。
[edit routing-instances red] user@PE1# set instance-type vrf user@PE1# set interface ge-1/2/1.0 user@PE1# set route-distinguisher 64512:1 user@PE1# set vrf-target target:64512:1 user@PE1# set routing-options router-id 192.0.2.2 user@PE1# set protocols bgp group toCE1 type internal user@PE1# set protocols bgp group toCE1 family inet6 unicast user@PE1# set protocols bgp group toCE1 neighbor ::10.1.1.1
-
在路由实例中,包括客户网络的 AS 编号,并包括
independent-domain
语句。[edit routing-instances red routing-options] user@PE1# set autonomous-system 64510 user@PE1# set autonomous-system independent-domain
-
在主实例中,配置路由器 ID 和提供商 AS 编号。
[edit routing-options] user@PE1# set router-id 192.0.2.2 user@PE1# set autonomous-system 64512
结果
在配置模式下,输入show interfaces
、show protocols
show routing-instances
、和show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
user@PE1# show interfaces interfaces { ge-1/2/1 { unit 0 { family inet6 { address ::10.1.1.2/126; } } } ge-1/2/2 { unit 0 { family inet { address 10.1.1.5/30; } family mpls; } } lo0 { unit 0 { family inet { address 192.0.2.2/32; } } } }
user@PE1# show protocols mpls { ipv6-tunneling; interface ge-1/2/2.0; } bgp { group toPE2 { type internal; local-address 192.0.2.2; family inet6-vpn { unicast; } neighbor 192.0.2.4; } } ospf { area 0.0.0.0 { interface lo0.0 { passive; } interface ge-1/2/2.0; } } ldp { interface ge-1/2/2.0; interface lo0.0; }
user@PE1# show routing-instances red { instance-type vrf; interface ge-1/2/1.0; route-distinguisher 64512:1; vrf-target target:64512:1; routing-options { router-id 192.0.2.2; autonomous-system 64510 independent-domain; } protocols { bgp { group toCE1 { type internal; family inet6 { unicast; } neighbor ::10.1.1.1; } } } }
user@PE1# show routing-options router-id 192.0.2.2; autonomous-system 64512;
如果完成设备配置,请从配置模式输入 commit
。
验证
确认配置工作正常。
验证 CE 设备是否具有连接性
目的
确保隧道正在运行。
行动
在作模式下,输入 ping
命令。
user@CE1> ping ::192.0.2.5 PING6(56=40+8+8 bytes) ::10.1.1.1 --> ::192.0.2.5 16 bytes from ::192.0.2.5, icmp_seq=0 hlim=63 time=1.943 ms 16 bytes from ::192.0.2.5, icmp_seq=1 hlim=63 time=1.587 ms ^C --- ::192.0.2.5 ping6 statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max/std-dev = 1.587/1.765/1.943/0.178 ms
user@CE2> ping ::192.0.2.1 PING6(56=40+8+8 bytes) ::10.1.1.14 --> ::192.0.2.1 16 bytes from ::192.0.2.1, icmp_seq=0 hlim=63 time=2.097 ms 16 bytes from ::192.0.2.1, icmp_seq=1 hlim=63 time=1.610 ms ^C --- ::192.0.2.1 ping6 statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max/std-dev = 1.610/1.853/2.097/0.244 ms
意义
IPv6 CE 设备可以通过核心 IPv4 网络进行通信。
检查 AS 路径
目的
确保提供商 AS 编号未出现在 CE 设备路由表中。
行动
在作模式下,输入 show route protocol bgp detail
命令。
user@CE1> show route protocol bgp detail inet6.0: 8 destinations, 8 routes (8 active, 0 holddown, 0 hidden) ::192.0.2.5/32 (1 entry, 1 announced) *BGP Preference: 170/-101 Next hop type: Indirect Address: 0x9514354 Next-hop reference count: 6 Source: ::10.1.1.2 Next hop type: Router, Next hop index: 924 Next hop: ::10.1.1.2 via ge-1/2/1.0, selected Session Id: 0x500001 Protocol next hop: ::10.1.1.2 Indirect next hop: 0x971c000 262147 INH Session ID: 0x500002 State: <Active Int Ext> Local AS: 64510 Peer AS: 64510 Age: 50:58 Metric2: 0 Validation State: unverified Task: BGP_64510.::10.1.1.2+45824 Announcement bits (2): 0-KRT 2-Resolve tree 2 AS path: I Accepted Localpref: 100 Router ID: 192.0.2.2 ::10.1.1.12/126 (1 entry, 1 announced) *BGP Preference: 170/-101 Next hop type: Indirect Address: 0x9514354 Next-hop reference count: 6 Source: ::10.1.1.2 Next hop type: Router, Next hop index: 924 Next hop: ::10.1.1.2 via ge-1/2/1.0, selected Session Id: 0x500001 Protocol next hop: ::10.1.1.2 Indirect next hop: 0x971c000 262147 INH Session ID: 0x500002 State: <Active Int Ext> Local AS: 64510 Peer AS: 64510 Age: 50:58 Metric2: 0 Validation State: unverified Task: BGP_64510.::10.1.1.2+45824 Announcement bits (2): 0-KRT 2-Resolve tree 2 AS path: I Accepted Localpref: 100 Router ID: 192.0.2.2
user@CE2> show route protocol bgp detail inet6.0: 8 destinations, 8 routes (8 active, 0 holddown, 0 hidden) ::192.0.2.1/32 (1 entry, 1 announced) *BGP Preference: 170/-101 Next hop type: Indirect Address: 0x9514354 Next-hop reference count: 6 Source: ::10.1.1.13 Next hop type: Router, Next hop index: 914 Next hop: ::10.1.1.13 via ge-1/2/4.0, selected Session Id: 0x400001 Protocol next hop: ::10.1.1.13 Indirect next hop: 0x971c000 262150 INH Session ID: 0x400002 State: <Active Int Ext> Local AS: 64510 Peer AS: 64510 Age: 50:41 Metric2: 0 Validation State: unverified Task: BGP_64510.::10.1.1.13+59329 Announcement bits (2): 0-KRT 2-Resolve tree 2 AS path: I Accepted Localpref: 100 Router ID: 192.0.2.4 ::10.1.1.0/126 (1 entry, 1 announced) *BGP Preference: 170/-101 Next hop type: Indirect Address: 0x9514354 Next-hop reference count: 6 Source: ::10.1.1.13 Next hop type: Router, Next hop index: 914 Next hop: ::10.1.1.13 via ge-1/2/4.0, selected Session Id: 0x400001 Protocol next hop: ::10.1.1.13 Indirect next hop: 0x971c000 262150 INH Session ID: 0x400002 State: <Active Int Ext> Local AS: 64510 Peer AS: 64510 Age: 50:41 Metric2: 0 Validation State: unverified Task: BGP_64510.::10.1.1.13+59329 Announcement bits (2): 0-KRT 2-Resolve tree 2 AS path: I Accepted Localpref: 100 Router ID: 192.0.2.4
意义
输出显示,对于 CE 设备上的 BGP 路由,AS 路径属性不包括提供商 AS 64512。