帮助我们改善您的体验。

让我们了解您的想法。

您是否能抽出两分钟的时间完成一份问卷调查?

header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
MPLS 应用程序用户指南
Table of Contents Expand all
list Table of Contents

机器翻译对您有帮助吗?

starstarstarstarstar
Go to English page
免责声明:

我们将使用第三方机器翻译软件翻译本页面。瞻博网络虽已做出相当大的努力提供高质量译文,但无法保证其准确性。如果对译文信息的准确性有任何疑问,请参阅英文版本. 可下载的 PDF 仅提供英文版.

IPv6-over-IPv4 隧道

date_range 18-Jan-25

为 MPLS 配置 IPv6 隧道

您可以配置 MPLS 的 IPv6 隧道,以便通过基于 MPLS 的 IPv4 网络对 IPv6 流量进行隧道传输。此配置允许您通过基于 IPv4 的网络核心互连多个较小的 IPv6 网络,使您能够提供 IPv6 服务,而无需升级核心网络中的交换机。BGP 配置为在 IPv6 网络之间交换路由,并通过基于 IPv4 的 MPLS 在这些 IPv6 网络之间建立数据隧道。

要在 EX 系列交换机上为 MPLS 配置 IPv6 隧道,请执行以下操作:

  1. 为所有核心接口配置 IPv4 和 IPv6 IP 地址:
    content_copy zoom_out_map
    [edit] 
    user@switch# set interfaces interface-name unit logical-unit-number family inet address address
  2. 将网络信息中心 (NIC) 分配给您的编号配置为自治系统 (AS) 编号
    content_copy zoom_out_map
    [edit routing-options]
    user@switch# set autonomous-system number
  3. 将标签 0 播发到 LSP 的出口路由器:
    content_copy zoom_out_map
    [edit protocols] 
    user@switch# set mpls explicit-null
  4. 配置 LSP 以允许通过 MPLS 网络解析 IPv6 路由,方法是将存储在 inet3 路由表中的所有路由转换为 IPv4 映射的 IPv6 地址,然后将其复制到 inet6.3 路由表中:
    content_copy zoom_out_map
    [edit protocols] 
    user@switch# set mpls ipv6-tunneling
  5. 设置本地 AS 编号:
    content_copy zoom_out_map
    [edit protocols bgp] 
    user@switch# set local-as local-autonomous-system-number
  6. 配置默认导入和导出策略:
    content_copy zoom_out_map
    [edit protocols bgp]
    user@switch# set local-address address
    user@switch# set import default-import
    user@switch# set family inet6 labeled-unicast explicit-null
    user@switch# set export default-export
  7. 配置仅将指定的 BGP 系统识别为对等方的 BGP 组。定义组名称、组类型、BGP 会话的本地端和邻接方(对等方)。要配置多个 BGP 对等方,请包含多个邻居语句:
    content_copy zoom_out_map
    [edit protocols bgp] 
    user@switch# set group group-name type internal 
    user@switch# set group group-name local-address address-of-the-local-end-of-a-bgp-session
    user@switch# set group group-name family inet6 labeled-unicast explicit-null
    user@switch# set group group-name peer-as peer-autonomous-system-number
    user@switch# set group group-name neighbor address family inet6 labeled-unicast explicit-null
  8. 配置路由选项以接受默认导入和导出策略:
    content_copy zoom_out_map
    [edit policy-options]
    user@switch# set policy-statement default-import then accept 
    user@switch# set policy-statement default-export then accept

示例:通过 MPLS IPv4 网络建立隧道的 IPv6 流量

此示例说明如何将 Junos OS 配置为通过基于 MPLS 的 IPv4 网络通过隧道传输 IPv6。外部 BGP (EBGP) 用于客户边缘 (CE) 和提供商边缘 (PE) 设备之间。远程 CE 设备具有不同的 AS 编号,用于环路检测。

要求

在配置此示例之前,不需要除设备初始化之外的特殊配置。

概述

以下互联网草案介绍了瞻博网络实施基于 MPLS 的 IPv6 的详细信息:

  • 互联网草案 draft-ietf-l3vpn-bgp-ipv6-07.txt,IPv6 VPN 的 BGP-MPLS IP VPN 扩展 (2006 年 1 月到期)

  • 互联网draft-ooms-v6ops-bgp-tunnel-06.txt草案, 使用 IPv6 提供商边缘路由器通过 IPv4 MPLS 连接 IPv6 孤岛 (2006 年 7 月到期)

这些互联网草案可在 IETF 网站 http://www.ietf.org/ 上找到。

此示例说明如何通过基于 IPv4 的网络核心互连两个 IPv6 网络,使您能够提供 IPv6 服务,而无需升级核心网络中的路由器。多协议边界网关协议 (MP-BGP) 配置为在 IPv6 网络之间交换路由,并且数据通过基于 IPv4 的 MPLS 在这些 IPv6 网络之间建立隧道。

在 中 图 1,路由器 PE1 和 PE2 是双堆栈 BGP 路由器,这意味着它们同时具有 IPv4 和 IPv6 堆栈。PE 路由器通过客户边缘 (CE) 路由器将 IPv6 网络链接到 IPv4 核心网络。客户边缘路由器和 PE 路由器通过可承载 IPv6 流量的链路层进行连接。PE 路由器在面向客户边缘路由器的接口上使用 IPv6,在面向核心的接口上使用 IPv4 和 MPLS。请注意,其中一个连接的 IPv6 网络可能是全球 IPv6 互联网。

图 1: 通过 MPLS 连接的 IPv6 网络 IPv4 隧道通过 MPLS 连接的 IPv6 网络 IPv4 隧道

两个 PE 路由器使用 IPv4 地址通过 MP-BGP 会话链接。它们使用该会话将 IPv6 路由与 IPv6(值 2)地址族指示器 (AFI) 和后续 AFI (SAFI)(值 4)交换。每个 PE 路由器将此会话上播发的 IPv6 路由的下一跃点设置为自己的 IPv4 地址。由于 MP-BGP 要求 BGP 下一跃点与网络层可达性信息 (NLRI) 对应的地址族,因此此 IPv4 地址需要嵌入到 IPv6 格式中。

PE 路由器可以使用路由协议下一代路由信息协议 (RIPng) 或 MP-BGP 或通过静态配置,从与其连接的客户边缘路由器学习 IPv6 路由。请注意,如果将 BGP 用作 PE 路由器到 CE 路由器协议,则 PE 路由器与客户边缘路由器之间的 MP-BGP 会话可能会通过 IPv4 或 IPv6 传输控制协议 (TCP) 会话进行。此外,在该会话上交换的 BGP 路由将具有 SAFI 单播。您必须配置导出策略才能在 IBGP 和 EBGP 之间以及 BGP 和任何其他协议之间传递路由。

PE 路由器具有路由到彼此 IPv4 地址的 MPLS LSP。IPv4 通过 LDP 或 RSVP 为 LSP 提供信令。这些 LSP 用于解析从 MP-BGP 获知的 IPv6 路由的下一跃点地址。下一跃点使用 IPv4 映射的 IPv6 地址,而 LSP 使用 IPv4 地址。

PE 路由器始终使用标签值 2(RFC 3032,MPLS 标签堆栈编码中定义的 IPv6 显式空标签)相互通告 IPv6 路由。因此,从远程 PE 路由器获知的 IPv6 路由的每个转发下一跃点通常会推送两个标签。内部标签为 2(如果广告 PE 路由器不是瞻博网络路由平台,则此标签可能会有所不同),外部标签为 LSP 标签。如果 LSP 是单跳 LSP,则仅推送标签 2。

PE 路由器也可以使用 SAFI 单播交换普通 IPv6 路由。但是,交换标记的 IPv6 路由有一个主要优势。MPLS LSP 的倒数第二跳路由器可以弹出外部标签,然后将带有内部标签的数据包作为 MPLS 数据包发送。如果没有内部标签,倒数第二个跃点路由器将需要发现数据包是 IPv4 还是 IPv6 数据包,以正确设置第 2 层标头中的协议字段。

当 中的 图 1 PE1 路由器从 CE1 路由器接收到 IPv6 数据包时,它会在 IPv6 转发表中执行查找。如果目标与从 CE2 路由器获知的前缀匹配,则无需推送标签,只需将数据包发送到 CE2 路由器即可。如果目标与从 PE2 路由器获知的前缀匹配,则 PE1 路由器会将两个标签推送到数据包上,并将其发送到提供商路由器。内部标签为 2,外部标签是 PE2 路由器的 LSP 标签。

服务提供商网络中的每个提供商路由器都像处理任何 MPLS 数据包一样处理数据包,在提供商路由器之间传递时交换标签。LSP 的倒数第二个跃点提供商路由器会弹出外部标签并将数据包发送到 PE2 路由器。当 PE2 路由器收到数据包时,它会识别数据包上的 IPv6 显式空标签(标签 2)。它会弹出此标签并将其视为 IPv6 数据包,在 IPv6 转发表中执行查找并将数据包转发到 CE3 路由器。

此示例包括以下设置:

  • 除了在所有面向客户边缘路由器的接口上配置 family inet6 语句外,还必须在运行 MPLS 的所有面向核心的接口上配置语句。这两种配置都是必需的,因为路由器必须能够处理在这些接口上接收的任何 IPv6 数据包。您应该不会看到任何常规 IPv6 流量到达这些接口,但您将收到标记为标签 2 的 MPLS 数据包。即使标签 2 MPLS 数据包在 IPv4 中发送,这些数据包仍被视为本机 IPv6 数据包。

  • 您可以通过在 ipv6-tunneling PE 路由器的配置中包含语句来启用 IPv6 隧道。此语句允许通过 MPLS 网络解析 IPv6 路由,方法是将存储在 inet.3 路由表中的所有路由转换为 IPv4 映射的 IPv6 地址,然后将其复制到 inet6.3 路由表中。此路由表可用于解析 inet6 和 inet6-vpn 路由的下一跃点。

    注:

    BGP 会自动运行其导入策略,即使将路由从主路由表组复制到辅助路由表组也是如此。如果 IPv4 标记的路由从 BGP 会话到达(例如,在 PE 路由器的层次结构级别配置labeled-unicast[edit protocols bgp family inet]语句时),BGP 邻接方的导入策略也接受 IPv6 路由,因为邻接方的导入策略是在对 inet6.3 路由表执行复制操作时运行的。

  • 将 MP-BGP 配置为传输 IPv6 流量时,将在目标 PE 路由器上移除 IPv4 MPLS 标签。然后,可以将剩余没有标签的 IPv6 数据包转发到 IPv6 网络。要启用此功能,请将语句 explicit-null 包含在 BGP 配置中。

配置

CLI 快速配置

要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,然后将命令复制并粘贴到层次结构级别的 CLI [edit] 中。

设备 PE1

content_copy zoom_out_map
set interfaces fe-1/2/0 unit 0 family inet6 address ::10.1.1.2/126
set interfaces fe-1/2/0 unit 0 family mpls
set interfaces fe-1/2/1 unit 0 family inet address 10.1.1.5/30
set interfaces fe-1/2/1 unit 0 family inet6
set interfaces fe-1/2/1 unit 0 family mpls
set interfaces lo0 unit 0 family inet address 10.1.1.2/32
set protocols mpls ipv6-tunneling
set protocols mpls interface fe-1/2/0.0
set protocols mpls interface fe-1/2/1.0
set protocols bgp group toCE1 type external
set protocols bgp group toCE1 local-address ::10.1.1.2
set protocols bgp group toCE1 family inet6 unicast
set protocols bgp group toCE1 export send-bgp6
set protocols bgp group toCE1 peer-as 65001
set protocols bgp group toCE1 neighbor ::10.1.1.1
set protocols bgp group toPE2 type internal
set protocols bgp group toPE2 local-address 10.1.1.2
set protocols bgp group toPE2 family inet6 labeled-unicast explicit-null
set protocols bgp group toPE2 export next-hop-self
set protocols bgp group toPE2 export send-v6
set protocols bgp group toPE2 neighbor 10.1.1.4
set protocols ospf area 0.0.0.0 interface fe-1/2/1.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ldp interface fe-1/2/1.0
set policy-options policy-statement next-hop-self then next-hop self
set policy-options policy-statement send-bgp6 from family inet6
set policy-options policy-statement send-bgp6 from protocol bgp
set policy-options policy-statement send-bgp6 then accept
set policy-options policy-statement send-v6 from family inet6
set policy-options policy-statement send-v6 from protocol bgp
set policy-options policy-statement send-v6 from protocol direct
set policy-options policy-statement send-v6 then accept
set routing-options router-id 10.1.1.2
set routing-options autonomous-system 65002

设备 PE2

content_copy zoom_out_map
set interfaces fe-1/2/0 unit 0 family inet address 10.1.1.10/30
set interfaces fe-1/2/0 unit 0 family inet6
set interfaces fe-1/2/0 unit 0 family mpls
set interfaces fe-1/2/1 unit 0 family inet6 address ::10.1.1.13/126
set interfaces fe-1/2/1 unit 0 family mpls
set interfaces lo0 unit 0 family inet address 10.1.1.4/32
set protocols mpls ipv6-tunneling
set protocols mpls interface fe-1/2/0.0
set protocols mpls interface fe-1/2/1.0
set protocols bgp group toPE1 type internal
set protocols bgp group toPE1 local-address 10.1.1.4
set protocols bgp group toPE1 family inet6 labeled-unicast explicit-null
set protocols bgp group toPE1 export next-hop-self
set protocols bgp group toPE1 export send-v6
set protocols bgp group toPE1 neighbor 10.1.1.2
set protocols bgp group toCE3 type external
set protocols bgp group toCE3 local-address ::10.1.1.13
set protocols bgp group toCE3 family inet6 unicast
set protocols bgp group toCE3 export send-bgp6
set protocols bgp group toCE3 peer-as 65003
set protocols bgp group toCE3 neighbor ::10.1.1.14
set protocols ospf area 0.0.0.0 interface fe-1/2/0.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ldp interface fe-1/2/0.0
set policy-options policy-statement next-hop-self then next-hop self
set policy-options policy-statement send-bgp6 from family inet6
set policy-options policy-statement send-bgp6 from protocol bgp
set policy-options policy-statement send-bgp6 then accept
set policy-options policy-statement send-v6 from family inet6
set policy-options policy-statement send-v6 from protocol bgp
set policy-options policy-statement send-v6 from protocol direct
set policy-options policy-statement send-v6 then accept
set routing-options router-id 10.1.1.4
set routing-options autonomous-system 65002

设备 P

content_copy zoom_out_map
set interfaces fe-1/2/0 unit 0 family inet address 10.1.1.6/30
set interfaces fe-1/2/0 unit 0 family inet6
set interfaces fe-1/2/0 unit 0 family mpls
set interfaces fe-1/2/1 unit 0 family inet address 10.1.1.9/30
set interfaces fe-1/2/1 unit 0 family inet6
set interfaces fe-1/2/1 unit 0 family mpls
set interfaces lo0 unit 0 family inet address 10.1.1.3/32
set protocols mpls interface fe-1/2/0.0
set protocols mpls interface fe-1/2/1.0
set protocols ospf area 0.0.0.0 interface fe-1/2/0.0
set protocols ospf area 0.0.0.0 interface fe-1/2/1.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ldp interface fe-1/2/0.0
set protocols ldp interface fe-1/2/1.0
set routing-options router-id 10.1.1.3
set routing-options autonomous-system 65002

设备 CE1

content_copy zoom_out_map
set interfaces fe-1/2/0 unit 0 family inet6 address ::10.1.1.1/126
set interfaces lo0 unit 0 family inet6 address ::10.255.1.1/128
set protocols bgp group toPE1 type external
set protocols bgp group toPE1 local-address ::10.1.1.1
set protocols bgp group toPE1 family inet6 unicast
set protocols bgp group toPE1 export send-v6
set protocols bgp group toPE1 peer-as 65002
set protocols bgp group toPE1 neighbor ::10.1.1.2
set policy-options policy-statement send-v6 from family inet6
set policy-options policy-statement send-v6 from protocol direct
set policy-options policy-statement send-v6 then accept
set routing-options router-id 10.255.1.1
set routing-options autonomous-system 65001

设备 CE3

content_copy zoom_out_map
set interfaces fe-1/2/0 unit 0 family inet6 address ::10.1.1.14/126
set interfaces lo0 unit 0 family inet6 address ::10.255.1.5/128
set protocols bgp group toPE2 type external
set protocols bgp group toPE2 local-address ::10.1.1.14
set protocols bgp group toPE2 family inet6 unicast
set protocols bgp group toPE2 export send-v6
set protocols bgp group toPE2 peer-as 65002
set protocols bgp group toPE2 neighbor ::10.1.1.13
set policy-options policy-statement send-v6 from family inet6
set policy-options policy-statement send-v6 from protocol direct
set policy-options policy-statement send-v6 then accept
set routing-options router-id 10.255.1.5
set routing-options autonomous-system 65003

配置设备 PE1

分步过程

下面的示例要求您在各个配置层级中进行导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器

要配置设备 PE1:

  1. 配置接口。

    content_copy zoom_out_map
    [edit interfaces]
    user@PE1# set fe-1/2/0 unit 0 family inet6 address ::10.1.1.2/126
    user@PE1# set fe-1/2/0 unit 0 family mpls
    user@PE1# set fe-1/2/1 unit 0 family inet address 10.1.1.5/30
    user@PE1# set fe-1/2/1 unit 0 family inet6
    user@PE1# set fe-1/2/1 unit 0 family mpls
    user@PE1# set lo0 unit 0 family inet address 10.1.1.2/32
    
  2. 在接口上配置 MPLS。

    content_copy zoom_out_map
    [edit protocols mpls]
    user@PE1# set ipv6-tunneling
    user@PE1# set interface fe-1/2/0.0
    user@PE1# set interface fe-1/2/1.0
    
  3. 配置 BGP。

    content_copy zoom_out_map
    [edit protocols bgp]
    user@PE1# set group toCE1 type external
    user@PE1# set group toCE1 local-address ::10.1.1.2
    user@PE1# set group toCE1 family inet6 unicast
    user@PE1# set group toCE1 export send-bgp6
    user@PE1# set group toCE1 peer-as 65001
    user@PE1# set group toCE1 neighbor ::10.1.1.1
    user@PE1# set group toPE2 type internal
    user@PE1# set group toPE2 local-address 10.1.1.2
    user@PE1# set group toPE2 family inet6 labeled-unicast explicit-null
    user@PE1# set group toPE2 export next-hop-self
    user@PE1# set group toPE2 export send-v6
    user@PE1# set group toPE2 neighbor 10.1.1.4
    
  4. 配置 OSPF

    content_copy zoom_out_map
    [edit protocols ospf area 0.0.0.0]
    user@PE1# set interface fe-1/2/1.0
    user@PE1# set interface lo0.0 passive
    
  5. 配置信令协议。

    content_copy zoom_out_map
    [edit protocols]
    user@PE1# set ldp interface fe-1/2/1.0
    
  6. 配置路由策略。

    content_copy zoom_out_map
    [edit policy-options]
    user@PE1# set policy-statement next-hop-self then next-hop self
    user@PE1# set policy-statement send-bgp6 from family inet6
    user@PE1# set policy-statement send-bgp6 from protocol bgp
    user@PE1# set policy-statement send-bgp6 then accept
    user@PE1# set policy-statement send-v6 from family inet6
    user@PE1# set policy-statement send-v6 from protocol bgp
    user@PE1# set policy-statement send-v6 from protocol direct
    user@PE1# set policy-statement send-v6 then accept
    
  7. 配置路由器 ID 和自治系统 (AS) 编号。

    content_copy zoom_out_map
    [edit routing-options]
    user@PE1# set router-id 10.1.1.2
    user@PE1# set autonomous-system 675002
    
结果

在配置模式下,输入 show interfacesshow policy-optionsshow protocolsshow routing-options 命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以便进行更正。

content_copy zoom_out_map
user@R1# show interfaces
fe-1/2/0 {
    unit 0 {
        family inet6 {
            address ::10.1.1.2/126;
        }
        family mpls;
    }
}
fe-1/2/1 {
    unit 0 {
        family inet {
            address 10.1.1.5/30;
        }
        family inet6;
        family mpls;
    }
}
lo0 {
    unit 0 {
        family inet {
            address 10.1.1.2/32;
        }
    }
}
content_copy zoom_out_map
user@R1# show policy-options
policy-statement next-hop-self {
    then {
        next-hop self;
    }
}
policy-statement send-bgp6 {
    from {
        family inet6;
        protocol bgp;
    }
    then accept;
}
policy-statement send-v6 {
    from {
        family inet6;
        protocol [ bgp direct ];
    }
    then accept;
}
content_copy zoom_out_map
user@R1# show protocols
mpls {
    ipv6-tunneling;
    interface fe-1/2/0.0;
    interface fe-1/2/1.0;
}
bgp {
    group toCE1 {
        type external;
        local-address ::10.1.1.2;
        family inet6 {
            unicast;
        }
        export send-bgp6;
        peer-as 65001;
        neighbor ::10.1.1.1;
    }
    group toPE2 {
        type internal;
        local-address 10.1.1.2;
        family inet6 {
            labeled-unicast {
                explicit-null;
            }
        }
        export [ next-hop-self send-v6 ];
        neighbor 10.1.1.4;
    }
}
ospf {
    area 0.0.0.0 {
        interface fe-1/2/1.0;
        interface lo0.0 {
            passive;
        }
    }
}
ldp {
    interface fe-1/2/1.0;
}
content_copy zoom_out_map
user@R1# show routing-options
router-id 10.1.1.2;
autonomous-system 65002;

如果完成设备配置,请从配置模式输入 commit配置拓扑中的其他设备,如 CLI 快速配置所示。

验证

确认配置工作正常。

验证 CE 设备是否具有连接性

目的

确保隧道正在运行。

操作

在操作模式下,输入 ping 命令。

content_copy zoom_out_map
user@CE1> ping ::10.1.1.14
PING6(56=40+8+8 bytes) ::10.1.1.1 --> ::10.1.1.14
16 bytes from ::10.1.1.14, icmp_seq=0 hlim=61 time=10.687 ms
16 bytes from ::10.1.1.14, icmp_seq=1 hlim=61 time=9.239 ms
16 bytes from ::10.1.1.14, icmp_seq=2 hlim=61 time=1.842 ms
content_copy zoom_out_map
user@CE3> ping ::10.1.1.1
PING6(56=40+8+8 bytes) ::10.1.1.14 --> ::10.1.1.1
16 bytes from ::10.1.1.1, icmp_seq=0 hlim=61 time=1.484 ms
16 bytes from ::10.1.1.1, icmp_seq=1 hlim=61 time=1.338 ms
16 bytes from ::10.1.1.1, icmp_seq=2 hlim=61 time=1.351 ms
意义

IPv6 CE 设备可以通过核心 IPv4 网络进行通信。

footer-navigation