帮助我们改善您的体验。

让我们了解您的想法。

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

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

机器翻译对您有帮助吗?

starstarstarstarstar
Go to English page
免责声明:

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

示例:在 OSPF 网络中通过 SR-TE 建立隧道 LDP

date_range 18-Jan-25

概述

此示例说明如何在 OSPF 网络中配置 SR-TE 上的 LDP 隧道。这通过验证是否启用了基于 SR-TE 的 LDP 隧道以及到远程边缘设备的 LDP 隧道是否采用了正确的路径来说明这一点。它还显示,到远程边缘设备的路由使用 LDP 转发,并通过 SR-TE 建立隧道。在以下拓扑 (图 1) 中,PE1 和 PE2 是仅支持 IPv4 设备 CE1 和 CE2 的入口和出口设备。设备 R1、R2、R3 和 R4 构成了仅支持 IPv4 的 SR-TE 核心网络。拓扑显示了两个 LDP 域:LDP 域由设备 CE1 和 PE1 组成;LDP 域 B 由设备 PE2 和 CE2 组成。LDP 域连接到 SR-TE 核心网络,后者通过在 SR-TE 上建立隧道,从而将 LSP 会话扩展到核心。

拓扑学

图 1: 在 OSPF 网络中通过 SR-TE 建立隧道 LDP在 OSPF 网络中通过 SR-TE 建立隧道 LDP

要求

此示例使用以下硬件和软件组件:

  • MX 系列路由器可作为 CE、PE 和核心路由器。

  • 在所有设备上运行的 Junos OS 22.4R1 或更高版本。

配置

要在核心网络中通过 SR-TE 传输 LDP LSP 隧道,请执行以下操作:

CLI 快速配置

要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层级的 CLI 中,然后从配置模式进入 commit

注: 配置 enhanced-ip 语句并提交配置时,将显示以下警告消息,提示您重新启动路由器:
content_copy zoom_out_map
'chassis'
WARNING: Chassis configuration for network services has been changed. A system reboot is mandatory. Please reboot the system NOW. Continuing without a reboot might result in unexpected system behavior.
commit complete
重新启动将显示路由器上的 FPC。

设备 CE1

content_copy zoom_out_map
set chassis network-services enhanced-ip
set interfaces ge-0/0/1 description CE1-to-PE1
set interfaces ge-0/0/1 unit 0 family inet address 10.1.1.1/24
set interfaces lo0 unit 0 family inet address 192.168.100.11/32
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set routing-options router-id 192.168.100.11

设备 PE1

content_copy zoom_out_map
set chassis network-services enhanced-ip
set interfaces ge-0/0/1 description PE1-to-CE1
set interfaces ge-0/0/1 unit 0 family inet address 10.1.1.2/24
set interfaces ge-0/0/1 unit 0 family mpls maximum-labels 8
set interfaces ge-0/0/3 description PE1-to-R1
set interfaces ge-0/0/3 unit 0 family inet address 10.1.2.1/24
set interfaces ge-0/0/3 unit 0 family mpls maximum-labels 8
set interfaces lo0 unit 0 family inet address 192.168.100.5/32
set interfaces lo0 unit 0 family mpls
set policy-options policy-statement export_bgp term a from protocol bgp
set policy-options policy-statement export_bgp term a from protocol direct
set policy-options policy-statement export_bgp term a then accept
set routing-instances CE1_vpn1 instance-type vrf
set routing-instances CE1_vpn1 protocols ospf area 0.0.0.0 interface ge-0/0/1.0
set routing-instances CE1_vpn1 protocols ospf export export_bgp
set routing-instances CE1_vpn1 interface ge-0/0/1.0
set routing-instances CE1_vpn1 route-distinguisher 192.168.100.5:1
set routing-instances CE1_vpn1 vrf-target target:100:4
set routing-instances CE1_vpn1 vrf-table-label
set routing-options router-id 192.168.100.5
set routing-options autonomous-system 65410
set protocols bgp group ibgp1 type internal
set protocols bgp group ibgp1 local-address 192.168.100.5
set protocols bgp group ibgp1 family inet unicast
set protocols bgp group ibgp1 family inet-vpn unicast
set protocols bgp group ibgp1 neighbor 192.168.100.6
set protocols ldp interface ge-0/0/3.0
set protocols ldp interface lo0.0
set protocols mpls interface ge-0/0/3.0
set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 point-to-point
set protocols ospf area 0.0.0.0 interface lo0.0 passive

设备 R1

content_copy zoom_out_map
set chassis network-services enhanced-ip
set interfaces ge-0/0/1 description R1-to-R2
set interfaces ge-0/0/1 unit 0 family inet address 10.1.3.1/24
set interfaces ge-0/0/1 unit 0 family mpls maximum-labels 8
set interfaces ge-0/0/2 description R1-to-R3
set interfaces ge-0/0/2 unit 0 family inet address 10.1.4.1/24
set interfaces ge-0/0/2 unit 0 family mpls maximum-labels 8
set interfaces ge-0/0/3 description R1-to-PE1
set interfaces ge-0/0/3 unit 0 family inet address 10.1.2.2/24
set interfaces ge-0/0/3 unit 0 family mpls maximum-labels 8
set interfaces lo0 unit 0 family inet address 192.168.100.1/32
set interfaces lo0 unit 0 family mpls
set routing-options router-id 192.168.100.1
set protocols ldp auto-targeted-session
set protocols ldp preference 1
set protocols ldp interface ge-0/0/1.0
set protocols ldp interface ge-0/0/3.0
set protocols ldp interface lo0.0
set protocols mpls interface ge-0/0/1.0
set protocols mpls interface ge-0/0/2.0
set protocols mpls interface ge-0/0/3.0
set protocols ospf backup-spf-options use-post-convergence-lfa
set protocols ospf backup-spf-options use-source-packet-routing
set protocols ospf traffic-engineering l3-unicast-topology
set protocols ospf traffic-engineering credibility-protocol-preference
set protocols ospf traffic-engineering advertisement always
set protocols ospf traffic-engineering tunnel-source-protocol spring-te
set protocols ospf source-packet-routing node-segment ipv4-index 5001
set protocols ospf source-packet-routing srgb start-label 80000
set protocols ospf source-packet-routing srgb index-range 50000
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 point-to-point
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 post-convergence-lfa
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 ipv4-adjacency-segment protected index 108
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 ipv4-adjacency-segment unprotected index 110
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 point-to-point
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 post-convergence-lfa
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 ipv4-adjacency-segment protected index 104
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 ipv4-adjacency-segment unprotected index 106
set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 point-to-point
set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 post-convergence-lfa
set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 ipv4-adjacency-segment protected index 100
set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 ipv4-adjacency-segment unprotected index 102
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols source-packet-routing segment-list seg1 inherit-label-nexthops
set protocols source-packet-routing segment-list seg1 auto-translate
set protocols source-packet-routing segment-list seg1 hop1 ip-address 10.1.4.2
set protocols source-packet-routing segment-list seg1 hop2 ip-address 10.1.5.2
set protocols source-packet-routing segment-list seg1 hop3 ip-address 10.1.6.2
set protocols source-packet-routing source-routing-path sr_static_r5 ldp-tunneling
set protocols source-packet-routing source-routing-path sr_static_r5 to 192.168.100.2
set protocols source-packet-routing source-routing-path sr_static_r5 binding-sid 1003001
set protocols source-packet-routing source-routing-path sr_static_r5 primary seg1

设备 R2

content_copy zoom_out_map
set chassis network-services enhanced-ip
set interfaces ge-0/0/1 description R2-to-R1
set interfaces ge-0/0/1 unit 0 family inet address 10.1.3.2/24
set interfaces ge-0/0/1 unit 0 family mpls maximum-labels 8
set interfaces ge-0/0/2 description R2-to-R4
set interfaces ge-0/0/2 unit 0 family inet address 10.1.6.2/24
set interfaces ge-0/0/2 unit 0 family mpls maximum-labels 8
set interfaces ge-0/0/3 description R2-to-PE2
set interfaces ge-0/0/3 unit 0 family inet address 10.1.7.1/24
set interfaces ge-0/0/3 unit 0 family mpls maximum-labels 8
set interfaces lo0 unit 0 family inet address 192.168.100.2/32
set interfaces lo0 unit 0 family mpls
set routing-options router-id 192.168.100.2
set protocols ldp auto-targeted-session
set protocols ldp preference 1
set protocols ldp interface ge-0/0/1.0
set protocols ldp interface ge-0/0/3.0
set protocols ldp interface lo0.0
set protocols mpls interface ge-0/0/1.0
set protocols mpls interface ge-0/0/2.0
set protocols mpls interface ge-0/0/3.0
set protocols ospf backup-spf-options use-post-convergence-lfa
set protocols ospf backup-spf-options use-source-packet-routing
set protocols ospf traffic-engineering l3-unicast-topology
set protocols ospf traffic-engineering credibility-protocol-preference
set protocols ospf traffic-engineering advertisement always
set protocols ospf traffic-engineering tunnel-source-protocol spring-te
set protocols ospf source-packet-routing node-segment ipv4-index 5002
set protocols ospf source-packet-routing srgb start-label 80000
set protocols ospf source-packet-routing srgb index-range 50000
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 point-to-point
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 post-convergence-lfa
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 ipv4-adjacency-segment protected index 500
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 ipv4-adjacency-segment unprotected index 502
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 point-to-point
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 post-convergence-lfa
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 ipv4-adjacency-segment protected index 504
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 ipv4-adjacency-segment unprotected index 506
set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 point-to-point
set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 post-convergence-lfa
set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 ipv4-adjacency-segment protected index 508
set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 ipv4-adjacency-segment unprotected index 510
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols source-packet-routing segment-list seg1 inherit-label-nexthops
set protocols source-packet-routing segment-list seg1 auto-translate
set protocols source-packet-routing segment-list seg1 hop1 ip-address 10.1.6.1
set protocols source-packet-routing segment-list seg1 hop2 ip-address 10.1.5.1
set protocols source-packet-routing segment-list seg1 hop3 ip-address 10.1.4.1
set protocols source-packet-routing source-routing-path sr_static_r1 ldp-tunneling
set protocols source-packet-routing source-routing-path sr_static_r1 to 192.168.100.1
set protocols source-packet-routing source-routing-path sr_static_r1 binding-sid 1003001
set protocols source-packet-routing source-routing-path sr_static_r1 primary seg1

设备 R3

content_copy zoom_out_map
set chassis network-services enhanced-ip
set interfaces ge-0/0/1 description R3-to-R4
set interfaces ge-0/0/1 unit 0 family inet address 10.1.5.1/24
set interfaces ge-0/0/1 unit 0 family mpls
set interfaces ge-0/0/2 description R3-to-R1
set interfaces ge-0/0/2 unit 0 family inet address 10.1.4.2/24
set interfaces ge-0/0/2 unit 0 family mpls
set interfaces lo0 unit 0 family inet address 192.168.100.3/32
set interfaces lo0 unit 0 family mpls
set routing-options router-id 192.168.100.3
set protocols mpls interface ge-0/0/1.0
set protocols mpls interface ge-0/0/2.0
set protocols ospf backup-spf-options use-post-convergence-lfa
set protocols ospf backup-spf-options use-source-packet-routing
set protocols ospf traffic-engineering l3-unicast-topology
set protocols ospf traffic-engineering credibility-protocol-preference
set protocols ospf traffic-engineering advertisement always
set protocols ospf source-packet-routing node-segment ipv4-index 5003
set protocols ospf source-packet-routing srgb start-label 80000
set protocols ospf source-packet-routing srgb index-range 50000
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 point-to-point
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 post-convergence-lfa
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 ipv4-adjacency-segment protected index 204
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 ipv4-adjacency-segment unprotected index 206
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 point-to-point
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 post-convergence-lfa
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 ipv4-adjacency-segment protected index 200
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 ipv4-adjacency-segment unprotected index 202
set protocols ospf area 0.0.0.0 interface lo0.0 passive

设备 R4

content_copy zoom_out_map
set chassis network-services enhanced-ip
set interfaces ge-0/0/1 description R4-to-R3
set interfaces ge-0/0/1 unit 0 family inet address 10.1.5.2/24
set interfaces ge-0/0/1 unit 0 family mpls
set interfaces ge-0/0/2 description R4-to-R2
set interfaces ge-0/0/2 unit 0 family inet address 10.1.6.1/24
set interfaces ge-0/0/2 unit 0 family mpls
set interfaces lo0 unit 0 family inet address 192.168.100.4/32
set interfaces lo0 unit 0 family mpls
set routing-options router-id 192.168.100.4
set protocols mpls interface ge-0/0/1.0
set protocols mpls interface ge-0/0/2.0
set protocols ospf backup-spf-options use-post-convergence-lfa
set protocols ospf backup-spf-options use-source-packet-routing
set protocols ospf traffic-engineering l3-unicast-topology
set protocols ospf traffic-engineering credibility-protocol-preference
set protocols ospf traffic-engineering advertisement always
set protocols ospf source-packet-routing node-segment ipv4-index 5004
set protocols ospf source-packet-routing srgb start-label 80000
set protocols ospf source-packet-routing srgb index-range 50000
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 point-to-point
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 post-convergence-lfa
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 ipv4-adjacency-segment protected index 300
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 ipv4-adjacency-segment unprotected index 302
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 point-to-point
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 post-convergence-lfa
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 ipv4-adjacency-segment protected index 304
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 ipv4-adjacency-segment unprotected index 306
set protocols ospf area 0.0.0.0 interface lo0.0 passive

设备 PE2

content_copy zoom_out_map
set chassis network-services enhanced-ip
set interfaces ge-0/0/2 description PE2-to-CE2
set interfaces ge-0/0/2 unit 0 family inet address 10.1.8.1/24
set interfaces ge-0/0/2 unit 0 family mpls maximum-labels 8
set interfaces ge-0/0/3 description PE2-to-R2
set interfaces ge-0/0/3 unit 0 family inet address 10.1.7.2/24
set interfaces ge-0/0/3 unit 0 family mpls maximum-labels 8
set interfaces lo0 unit 0 family inet address 192.168.100.6/32
set interfaces lo0 unit 0 family mpls
set policy-options policy-statement export_bgp term a from protocol bgp
set policy-options policy-statement export_bgp term a from protocol direct
set policy-options policy-statement export_bgp term a then accept
set routing-instances CE2_vpn1 instance-type vrf
set routing-instances CE2_vpn1 protocols ospf area 0.0.0.0 interface ge-0/0/2.0
set routing-instances CE2_vpn1 protocols ospf export export_bgp
set routing-instances CE2_vpn1 interface ge-0/0/2.0
set routing-instances CE2_vpn1 route-distinguisher 192.168.100.6:1
set routing-instances CE2_vpn1 vrf-target target:100:4
set routing-instances CE2_vpn1 vrf-table-label
set routing-options router-id 192.168.100.6
set routing-options autonomous-system 65410
set protocols bgp group ibgp1 type internal
set protocols bgp group ibgp1 local-address 192.168.100.6
set protocols bgp group ibgp1 family inet unicast
set protocols bgp group ibgp1 family inet-vpn unicast
set protocols bgp group ibgp1 neighbor 192.168.100.5
set protocols ldp interface ge-0/0/3.0  
set protocols ldp interface lo0.0
set protocols mpls interface ge-0/0/3.0
set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 point-to-point
set protocols ospf area 0.0.0.0 interface lo0.0 passive

设备 CE2

content_copy zoom_out_map
set chassis network-services enhanced-ip
set interfaces ge-0/0/1 description CE2-to-PE2
set interfaces ge-0/0/2 unit 0 family inet address 10.1.8.2/24
set interfaces lo0 unit 0 family inet address 192.168.100.22/32
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set routing-options router-id 192.168.100.22

配置 PE1

分步过程

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

要配置设备 PE1:

  1. 将网络服务模式配置为增强型 IP。增强型 IP 将路由器的网络服务设置为增强型 Internet 协议,并使用增强模式功能。

    content_copy zoom_out_map
    [edit chassis]
    user@PE1#set network-services enhanced-ip
    
  2. 配置设备的接口。

    content_copy zoom_out_map
    [edit interfaces]
    user@PE1#set ge-0/0/1 description PE1-to-CE1
    user@PE1#set ge-0/0/1 unit 0 family inet address 10.1.1.2/24
    user@PE1#set ge-0/0/3 description PE1-to-R1
    user@PE1#set ge-0/0/3 unit 0 family inet address 10.1.2.1/24
    user@PE1#set ge-0/0/3 unit 0 family mpls
    user@PE1#set lo0 unit 0 family inet address 192.168.100.5/32
    user@PE1#set lo0 unit 0 family mpls
    
  3. 配置策略选项以将 BGP 路由导出到客户边缘路由器,在此示例中,客户边缘路由器运行 OSPF 协议。

    content_copy zoom_out_map
    [edit policy-options]
    user@PE1#set policy-statement export_bgp term a from protocol bgp
    user@PE1#set policy-statement export_bgp term a from protocol direct
    user@PE1#set policy-statement export_bgp term a then accept
    
  4. 配置第 3 层 VPN 路由实例以支持基于 OSPF 的 CE1 设备。

    content_copy zoom_out_map
    [edit routing-instances]
    user@PE1#set CE1_vpn1 instance-type vrf
    user@PE1#set CE1_vpn1 protocols ospf area 0.0.0.0 interface ge-0/0/1.0
    user@PE1#set CE1_vpn1 protocols ospf export export_bgp
    user@PE1#set CE1_vpn1 interface ge-0/0/1.0
    user@PE1#set CE1_vpn1 route-distinguisher 192.168.100.5:1
    user@PE1#set CE1_vpn1 vrf-target target:100:4
    user@PE1#set CE1_vpn1 vrf-table-label
  5. 配置设备 PE1 的路由器 ID 和自治系统编号。

    content_copy zoom_out_map
    [edit routing-options]
    user@PE1#set router-id 192.168.100.5
    userPE1# set autonomous-system 65410
  6. 在连接到核心网络的接口上配置 OSPF、LDP 和 MPLS。

    content_copy zoom_out_map
    [edit protocols]
    user@PE1#set ospf area 0.0.0.0 interface ge-0/0/3.0 point-to-point
    user@PE1#set ospf area 0.0.0.0 lo0.0 passive
    user@PE1#set ldp interface ge-0/0/3.0
    user@PE1#set ldp interface lo0.0
    user@PE1#set mpls interface ge-0/0/3.0
    user@PE1#set mpls interface lo0.0
    
  7. 在 PE 设备之间配置 BGP。

    content_copy zoom_out_map
    [edit protocols]
    user@PE1#set bgp group ibgp1 type internal
    user@PE1#set bgp group ibgp1 local-address 192.168.100.5
    user@PE1#set bgp group ibgp1 family inet unicast
    user@PE1#set bgp group ibgp1 family inet-vpn unicast
    user@PE1#set bgp group ibgp1 neighbor 192.168.100.6
    

结果

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

content_copy zoom_out_map
user@PE1#show chassis
network-services enhanced-ip;
content_copy zoom_out_map
user@PE1#show interfaces
ge-0/0/1 {
    description PE1-to-CE1;
    unit 0 {
        family inet {
            address 10.1.1.2/24;
        }
        family mpls {
            maximum-labels 8;
        }
    }
}
ge-0/0/3 {
    description PE1-to-R1;
    unit 0 {
        family inet {
            address 10.1.2.1/24;
        }
        family mpls {
            maximum-labels 8;
        }
    }
}
lo0 {
    unit 0 {
        family inet {
            address 192.168.100.5/32;
        }
        family mpls;
    }
}
content_copy zoom_out_map
user@PE1#show policy-options
policy-statement export_bgp {
    term a {
        from protocol [ bgp direct ];
        then accept;
    }
}
content_copy zoom_out_map
user@PE1#show routing-instances
CE1_vpn1 {
    instance-type vrf;
    protocols {
        ospf {
            area 0.0.0.0 {
                interface ge-0/0/1.0;
            }
            export export_bgp;
        }
    }
    interface ge-0/0/1.0;
    route-distinguisher 192.168.100.5:1;
    vrf-target target:100:4;
    vrf-table-label;
}
content_copy zoom_out_map
user@PE1#show routing-options
router-id 192.168.100.5;
autonomous-system 65410;
content_copy zoom_out_map
user@PE1#show protocols
bgp {
    group ibgp1 {
        type internal;
        local-address 192.168.100.5;
        family inet {
            unicast;
        }
        family inet-vpn {
            unicast;
        }
        neighbor 192.168.100.6;
    }
}
ldp {
    interface ge-0/0/3.0;
    interface lo0.0;
}
mpls {
    interface ge-0/0/3.0;
    interface lo0.0;
}
ospf {
    area 0.0.0.0 {
        interface ge-0/0/3.0 {
            point-to-point;
        }
        interface lo0.0 {
            passive;
        }
    }
}

配置 R1 设备

分步过程

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

要配置设备 R1:

  1. 将网络服务模式配置为增强型 IP。增强型 IP 将路由器的网络服务设置为增强型 Internet 协议,并使用增强模式功能。

    content_copy zoom_out_map
    [edit chassis]
    user@R1#set network-services enhanced-ip
    

    配置 enhanced-ip 语句并提交配置后,将显示以下警告消息,提示您重新启动路由器:

    content_copy zoom_out_map
    'chassis'
    WARNING: Chassis configuration for network services has been changed. A system reboot is mandatory. Please reboot the system NOW. Continuing without a reboot might result in unexpected system behavior.
    commit complete

    重新启动将显示路由器上的 FPC。

  2. 配置设备的接口。

    content_copy zoom_out_map
    [edit interfaces]
    user@R1#set ge-0/0/1 description R1-to-R2
    user@R1#set ge-0/0/1 unit 0 family inet address 10.1.3.1/24
    user@R1#set ge-0/0/1 unit 0 family mpls maximum-labels 8
    user@R1#set ge-0/0/2 description R1-to-R3
    user@R1#set ge-0/0/2 unit 0 family inet address 10.1.4.1/24
    user@R1#set ge-0/0/2 unit 0 family mpls maximum-labels 8
    user@R1#set ge-0/0/3 description R1-to-PE1
    user@R1#set ge-0/0/3 unit 0 family inet address 10.1.2.2/24
    user@R1#set ge-0/0/3 unit 0 family mpls maximum-labels 8
    user@R1#set lo0 unit 0 family inet address 192.168.100.1/32
    user@R1#set lo0 unit 0 family mpls
    
  3. 配置路由选项以标识域中的路由器。

    content_copy zoom_out_map
    [edit routing-options]
    user@R1#set router-id 192.168.100.1
    
  4. 在接口上配置 OSPF 邻接 SID 并分配 SRGB 标签以启用分段路由。整个 SRGB 中的标签可用于 OSPF。前缀 SID(和节点 SID)从 SRGB 编制索引。

    content_copy zoom_out_map
    [edit protocols]
    user@R1#set ospf area 0.0.0.0 interface ge-0/0/1.0 ipv4-adjacency-segment protected index 108
    user@R1#set ospf area 0.0.0.0 interface ge-0/0/1.0 ipv4-adjacency-segment unprotected index 110
    user@R1#set ospf area 0.0.0.0 interface ge-0/0/1.0 post-convergence-lfa
    user@R1#set ospf area 0.0.0.0 interface ge-0/0/1.0 point-to-point
    user@R1#set ospf area 0.0.0.0 interface ge-0/0/2.0 ipv4-adjacency-segment protected index 104
    user@R1#set ospf area 0.0.0.0 interface ge-0/0/2.0 ipv4-adjacency-segment unprotected index 106
    user@R1#set ospf area 0.0.0.0 interface ge-0/0/2.0 post-convergence-lfa
    user@R1#set ospf area 0.0.0.0 interface ge-0/0/2.0 point-to-point
    user@R1#set ospf area 0.0.0.0 interface ge-0/0/3.0 ipv4-adjacency-segment protected index 100
    user@R1#set ospf area 0.0.0.0 interface ge-0/0/3.0 ipv4-adjacency-segment unprotected index 102
    user@R1#set ospf area 0.0.0.0 interface ge-0/0/3.0 post-convergence-lfa
    user@R1#set ospf area 0.0.0.0 interface ge-0/0/3.0 point-to-point
    user@R1#set ospf area 0.0.0.0 interface lo0.0 passive
    user@R1#set ospf source-packet-routing srgb start-label 80000
    user@R1#set ospf source-packet-routing srgb index-range 50000
    user@R1#set ospf source-packet-routing node-segment ipv4-index 5001
  5. 配置 TI-LFA 以启用针对链路和节点故障的保护。使用 TI-LFA 的 SR 可在主路径发生故障或不可用时,将流量立即路由到备用路径或备用路径,从而更快地恢复网络连接。

    content_copy zoom_out_map
    [edit protocols]
    user@R1#set ospf backup-spf-options use-post-convergence-lfa
    user@R1#set ospf backup-spf-options use-source-packet-routing
    
  6. 配置 OSPF 流量工程参数。

    content_copy zoom_out_map
    [edit protocols]
    user@R1#set ospf traffic-engineering l3-unicast-topology
    user@R1#set ospf traffic-engineering credibility-protocol-preference
    user@R1#set protocols ospf traffic-engineering advertisement always
  7. 通过 SR-TE 启用 LDP 隧道。

    content_copy zoom_out_map
    [edit protocols]
    user@R1#set ospf traffic-engineering tunnel-source-protocol spring-te
    
  8. 在 LDP 域中的接口上配置 MPLS 和 LDP 协议,以在 LDP 域中交换标签。

    content_copy zoom_out_map
    [edit protocols]
    user@R1#set ldp preference 1
    user@R1#set protocols ldp interface ge-0/0/1.0
    user@R1#set ldp interface ge-0/0/3.0
    user@R1#set ldp interface lo0.0
    user@R1#set mpls interface ge-0/0/1.0
    user@R1#set mpls interface ge-0/0/2.0
    user@R1#set mpls interface ge-0/0/3.0
    user@R1#set mpls interface lo0.0
    
  9. 在 LDP 域中的边缘路由器之间启用有针对性的 LDP 会话。

    content_copy zoom_out_map
    [edit protocols]
    user@R1#set ldp auto-targeted-session
    
  10. 配置分段列表以将流量路由到特定路径。

    content_copy zoom_out_map
    [edit protocols]
    user@R1#set source-packet-routing segment-list seg1 inherit-label-nexthops
    user@R1#set source-packet-routing segment-list seg1 auto-translate
    user@R1#set source-packet-routing segment-list seg1 hop1 ip-address 192.168.4.2
    user@R1#set source-packet-routing segment-list seg1 hop2 ip-address 192.168.5.2
    user@R1#set source-packet-routing segment-list seg1 hop3 ip-address 192.168.6.2
    
  11. 将 SR-TE LSP 配置为远程边缘路由器,以启用通过 SR-TE 的 LDP 隧道。

    content_copy zoom_out_map
    [edit protocols]
    user@R1#set source-packet-routing source-routing-path sr_static_r5 ldp-tunneling
    user@R1#set source-packet-routing source-routing-path sr_static_r5 to 192.168.66.66
    user@R1#set source-packet-routing source-routing-path sr_static_r5 binding-sid 1003001
    user@R1#set source-packet-routing source-routing-path sr_static_r5 primary seg1
    

结果

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

content_copy zoom_out_map
user@R1#show chassis
network-services enhanced-ip;
content_copy zoom_out_map
user@R1#show interfaces
ge-0/0/1 {
    description R1-to-R2;
    unit 0 {
        family inet {
            address 10.1.3.1/24;
        }
        family mpls {
            maximum-labels 8;
        }
    }
}
ge-0/0/2 {
    description R1-to-R3;
    unit 0 {
        family inet {
            address 10.1.4.1/24;
        }
        family mpls {
            maximum-labels 8;
        }
    }
}
ge-0/0/3 {
    description R1-to-PE1;
    unit 0 {
        family inet {
            address 10.1.2.2/24;
        }
        family mpls {
            maximum-labels 8;
        }
    }
}
lo0 {
    unit 0 {
        family inet {
            address 192.168.100.1/32;
        }
        family mpls;
    }
}
content_copy zoom_out_map
user@R1#show protocols
ldp {
    auto-targeted-session;
    preference 1;
    interface ge-0/0/1.0;
    interface ge-0/0/3.0;
    interface lo0.0;
}
mpls {
    interface ge-0/0/1.0;
    interface ge-0/0/2.0;
    interface ge-0/0/3.0;
    interface lo0.0;
}
ospf {
    backup-spf-options {
        use-post-convergence-lfa;
        use-source-packet-routing;
    }
    traffic-engineering {
        l3-unicast-topology;
        credibility-protocol-preference;
        advertisement always;
        tunnel-source-protocol {
            spring-te;
        }
    }
    source-packet-routing {
        node-segment ipv4-index 5001;
        srgb start-label 80000 index-range 50000;
    }
    area 0.0.0.0 {
        interface ge-0/0/1.0 {
            point-to-point;
            post-convergence-lfa;
            ipv4-adjacency-segment {
                protected index 108;
                unprotected index 110;
            }
        }
        interface ge-0/0/2.0 {
            point-to-point;
            post-convergence-lfa;
            ipv4-adjacency-segment {
                protected index 104;
                unprotected index 106;
            }
        }
        interface ge-0/0/3.0 {
            point-to-point;
            post-convergence-lfa;
            ipv4-adjacency-segment {
                protected index 100;
                unprotected index 102;
            }
        }
        interface lo0.0 {
            passive;
        }
    }
}
source-packet-routing {
    segment-list seg1 {
        inherit-label-nexthops;         
        auto-translate;                 
        hop1 ip-address 10.1.4.2;       
        hop2 ip-address 10.1.5.2;       
        hop3 ip-address 10.1.6.2;       
    }                                   
    source-routing-path sr_static_r5 {  
        ldp-tunneling;                  
        to 192.168.100.2;               
        binding-sid 1003001;            
        primary {                       
            seg1;                       
        }                               
    }                                   
}                                       
content_copy zoom_out_map
user@R1#show routing-options
router-id 192.168.100.1;

验证

要确认配置工作正常,请执行以下任务:

验证通过 SR-TE 的 LDP 隧道

目的

验证是否已启用基于 SR-TE 的 LDP 隧道,以及到远程边缘路由器的 LDP 隧道是否采用正确的路径。

操作

在操作模式下,运行 show spring-traffic-engineering lsp detail 命令。

在 R1 上

content_copy zoom_out_map
user@R1>show spring-traffic-engineering lsp detail
Name: sr_static_r5
  Tunnel-source: Static configuration
  Tunnel Forward Type: SRMPLS
  To: 192.168.100.2
  Te-group-id: 0
  State: Up
  LDP-tunneling enabled
    Path: seg1
    Path Status: NA
    Outgoing interface: NA
    Auto-translate status: Enabled Auto-translate result: Success
    Compute Status:Disabled , Compute Result:N/A , Compute-Profile Name:N/A
    BFD status: N/A BFD name: N/A
    BFD remote-discriminator: N/A
    Segment ID : 128 
    ERO Valid: true
      SR-ERO hop count: 3
        Hop 1 (Strict): 
          NAI: IPv4 Adjacency ID, 0.0.0.0 -> 10.1.4.2
          SID type: 20-bit label, Value: 80104
        Hop 2 (Strict): 
          NAI: IPv4 Adjacency ID, 0.0.0.0 -> 10.1.5.2
          SID type: 20-bit label, Value: 80204
        Hop 3 (Strict): 
          NAI: IPv4 Adjacency ID, 0.0.0.0 -> 10.1.6.2
          SID type: 20-bit label, Value: 80304

Total displayed LSPs: 1 (Up: 1, Down: 0)

在 R2 上

content_copy zoom_out_map
user@R2>show spring-traffic-engineering lsp detail
Name: sr_static_r1
  Tunnel-source: Static configuration
  Tunnel Forward Type: SRMPLS
  To: 192.168.100.1
  Te-group-id: 0
  State: Up
  LDP-tunneling enabled
    Path: seg1
    Path Status: NA
    Outgoing interface: NA
    Auto-translate status: Enabled Auto-translate result: Success
    Compute Status:Disabled , Compute Result:N/A , Compute-Profile Name:N/A
    BFD status: N/A BFD name: N/A
    BFD remote-discriminator: N/A
    Segment ID : 128 
    ERO Valid: true
      SR-ERO hop count: 3
        Hop 1 (Strict): 
          NAI: IPv4 Adjacency ID, 0.0.0.0 -> 10.1.6.1
          SID type: 20-bit label, Value: 80504
        Hop 2 (Strict): 
          NAI: IPv4 Adjacency ID, 0.0.0.0 -> 10.1.5.1
          SID type: 20-bit label, Value: 80300
        Hop 3 (Strict): 
          NAI: IPv4 Adjacency ID, 0.0.0.0 -> 10.1.4.1
          SID type: 20-bit label, Value: 80200


Total displayed LSPs: 1 (Up: 1, Down: 0)

意义

  • 在 R1 上,使用 SR-TE 核心网络中的远程边缘路由器 192.168.100.2 建立 LDP 隧道。还可以在输出中看到 SID 标签值 80104, 80204, 80304

  • 在 R2 上,使用 SR-TE 核心网络中的远程边缘路由器 192.168.100.1 建立 LDP 隧道。还可以在输出中看到 SID 标签值 80504, 80300, 80200

验证播发的标签

目的

验证为转发等效类 (FEC) 播发的标签。

操作

在操作模式下,运行 show ldp database 命令。

在 R1 上

验证向直连 PE (PE1) 播发的标签以及从远程边缘路由器 (R2) 收到的标签。

content_copy zoom_out_map
user@R1>show ldp database

Input label database, 192.168.100.1:0--192.168.100.2:0
Labels received: 4
  Label     Prefix
     18      192.168.100.1/32
      3      192.168.100.2/32
     20      192.168.100.5/32
     16      192.168.100.6/32


Output label database, 192.168.100.1:0--192.168.100.2:0
Labels advertised: 4
  Label     Prefix
      3      192.168.100.1/32
     4115    192.168.100.2/32
     4114    192.168.100.5/32
     4117      192.168.100.6/32

Input label database, 192.168.100.1:0--192.168.100.5:0
Labels received: 4
  Label     Prefix
     17      192.168.100.1/32
     22      192.168.100.2/32
      3      192.168.100.5/32
     24      192.168.100.6/32

Output label database, 192.168.100.1:0--192.168.100.5:0
Labels advertised: 4
  Label     Prefix
      3      192.168.100.1/32
     4115    192.168.100.2/32
     4114    192.168.100.5/32
     4117      192.168.100.6/32

在 R2 上

验证向直连 PE (PE2) 播发的标签以及从远程边缘路由器 (R1) 接收的标签。

content_copy zoom_out_map
user@R2>show ldp database

Input label database, 192.168.100.2:0--192.168.100.1:0
Labels received: 4
  Label     Prefix
      3      192.168.100.1/32
     4115    192.168.100.2/32
     4114    192.168.100.5/32
     4117    192.168.100.6/32

Output label database, 192.168.100.2:0--192.168.100.1:0
Labels advertised: 4
  Label     Prefix
     18      192.168.100.1/32
      3      192.168.100.2/32
     20      192.168.100.5/32
     16      192.168.100.6/32

Input label database, 192.168.100.2:0--192.168.100.6:0
Labels received: 4
  Label     Prefix
     24      192.168.100.1/32
     17      192.168.100.2/32
     25      192.168.100.5/32
      3      192.168.100.6/32

Output label database, 192.168.100.2:0--192.168.100.6:0
Labels advertised: 4
  Label     Prefix
     18      192.168.100.1/32
      3      192.168.100.2/32
     20      192.168.100.5/32
     16      192.168.100.6/32

在 PE1 上

验证边缘设备 R1 是否已将远程 PE (PE2) 设备的环路地址标签播发到本地 PE (PE1) 设备。

content_copy zoom_out_map
user@PE1>show ldp database

Input label database, 192.168.100.5:0--192.168.100.1:0
Labels received: 4
  Label     Prefix
      3      192.168.100.1/32
     4115    192.168.100.2/32
     4114    192.168.100.5/32
     4117      192.168.100.6/32

Output label database, 192.168.100.5:0--192.168.100.1:0
Labels advertised: 4
  Label     Prefix
     17      192.168.100.1/32
     22      192.168.100.2/32
      3      192.168.100.5/32
     24      192.168.100.6/32

关于 PE2

验证边缘设备 R2 是否已将远程 PE (PE1) 设备的环路地址标签播发到本地 PE (PE2) 设备。

content_copy zoom_out_map
user@PE2>show ldp database

Input label database, 192.168.100.6:0--192.168.100.2:0
Labels received: 4
  Label     Prefix
     18      192.168.100.1/32
      3      192.168.100.2/32
     20      192.168.100.5/32
     16      192.168.100.6/32

Output label database, 192.168.100.6:0--192.168.100.2:0
Labels advertised: 4
  Label     Prefix
     24      192.168.100.1/32
     17      192.168.100.2/32
     25      192.168.100.5/32
      3      192.168.100.6/32

意义

  • 在 R1 上,您可以看到标签 4117 已播发到直接连接的 PE (PE1),并且标签 27 是从远程边缘路由器 (R2) 接收的。

  • 在 R2 上,您可以看到标签 18 已播发到直接连接的 PE (PE2),并且标签 25 是从远程边缘路由器 (R1) 接收的。

  • 在 PE1 上,可以看到从本地边缘路由器 (R1) 接收了标签 4117

  • 在 PE2 上,可以看到从本地边缘路由器 (R2) 接收了标签 18

验证 LDP 转发到远程 PE 设备

目的

验证到远程 PE 路由器的路由是否使用 LDP 转发,并且是否通过 SR-TE 建立隧道。

操作

在操作模式下,运行 show route destination-prefix 命令。

在 R1 上

验证到远程 PE (PE2) 路由器的路由是否通过 LDP over SR-TE 隧道。

content_copy zoom_out_map
user@R1>show route 192.168.100.6
inet.0: 29 destinations, 29 routes (29 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

192.168.100.6/32   *[OSPF/10/10] 1d 03:28:10, metric 2
                    >  to 10.1.3.2 via ge-0/0/1.0

inet.3: 10 destinations, 15 routes (5 active, 0 holddown, 8 hidden)
+ = Active Route, - = Last Active, * = Both

192.168.100.6/32   *[LDP/1] 21:42:29, metric 1
                    >  to 10.1.4.2 via ge-0/0/2.0, Push 16, Push 80304, Push 80204(top)
                       to 10.1.3.2 via ge-0/0/1.0, Push 16, Push 80304, Push 80204, Push 85003, Push 85004(top)

在 R2 上

验证到远程 PE (PE1) 路由器的路由是否通过 LDP over SR-TE 隧道。

content_copy zoom_out_map
user@R2>show route 192.168.100.5
inet.0: 29 destinations, 29 routes (29 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

192.168.100.5/32   *[OSPF/10/10] 22:22:45, metric 2
                    >  to 10.1.3.1 via ge-0/0/1.0

inet.3: 10 destinations, 15 routes (5 active, 0 holddown, 8 hidden)
+ = Active Route, - = Last Active, * = Both

192.168.100.5/32   *[LDP/1] 22:22:45, metric 1
                    >  to 10.1.6.1 via ge-0/0/2.0, Push 4114, Push 80200, Push 80300(top)
                       to 10.1.3.1 via ge-0/0/1.0, Push 4114, Push 80200, Push 80300, Push 85004, Push 85003(top)

在 PE1 上

验证到远程 PE (PE2) 路由器的路由是否通过到远程 PE 的目标 LDP 会话。

content_copy zoom_out_map
user@PE1>show route 192.168.100.6

inet.0: 27 destinations, 27 routes (27 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

192.168.100.6/32   *[OSPF/10] 01:15:29, metric 3
                    >  to 10.1.2.2 via ge-0/0/3.0

inet.3: 3 destinations, 3 routes (3 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

192.168.100.6/32   *[LDP/9] 01:15:29, metric 1
                    >  to 10.1.2.2 via ge-0/0/3.0, Push 4117

关于 PE2

验证到远程 PE (PE1) 路由器的路由是否通过到远程 PE 的目标 LDP 会话。

content_copy zoom_out_map
user@PE2>show route 192.168.100.5

inet.0: 27 destinations, 27 routes (27 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

192.168.100.5/32   *[OSPF/10] 01:27:40, metric 3
                    >  to 10.1.7.1 via ge-0/0/3.0

inet.3: 3 destinations, 3 routes (3 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

192.168.100.5/32   *[LDP/9] 01:27:40, metric 1
                    >  to 10.1.7.1 via ge-0/0/3.0, Push 20

意义

  • 在 R1 上,您可以看到 LDP 标签 16 为 ,SR-TE 标签堆栈为 80304, 80204, 85003, 85004

  • 在 R2 上,您可以看到 LDP 标签 22 为 ,SR-TE 标签堆栈为 80200, 80300, 85004, 85003

  • 在 PE1 和 PE2 上,您可以分别看到 LDP 标签 4117 为 和 20

验证端到端可访问性

目的

验证 CE1 是否可以使用 ping 192.168.100.22 源 192.168.100.11 计数 2 操作模式命令对 CE2 执行 ping 操作。

操作

content_copy zoom_out_map
user@CE1> ping 192.168.100.22 source 192.168.100.11 count 2 
PING 192.168.100.22 (192.168.100.22): 56 data bytes
64 bytes from 192.168.100.22: icmp_seq=0 ttl=58 time=8.772 ms
64 bytes from 192.168.100.22: icmp_seq=1 ttl=58 time=9.189 ms

--- 192.168.100.22 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 8.772/8.980/9.189/0.209 ms

意义

CE1 的输出显示 CE1 可以对 CE2 执行 ping 操作。

footer-navigation