Juniper Junos SR-TE 与动态隧道映射(DTM)流量调度实战及排错指南

在上一篇文章《基于 SR-TE 与 BGP Auto-Steering 实现内网流量路径调度》中,我们演示了 Cisco IOS-XR 平台下的 SR-TE 调度方案。这次我们将战场切换到 Juniper Junos(vMX) 平台,完整部署基于 SPRING(Source Packet Routing in Networking) 的 SR-TE 与 DTM(Dynamic Tunnel Mapping) 流量调度。

整个实验前后整整调试了 4 天,中途踩到了多个 Junos 平台特有的隐蔽大坑(RSVP 注入亲和属性、接口默认 maximum-labels 3 限制、include-any 行为差异以及 LSP 失效后的 inetcolor.0 回退)。下文将从零到一完整记录配置流程、排错过程与避坑方法。

实验拓扑与 Junos SPRING 基础配置

Juniper Junos vMX SR-TE 与 DTM 实验拓扑图(SPRING L-ISIS 区域、RE/FPC 节点 R1–R8、TE Metric 与 BLUE/ORANGE 亲和属性)
图 1:Juniper vMX SPRING L-ISIS 实验拓扑——标明了全部接口名称、TE/IGP Metric、双色亲和属性与三条 TE Cpath 目标

所有链路的 IGP Metric、TE Metric 以及链路亲和属性(blue / orange)已标在图 1 中。我们先在全网 vMX 设备上完成基础底层的 chassis enhanced-ip、protocols isis 与 protocols mpls 配置:

// 所有路由器的公共配置

root@R1# show chassis
network-services enhanced-ip; // 将路由器模式设置为 enhanced-ip 模式,否则不能配置 segment routing,真机也是一样

root@R1# show protocols isis
interface ge-0/0/1.0 {
    level 2 {
        te-metric 5; // 按照图中所示配置 TE Metric 值
        ipv4-adjacency-segment {
            unprotected label 15001; // 手动从 SRLB 分配一个静态标签作为 Adj-SID
        }
        metric 20; // 按照图中所示配置 IGP Metric 值
    }
    point-to-point; // 优化,不要让它出现 IS-IS DIS,只要是两个路由器互联中间没其他设备,建议配上
}
interface ge-0/0/4.0 {
    level 2 {
        te-metric 2;
        ipv4-adjacency-segment {
            unprotected label 15004;
        }
    }
    point-to-point;
}
interface lo0.0;
source-packet-routing {
    srgb start-label 16000 index-range 8000; // 配置 SRGB,等同于 Cisco 中的 segment-routing global-block 16000 23999
    node-segment ipv4-index 1; // 宣告索引号,之前文章已经讲过了
}
level 1 disable; // 默认关闭 Level 1,一般都不用
level 2 wide-metrics-only; // 开启 Level 2,而且 Metric 模式为 Wide,否则 SR 信息无法传递
traffic-engineering l3-unicast-topology; // 将链路状态信息下载到 TEDB (流量工程数据库),只需要在头端路由器配置

root@R1# show protocols mpls
traffic-engineering; // 启动 MPLS family TE 能力
admin-groups {
    blue 0; // 定义 bit-position,让 IS-IS 在 sub-TLVs 里面传递链路的亲和属性,用于 SRTE
    orange 1;
}
icmp-tunneling; // 开启 icmp 隧道功能,防止 L3VPN 数据传递中间跳不知道怎么回来然后看不见跳数,所有路由器都要配置
label-range {
    static-label-range 15000 15999; // 配置 SRLB 范围,本地意义
}
interface ge-0/0/1.0 {
    admin-group [ blue orange ]; // 给链路染色,并激活接口的 MPLS 功能
}
interface ge-0/0/4.0; // 仅激活接口的 MPLS 功能



配置完毕后,在 R1 上查看 IS-IS L2 数据库与 inet.3 路由表,确认全网 Loopback 节点标签已正常分发:

root@R1> show isis database
IS-IS level 1 link-state database:
  0 LSPs

IS-IS level 2 link-state database:
LSP ID                      Sequence Checksum Lifetime Attributes
R1.00-00                        0x46   0xd946     1165 L1 L2
R2.00-00                        0x48    0xef4      917 L1 L2
R3.00-00                        0x49   0x5176      527 L1 L2
R4.00-00                        0x48   0x5c9a      942 L1 L2
R5.00-00                        0x47   0xaee8      589 L1 L2
R6.00-00                        0x49   0xb94e      492 L1 L2
R7.00-00                        0x49   0x5afd      928 L1 L2
R8.00-00                        0x49   0xd9c5      938 L1 L2
  8 LSPs


root@R1> show route table inet.3

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

10.0.0.2/32        *[L-ISIS/14] 04:33:26, metric 20
                    >  to 10.10.12.2 via ge-0/0/1.0
10.0.0.3/32        *[L-ISIS/14] 04:33:26, metric 40
                       to 10.10.12.2 via ge-0/0/1.0, Push 16003
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 16003
10.0.0.4/32        *[L-ISIS/14] 04:33:26, metric 60
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 16004
10.0.0.5/32        *[L-ISIS/14] 04:33:26, metric 10
                    >  to 10.10.15.5 via ge-0/0/4.0
10.0.0.6/32        *[L-ISIS/14] 04:33:26, metric 20
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 16006
10.0.0.7/32        *[L-ISIS/14] 04:33:26, metric 30
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 16007
10.0.0.8/32        *[L-ISIS/14] 04:33:26, metric 40
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 16008

可以看到 inet.3 已经学习到所有路由器的 Loopback Prefix-SID 标签。其中 10.0.0.3/32 因 IGP Metric 等价而出现双路径负载均衡;10.0.0.2/32 与 10.0.0.5/32 为直连邻居,遵循 PHP 直接弹出标签(实际对端通告标签分别为 16002 与 16005)。

步骤一:配置 Juniper SR-TE Policy 与三大踩坑排错实录

接下来在头端 R1 上创建基于动态约束计算的 SR-TE Policy blue(color 10、binding-sid 15555,约束条件为 admin-group include-any blue 与 metric-type te):

root@R1# show
compute-profile dynamic_blue { // 创建 compute profile,用于指定约束条件
    admin-group include-any blue; // 约束条件1:必须包含链路亲和属性为 blue 的链路,任意包含即可
    metric-type {
        te; // 约束条件2:使用 TE Metric 来做路径的计算
    }
}

source-routing-path blue { // 创建 SRTE Cpath,用于生成 SRTE LSP
    to 10.0.0.8; // 目的地址:10.0.0.8
    color 10; // 指定颜色 (SRTE Header) 10
    binding-sid 15555; // 手工从 SRLB 分配 BSID
    primary { // 指定首选路径(可多个,本实验只写一个)
        blue { // 名字为 blue
            compute { // 调用计算模块
                dynamic_blue; // 使用 compute-profile 为 blue 预定义约束条件来做计算
            }
        }
    }
}

提交配置后查看 show spring-traffic-engineering lsp detail,结果却出乎意料——LSP 状态竟然为 Down:

root@R1> show spring-traffic-engineering lsp detail
Name: blue
  Tunnel-source: Static configuration
  To: 10.0.0.8-10<c>
  State: Down
    Path: blue
    Outgoing interface: NA
    Auto-translate status: Disabled Auto-translate result: N/A
    Compute Status:Enabled , Compute Result:failure , Compute-Profile Name:dynamic_blue
    Total number of computed paths: 0

坑 1:Junos 必须开启 RSVP 才会将 Admin-Group 亲和属性注入 IS-IS TLV

在 R1 上查看 show isis database R1.00-00 extensive 验证猜测,果然发现邻接 sub-TLV 中虽然包含了 TE Metric 与 Adj-SID,却完全没有携带 Administrative groups:

root@R1> show isis database R1.00-00 extensive
{..snip..}
  TLVs:
   {..snip..}
    IS extended neighbor: R2.00, Metric: default 20 SubTLV len: 34
      IP address: 10.10.12.1
      Neighbor's IP address: 10.10.12.2
      Local interface index: 336, Remote interface index: 334
      Traffic engineering metric: 5
      P2P IPV4 Adj-SID - Flags:0x34(F:0,B:0,V:1,L:1,S:0,P:1), Weight:0, Label: 15001
      P2P IPv4 Adj-SID:   15001, Weight:   0, Flags: --VL-P
   {..snip..}
    IP extended prefix: 10.0.0.1/32 metric 0 up
      8 bytes of subtlvs
      Node SID, Flags: 0x40(R:0,N:1,P:0,E:0,V:0,L:0), Algo: SPF(0), Value: 1
    IP extended prefix: 10.10.12.0/24 metric 20 up
    IP extended prefix: 10.10.15.0/24 metric 10 up
    Router Capability:  Router ID 10.0.0.1, Flags: 0x00
{..snip..}

虽然已经在 protocols mpls 下定义了 admin-groups 并挂载到接口,但 Junos 默认并不会把 MPLS admin-group 注入 IS-IS 进程!解决方法是在所有路由器接口上开启 protocols rsvp:

root@R1# show protocols rsvp
interface all; // 生产环境看情况进行配置,无法设置 Passive interface,我已经试过了

再次查看 IS-IS 数据库,可以看到 Administrative groups: 0x3 orange blue 已经顺利出现在 IS-IS sub-TLV 中:

root@R1> show isis database R1.00-00 extensive
{..snip..}
    IS extended neighbor: R2.00, Metric: default 20 SubTLV len: 86
      IP address: 10.10.12.1
      Neighbor's IP address: 10.10.12.2
      Local interface index: 336, Remote interface index: 334
     {..snip..}
      Administrative groups:  0x3 orange blue
      P2P IPV4 Adj-SID - Flags:0x34(F:0,B:0,V:1,L:1,S:0,P:1), Weight:0, Label: 15001
      P2P IPv4 Adj-SID:   15001, Weight:   0, Flags: --VL-P
    {..snip..}
    IP extended prefix: 10.0.0.1/32 metric 0 up
      8 bytes of subtlvs
      Node SID, Flags: 0x40(R:0,N:1,P:0,E:0,V:0,L:0), Algo: SPF(0), Value: 1
    IP extended prefix: 10.10.12.0/24 metric 20 up
    IP extended prefix: 10.10.15.0/24 metric 10 up
    Router Capability:  Router ID 10.0.0.1, Flags: 0x00
{..snip..}

再次检查 show spring-traffic-engineering lsp detail,blue LSP 立刻变为 Up,算出的路径为 R1 → R2 → R3 → R4 → R8(16002, 16003, 15003, 16008),与我们在 Cisco 平台文章中解析的一致:

root@R1> show spring-traffic-engineering lsp detail
Name: blue
  Tunnel-source: Static configuration
  To: 10.0.0.8-10<c>
  State: Up
    Path: blue
    Outgoing interface: NA
    Auto-translate status: Disabled Auto-translate result: N/A
    Compute Status:Enabled , Compute Result:success , Compute-Profile Name:dynamic_blue
    Total number of computed paths: 1
    Computed-path-index: 1
      BFD status: N/A BFD name: N/A
      TE metric: 23, IGP metric: 110; Metric optimized by type: TE
      computed segments count: 4
        computed segment : 1 (computed-node-segment):
          node segment label: 16002
          router-id: 10.0.0.2
        computed segment : 2 (computed-node-segment):
          node segment label: 16003
          router-id: 10.0.0.3
        computed segment : 3 (computed-adjacency-segment):
          label: 15003
          source router-id: 10.0.0.3, destination router-id: 10.0.0.4
          source interface-address: 10.10.34.3, destination interface-address: 10.10.34.4
        computed segment : 4 (computed-node-segment):
          node segment label: 16008
          router-id: 10.0.0.8

随后我们按同样方法创建 orange(color 20,include-any orange)与纯 TE 度量优化的 te(color 30,无亲和属性约束)两条 LSP。注意坑 2:Junos 中 admin-group include-any orange 要求沿途每一跳都至少包含指定亲和属性(因此图 1 中 R1–R2 与 R2–R3 同时标记了 BLUE, ORANGE),这与 Cisco 的逻辑有所不同。三条 LSP 算路结果如下:

root@R1> show spring-traffic-engineering lsp detail
Name: blue
  Tunnel-source: Static configuration
  To: 10.0.0.8-10<c>
  State: Up
    Path: blue 
{..snip..}
      computed segments count: 4
        computed segment : 1 (computed-node-segment):
          node segment label: 16002
          router-id: 10.0.0.2
        computed segment : 2 (computed-node-segment):
          node segment label: 16003
          router-id: 10.0.0.3
        computed segment : 3 (computed-adjacency-segment):
          label: 15003
          source router-id: 10.0.0.3, destination router-id: 10.0.0.4
          source interface-address: 10.10.34.3, destination interface-address: 10.10.34.4
        computed segment : 4 (computed-node-segment):
          node segment label: 16008
          router-id: 10.0.0.8

Name: orange
  Tunnel-source: Static configuration
  To: 10.0.0.8-20<c>
  State: Up
    Path: orange
{..snip..}
      computed segments count: 3
        computed segment : 1 (computed-node-segment):
          node segment label: 16002
          router-id: 10.0.0.2
        computed segment : 2 (computed-node-segment):
          node segment label: 16003
          router-id: 10.0.0.3
        computed segment : 3 (computed-adjacency-segment):
          label: 15000
          source router-id: 10.0.0.3, destination router-id: 10.0.0.8
          source interface-address: 10.10.38.3, destination interface-address: 10.10.38.8

Name: te
  Tunnel-source: Static configuration
  To: 10.0.0.8-30<c>
  State: Up
    Path: te
{..snip..}
      computed segments count: 3
        computed segment : 1 (computed-node-segment):
          node segment label: 16007
          router-id: 10.0.0.7
        computed segment : 2 (computed-node-segment):
          node segment label: 16003
          router-id: 10.0.0.3
        computed segment : 3 (computed-adjacency-segment):
          label: 15000
          source router-id: 10.0.0.3, destination router-id: 10.0.0.8
          source interface-address: 10.10.38.3, destination interface-address: 10.10.38.8
  • blue:R1 → R2 → R3 → R4 → R8(TE Metric = 23)
  • orange:R1 → R2 → R3 → R8(TE Metric = 20)
  • te:R1 → R5 → R6 → R7 → R3 → R8(TE Metric = 2+2+2+2+10 = 18)

坑 3:接口默认 maximum-labels 3 导致大于 3 层标签的 LSP 不可用

接下来查看 Junos 专门存放染色 SR-TE 下一跳的 inetcolor.0 路由表,却发现三条 LSP 里竟然只进去了 orange 一条,blue 和 te 都不见了!

root@R1> show route table inetcolor.0

inetcolor.0: 10 destinations, 10 routes (9 active, 0 holddown, 1 hidden)
+ = Active Route, - = Last Active, * = Both

10.0.0.8-20<c>/64
                   *[SPRING-TE/8] 00:00:08, metric 1, metric2 40
                    >  to 10.10.12.2 via ge-0/0/1.0, Push 15000, Push 16003(top)

root@R1> show spring-traffic-engineering lsp
To              State     LSPname
10.0.0.8-10<c>  Up        blue
10.0.0.8-20<c>  Up        orange
10.0.0.8-30<c>  Up        te

root@R1> show spring-traffic-engineering route detail label 15555 // 查看对应 LSP 的 binding-SID
To : 15555
 Tunnel-source : Static configuration
 Route Nexthop Type: Unusable
 Route Metric2 : 0
  LSP Name: blue
{..snip..}

经过反复测试发现:只要算出的标签数 ≤ 3 就正常,一旦超过 3 层(例如 blue 与 te 加上 PHP 后或含 3+ 层传输标签)下一跳就会变成 Unusable!检查 ge-0/0/1.0 接口状态果然发现了限制:默认 Maximum labels: 3:

root@R1> show interfaces ge-0/0/1.0
  Logical interface ge-0/0/1.0 (Index 336) (SNMP ifIndex 547)
    {..snip..}
    Protocol mpls, MTU: 1974, Maximum labels: 3
    {..snip..}

通过 apply-groups 全局放开所有 ge-* 接口下的 family mpls maximum-labels 16:

root@R1# show groups
if-group {
    interfaces {
        <ge-*> {
            unit <*> {
                family mpls {
                    maximum-labels 16;
                }
            }
        }
    }
}
apply-groups if-group;

提交后验证接口最大标签栈深已变为 16,三条 SR-TE LSP(10.0.0.8-10<c>/64、-20<c>/64、-30<c>/64)立即全部激活写入 inetcolor.0:

root@R1> show interfaces ge-0/0/1.0
  Logical interface ge-0/0/1.0 (Index 336) (SNMP ifIndex 547)
    {..snip..}
    Protocol mpls, MTU: 1974, Maximum labels: 16
    {..snip..}

root@R1> show route table inetcolor.0

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

10.0.0.8-10<c>/64
                   *[SPRING-TE/8] 00:00:52, metric 1, metric2 40
                    >  to 10.10.12.2 via ge-0/0/1.0, Push 16008, Push 15003, Push 16003(top) // 实际发的时候是堆了 4 层标签,第一个是 16002,标签被 pop 掉后发给 R2
10.0.0.8-20<c>/64
                   *[SPRING-TE/8] 00:00:52, metric 1, metric2 40
                    >  to 10.10.12.2 via ge-0/0/1.0, Push 15000, Push 16003(top) // 同理
10.0.0.8-30<c>/64
                   *[SPRING-TE/8] 00:00:52, metric 1, metric2 40
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 15000, Push 16003, Push 16007(top) // 这个是 IGP 直接到 16007 然后再进行下一步转发,出去时候并没有 pop 任何标签

步骤二:L3VPN 流量引流与 inetcolor.0 故障回退(Fallback)

与 Cisco 一样,我们使用 BGP Color Extended Community 对 L3VPN 路由染色。在 Junos 上需要配置 resolution-map(mode ip-color),将符合 Next-Hop + Color 条件的 VRF 路由从默认查询 inet.3 改为查询 inetcolor.0(关于 Junos 路由表角色可参考《inet.3 路由表到底是做什么的?》):

root@R1# show policy-options
{..snip..}
policy-statement l3vpn-import {
    term accept-all {
        from community l3vpn;
        then {
            accept;
            resolution-map odn; // 调度 resolution-map,让该 VRF 内的符合条件的路由改用 inetcolor.0 路由表来解析下一跳 
                                // 这里指的是下一跳 + 路由携带的 color community 匹配上了 LSP 的 [ destination + color ] 值
        }
    }
}
resolution-map odn {
    mode ip-color; // 定义 resolution-map,模式为匹配下一跳 + color 值(标准做法)
}

查看 l3vpn.inet.0 路由表,可见三个客户网段均已解析到各自对应的 inetcolor.0 标签栈(包含底层 L3VPN 业务标签 16):

root@R1> show route table l3vpn.inet.0

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

100.64.0.0/24      *[Direct/0] 15:14:41
                    >  via ge-0/0/8.0
100.64.0.1/32      *[Local/0] 15:14:41
                       Local via ge-0/0/8.0
100.64.1.0/24      *[BGP/170] 00:41:52, localpref 100, from 10.0.0.8
                      AS path: I, validation-state: unverified
                    >  to 10.10.12.2 via ge-0/0/1.0, Push 16, Push 16008, Push 15003, Push 16003(top)
100.64.2.0/24      *[BGP/170] 15:13:32, localpref 100, from 10.0.0.8
                      AS path: I, validation-state: unverified
                    >  to 10.10.12.2 via ge-0/0/1.0, Push 16, Push 15000, Push 16003(top)
100.64.3.0/24      *[BGP/170] 00:26:40, localpref 100, from 10.0.0.8
                      AS path: I, validation-state: unverified
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 16, Push 15000, Push 16003, Push 16007(top)

坑 4:LSP 失效后 VRF 路由变成 Hidden,必须配置 inet.3 → inetcolor.0 Fallback

千万别以为到这里就结束了——当我们模拟 deactivate protocols source-packet-routing 关闭 SR-TE LSP 后,l3vpn.inet.0 中三条路由全部变成 Hidden / Unusable!原因在于路由仍指向 inetcolor.0 解析下一跳,而表内已无备用路径:

root@R1# deactivate protocols source-packet-routing

root@R1> show route table inetcolor.0

root@R1>

root@R1> show route table l3vpn.inet.0 hidden

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

100.64.1.0/24       [BGP/170] 00:00:15, localpref 100, from 10.0.0.8
                      AS path: I, validation-state: unverified
                       Unusable
100.64.2.0/24       [BGP/170] 00:00:15, localpref 100, from 10.0.0.8
                      AS path: I, validation-state: unverified
                       Unusable
100.64.3.0/24       [BGP/170] 00:00:15, localpref 100, from 10.0.0.8
                      AS path: I, validation-state: unverified
                       Unusable

因此必须在 protocols isis 下配置 rib-group,将 inet.3 中的 L-ISIS 基础传输路由拷贝一份进入 inetcolor.0(呈现为 10.0.0.x-0<c>/32):

root@R1# show | compare
[edit protocols isis]
+    rib-group inet3 inetcolor-fallback; // 调用该 rib-group,将路由 copy 到 inetcolor.0
[edit routing-options rib-groups]
+   inetcolor-fallback {
+       import-rib [ inet.3 inetcolor.0 ]; // 配置 rib-group,将 inet.3 的路由(这是 BGP 解析下一跳默认的表)copy 到 inetcolor.0
+   }

检查 inetcolor.0 可见 /64 的 SPRING-TE 表项与 /32 的 L-ISIS 回退表项共存;LSP 正常时优先匹配掩码更长的 /64 隧道,LSP 失效后自动无缝回退到 /32 最短路径(Push 16, Push 16008(top)):

root@R1> show route table inetcolor.0

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

10.0.0.2-0<c>/32
                   *[L-ISIS/14] 00:00:06, metric 20
                    >  to 10.10.12.2 via ge-0/0/1.0
10.0.0.3-0<c>/32
                   *[L-ISIS/14] 00:00:06, metric 40
                       to 10.10.12.2 via ge-0/0/1.0, Push 16003
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 16003
10.0.0.4-0<c>/32
                   *[L-ISIS/14] 00:00:06, metric 60
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 16004
10.0.0.5-0<c>/32
                   *[L-ISIS/14] 00:00:06, metric 10
                    >  to 10.10.15.5 via ge-0/0/4.0
10.0.0.6-0<c>/32
                   *[L-ISIS/14] 00:00:06, metric 20
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 16006
10.0.0.7-0<c>/32
                   *[L-ISIS/14] 00:00:06, metric 30
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 16007
10.0.0.8-0<c>/32
                   *[L-ISIS/14] 00:00:06, metric 40
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 16008
10.0.0.8-10<c>/64
                   *[SPRING-TE/8] 00:00:06, metric 1, metric2 40
                    >  to 10.10.12.2 via ge-0/0/1.0, Push 16008, Push 15003, Push 16003(top)
10.0.0.8-20<c>/64
                   *[SPRING-TE/8] 00:00:06, metric 1, metric2 40
                    >  to 10.10.12.2 via ge-0/0/1.0, Push 15000, Push 16003(top)
10.0.0.8-30<c>/64
                   *[SPRING-TE/8] 00:00:06, metric 1, metric2 40
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 15000, Push 16003, Push 16007(top)

root@R1# run show route table l3vpn.inet.0

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

100.64.1.0/24      *[BGP/170] 00:07:38, localpref 100, from 10.0.0.8
                      AS path: I, validation-state: unverified
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 16, Push 16008(top)
100.64.2.0/24      *[BGP/170] 00:07:38, localpref 100, from 10.0.0.8
                      AS path: I, validation-state: unverified
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 16, Push 16008(top)
100.64.3.0/24      *[BGP/170] 00:07:38, localpref 100, from 10.0.0.8
                      AS path: I, validation-state: unverified
                    >  to 10.10.15.5 via ge-0/0/4.0, Push 16, Push 16008(top)
Juniper Junos SR-TE DTM 控制面解析流程与四大排错要点架构图(RSVP 注入、maximum-labels 16、rib-group 回退、DTM ODN-blue)
图 2:Junos SR-TE DTM 核心控制面架构——四大避坑要点、DTM 自动生成 inetcolor.0 表项与 l3vpn.inet.0 最终压栈关系

步骤三:使用 Juniper SR-TE DTM 实现按需自动化创建 SR Policy

静态逐条手写 Cpath 在大规模网络中维护成本极高。下面我们将 BLUE LSP 替换为 Juniper SR-TE DTM(Dynamic Tunnel Module),通过 routing-options dynamic-tunnels 与 source-routing-path-template 实现:只要收到带有 color 10 且下一跳位于 10.0.0.0/24 的 BGP 路由,路由器自动按需生成 SR-TE Policy:

root@R1# show routing-options dynamic-tunnels
ODN-blue { // 创建 DTM Profile,名字叫 ODN-blue
    spring-te { // 激活为 segment routing TE 动态创建 Policy 的功能
        source-routing-path-template { 
            auto_blue color 10; // 调用刚刚配置好的模板,当遇到 color 10 的时候使用该模板创建 Policy
        }
        destination-networks {
            10.0.0.0/24; // 下一跳为这个范围地址内的时候,动态创建 Policy,与上面调用的 template 互相作用,缺一不可
        }
    }
}
root@R1# show protocols source-packet-routing
compute-profile dynamic_blue { // 这是上面已经配置过的约束条件
    admin-group include-any blue;
    metric-type {
        te;
    }
}
source-routing-path-template auto_blue { // 配置 ODN 模板 auto_blue
    primary {
        blue {
            compute {
                dynamic_blue; // 指定路径,名字为 blue (其实什么都行),调用 compute-profile dynamic_blue 作为计算时的约束条件
            }
        }
    }
}

配置生效后,查看 show spring-traffic-engineering route 与 VRF 路由表项,可见 10.0.0.8-10<c> 已由 Dynamic Tunnel Module(DTM) 自动创建(10.0.0.8:a:dt-srte-ODN-blue),路径与手动配置完全一致:

root@R1> show spring-traffic-engineering route
To                      Source                  SR Override Pref/Pref       LSP Name                              Segment Lists
10.0.0.8-10<c>          Dynamic Tunnel Module(DTM)          100 / 100       10.0.0.8:a:dt-srte-ODN-blue           blue
10.0.0.8-20<c>          Static configuration                100 / 100       orange                                orange
10.0.0.8-30<c>          Static configuration                100 / 100       te                                    te
15666                   Static configuration                100 / 100       orange                                orange
15777                   Static configuration                100 / 100       te                                    te

root@R1> show route table l3vpn.inet.0 100.64.1.0/24

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

100.64.1.0/24      *[BGP/170] 00:23:35, localpref 100, from 10.0.0.8
                      AS path: I, validation-state: unverified
                    >  to 10.10.12.2 via ge-0/0/1.0, Push 16, Push 16008, Push 15003, Push 16003(top)

步骤四:L3VPN 客户端 MTR 端到端路径验证

最后从 L3VPN-Client-A 分别向 L3VPN-Client-B 的三个目标地址(100.64.1.2、100.64.2.2、100.64.3.2)执行 mtr 验证(因开启了 icmp-tunneling,中间核心每跳均清晰可见):

root@L3VPN-Client-A:~# mtr 100.64.1.2 -n --report
Start: 2021-06-18T14:29:10+0000
HOST: L3VPN-Client-A              Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- 100.64.0.1                 0.0%    10    2.6  25.4   1.6 230.9  72.2
  2.|-- 10.10.12.2                 0.0%    10    7.7  23.0   7.5  74.8  26.0
  3.|-- 10.10.23.3                 0.0%    10   10.5  15.5   7.2  65.6  17.8
  4.|-- 10.10.34.4                 0.0%    10   17.9  21.5   7.6  73.2  22.1
  5.|-- 100.64.1.1                 0.0%    10    7.1  70.1   6.5 481.6 151.9
  6.|-- 100.64.1.2                 0.0%    10    8.1   9.3   7.6  13.4   2.1
// 由 Blue LSP 引流,路径 R1 -> R2 -> R3 -> R4 -> R8,符合题意

root@L3VPN-Client-A:~# mtr 100.64.2.2 -n --report
Start: 2021-06-18T14:29:28+0000
HOST: L3VPN-Client-A              Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- 100.64.0.1                 0.0%    10    1.6  45.3   1.6 387.3 121.1
  2.|-- 10.10.12.2                 0.0%    10   81.1  18.8   7.5  81.1  22.8
  3.|-- 10.10.23.3                 0.0%    10   10.6  59.9   5.5 515.3 160.0
  4.|-- 100.64.1.1                 0.0%    10   20.9  31.7   5.6 213.4  64.4
  5.|-- 100.64.2.2                 0.0%    10    8.3   8.1   6.5  12.7   1.9
// 由 Orange LSP 引流,路径 R1 -> R2 -> R3 -> R8,符合题意

root@L3VPN-Client-A:~# mtr 100.64.3.2 -n --report
Start: 2021-06-18T14:29:45+0000
HOST: L3VPN-Client-A              Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- 100.64.0.1                 0.0%    10    2.1  15.4   1.9 132.6  41.2
  2.|-- 10.10.15.5                 0.0%    10   71.4  55.8   8.8 334.2 100.7
  3.|-- 10.10.56.6                 0.0%    10    9.3  39.9   7.4 210.6  68.2
  4.|-- 10.10.67.7                 0.0%    10    8.2  41.2   7.3 289.3  88.0
  5.|-- 10.10.37.3                 0.0%    10    8.0  16.4   7.7  56.0  14.3
  6.|-- 100.64.1.1                 0.0%    10   10.3  11.1   6.7  37.7   9.4
  7.|-- 100.64.3.2                 0.0%    10    7.4   9.1   6.4  13.6   2.2
// 由 TE LSP 引流(通过 TE Metric 计算出来的路径,不含亲和属性作为约束条件),路径 R1 -> R5 -> R6 -> R7 -> R3 -> R8,符合题意

四大避坑要点总结

  • 开启 RSVP 注入亲和属性:若在 Junos SR-TE 中使用 admin-group 作为约束条件,必须全网接口配置 protocols rsvp interface all,否则 IS-IS TLV 不会携带亲和属性;
  • 注意 include-any 行为差异:Junos 中若沿途某跳完全不包含指定亲和属性,include-any 依然会算路失败(与 Cisco 行为不同);
  • 放开接口 maximum-labels 16:接口默认仅支持 3 层标签,超过 3 层标签的 SR-TE LSP 会直接变为 Unusable;
  • 务必配置 inet.3 → inetcolor.0 回退:通过 rib-group 拷贝 inet.3 路由到 inetcolor.0,避免 SR-TE LSP Down 后 VRF 路由全网中断。

参考资料

3 thoughts on “Juniper Junos SR-TE 与动态隧道映射(DTM)流量调度实战及排错指南”

Leave a Comment

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理。