LDP“标签映射消息”中的标签如何与IP前缀关联?

网络工程 多路复用器 低密度脂蛋白
2022-02-12 14:43:49

假设我有两个直接连接的路由器r1r2. 例如,我确实看到r2发送Label Mapping Messager1并提供了几个标签,包括210x15):

在此处输入图像描述

r1将标签与LDP 标签数据库中的21前缀关联:192.0.2.7/32

Input label database, 192.0.2.1:0--192.0.2.4:0
Labels received: 7
  Label     Prefix
     23      192.0.2.1/32
     17      192.0.2.2/32
     16      192.0.2.3/32
      3      192.0.2.4/32
     19      192.0.2.5/32
     20      192.0.2.6/32
     21      192.0.2.7/32

为什么r1将标签21与前缀相关联192.0.2.7/32

1个回答

FEC 元素是地址或前缀,当作为映射消息的一部分包含在 FEC TLV 中时,它们被映射到相关联的标签。

如果您展开数据包捕获的FEC 元素 1部分,它很可能会显示该元素192.0.2.7/32这在FEC TLV中以RFC5036 §3.4.1中记录的格式编码,每个元素具有以下结构和字段:

Prefix FEC Element value encoding:

       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |  Prefix (2)   |     Address Family            |     PreLen    |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                     Prefix                                    |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

         Address Family
            Two octet quantity containing a value from ADDRESS FAMILY
            NUMBERS in [ASSIGNED_AF] that encodes the address family for
            the address prefix in the Prefix field.

         PreLen
            One octet unsigned integer containing the length in bits of
            the address prefix that follows.  A length of zero indicates
            a prefix that matches all addresses (the default
            destination); in this case, the Prefix itself is zero
            octets).

         Prefix
            An address prefix encoded according to the Address Family
            field, whose length, in bits, was specified in the PreLen
            field, padded to a byte boundary.

映射消息本身记录在 §3.5.7 中。