Nexthop Selection

BGP 在输入和输出时的 nexthop 选择过程。

Nexthop 选择

RouterOS 不会在 BGP 输入上执行严格的 nexthop 检查;相反,它依赖用户创建的 filter rules。

在输入上执行的操作:

  • 从 BGP NEXT_HOP 属性中读取 nexthop。
  • 对于多协议 NLRI,检查 nexthop 是否具有有效长度:
    • 如果长度无效,发送 Update 错误通知并退出。
    • 存储 nexthop 值。
    • 如果更新消息中出现链路本地 nexthop:
      • 确定连接接口。
      • 存储链路本地地址和接口。
  • 应用来自输入过滤规则的 nexthop 动作。
  • 将路由发送到主计算进程,在那里确定 nexthop 可达性。

BGP 输出

  • 如果 nexthop-choice 不是 force-self 或路由 AFI 不是 IPv4 或 IPv6:
    • 如果对端是 route reflector,或者 nexthop-choice 为 propagate,或者对端不是 eBGP:
      • 检查 nexthop AFI,并尝试设置出站链路本地 nexthop。
      • 检查 nexthop AFI,并尝试设置出站 nexthop。
    • 如果出站 nexthop 仍未设置且 BGP 对端不是 multihop:
      • 遍历可用的立即 nexthops,并尝试设置出站 nexthop 和 LL nexthop。
    • 如果出站 nexthop 等于远程 router-id,则取消设置出站 nexthop。
    • 如果出站 nexthop 等于远程对端的地址,则取消设置出站 nexthop。
    • 如果对端地址的接口不等于 LL nexthop 的接口,则取消设置出站 LL nexthop。
    • 如果出站 LL nexthop 等于远程对端的地址,则取消设置出站 LL nexthop。
  • 如果出站 nexthop 仍未设置,检查 AFI 并设置对端的 local-address。
  • 如果出站 nexthop 仍未设置且路由 AFI 为 IPv6 或 L2VPN:
    • 如果对端的本地地址为 IPv4,则将出站 nexthop 设置为 IPv6 映射的对端本地地址。