帮助我们改善您的体验。

让我们了解您的想法。

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

Announcement: Try the Ask AI chatbot for answers to your technical questions about Juniper products and solutions.

close
header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
BGP 用户指南
Table of Contents Expand all
list Table of Contents

机器翻译对您有帮助吗?

starstarstarstarstar
Go to English page
免责声明:

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

用于 IBGP 扩展的 BGP 联合体

date_range 18-Jan-25

了解 BGP 联合

BGP 联合是解决 BGP 全网状要求产生的扩展问题的另一种方法。BGP 联合有效地将大型自治系统 (AS) 分解为子自治系统 (sub-AS)。每个子 AS 必须在联合 AS 中由子 AS 编号唯一标识。通常,子 AS 编号取自介于 64,512 和 65,535 之间的专用 AS 编号。

在子 AS 中,存在相同的内部 BGP (IBGP) 全网状要求。与其他联合的连接是使用标准外部 BGP (EBGP) 建立的,子 AS 外部的对等方被视为外部。为避免路由环路,子 AS 使用联合序列,其运行方式与 AS 路径类似,但仅使用专用分配的子 AS 编号。

联合 AS 对于其他联合 AS 显示为整体。其他 AS 接收的 AS 路径仅显示全局分配的 AS 编号。它不包括联合序列或专用分配的子 AS 编号。当路由从联合 AS 中播发时,将删除子 AS 编号。 图 1 显示了分为四个联合的 AS。

图 1: BGP 联盟BGP 联盟

图 1 显示了分为四个子 AS(64517、64550、65300 和 65410)的 AS 3,它们通过 EBGP 会话链接。由于联合体通过 EBGP 连接,因此不需要完全网格化。EBGP 路由将重新播发至其他子 AS。

示例:配置 BGP 联合身份验证

此示例演示如何配置 BGP 联合身份验证。

要求

概述

在 BGP 联合体内,联合体成员自治系统 (AS) 之间的链路必须是外部 BGP (EBGP) 链路,而不是内部 BGP (IBGP) 链路。

路由反射器类似,BGP 联合减少了对等会话和 TCP 会话的数量,以保持 IBGP 路由设备之间的连接。BGP 联合是用于解决 IBGP 全网状要求产生的扩展问题的一种方法。BGP 联合有效地将大型 AS 分解为子自治系统。每个子 AS 必须在联合 AS 中由子 AS 编号唯一标识。通常,子 AS 编号取自 64512 和 65535 之间的专用 AS 编号。在子 AS 中,存在相同的 IBGP 全网状要求。与其他联合体的连接是使用标准 EBGP 建立的,子 AS 外部的对等方被视为外部连接。为避免路由环路,子 AS 使用联合序列,其运行方式与 AS 路径类似,但仅使用专用分配的子 AS 编号。

图 2 显示了 AS 17 具有两个独立联合的示例网络:子 AS 64512 和子 AS 64513,每个子都有多个路由器。在子 AS 中,IGP 用于与内部对等方建立网络连接。在子 AS 之间,将建立 EBGP 对等会话。

图 2: 使用 BGP 联合的典型网络使用 BGP 联合的典型网络

拓扑学

配置

程序

CLI 快速配置

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

子 AS 64512 中的所有设备

content_copy zoom_out_map
set routing-options autonomous-system 64512
set routing-options confederation 17 members 64512 
set routing-options confederation 17 members 64513 
set protocols bgp group sub-AS-64512 type internal 
set protocols bgp group sub-AS-64512 local-address 192.168.5.1 
set protocols bgp group sub-AS-64512 neighbor 192.168.8.1 
set protocols bgp group sub-AS-64512 neighbor 192.168.15.1

子 AS 64512 中的边界设备

content_copy zoom_out_map
set protocols bgp group to-sub-AS-64513 type external 
set protocols bgp group to-sub-AS-64513 peer-as 64513 
set protocols bgp group to-sub-AS-64513 neighbor 192.168.5.2 

子 AS 64513 中的所有设备

content_copy zoom_out_map
set routing-options autonomous-system 64513
set routing-options confederation 17 members 64512 
set routing-options confederation 17 members 64513 
set protocols bgp group sub-AS-64513 type internal 
set protocols bgp group sub-AS-64513 local-address 192.168.5.2 
set protocols bgp group sub-AS-64513 neighbor 192.168.9.1 
set protocols bgp group sub-AS-64513 neighbor 192.168.16.1

子 AS 64513 中的边界设备

content_copy zoom_out_map
set protocols bgp group to-sub-AS-64512 type external 
set protocols bgp group to-sub-AS-64512 peer-as 64512 
set protocols bgp group to-sub-AS-64512 neighbor 192.168.5.1 
分步过程

此过程显示子 AS 64512 中设备的步骤。

autonomous-system 语句设置设备的子 AS 编号。

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

要配置 BGP 联合,请执行以下操作:

  1. 设置设备的子 AS 编号。

    content_copy zoom_out_map
    [edit routing-options]
    user@host# set autonomous-system 64512
    
  2. 在联合体中,包括主 AS 中的所有子 AS。

    数字 17 表示主 AS。该 members 语句列出了主 AS 中的所有子 AS。

    content_copy zoom_out_map
    [edit routing-options confederation]
    user@host# set 17 members 64512
    user@host# set 17 members 64513
    
  3. 在子 AS 64512 中的边界设备上,配置与 AS 64513 中边界设备的 EBGP 连接。

    content_copy zoom_out_map
    [edit protocols bgp group to-sub-AS-64513]
    user@host# set type external
    user@host# set neighbor 192.168.5.2
    user@host# set peer-as 64513
    
  4. 配置 IBGP 组,以便与子 AS 64512 中的设备对等互连。

    content_copy zoom_out_map
    [edit protocols bgp group sub-AS-64512]
    user@host# set type internal
    user@host# set local-address 192.168.5.1
    user@host# neighbor 192.168.8.1
    user@host# neighbor 192.168.15.1
    
结果

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

content_copy zoom_out_map
user@host# show routing-options
autonomous-system 64512; 
confederation 17 members [ 64512 64513 ];
content_copy zoom_out_map
user@host# show protocols
bgp {
    group to-sub-AS-64513 { # On the border devices only
        type external;
        peer-as 64513;
        neighbor 192.168.5.2;
    }
    group sub-AS-64512 {
        type internal;
        local-address 192.168.5.1;
        neighbor 192.168.8.1;
        neighbor 192.168.15.1;
    }
}

如果完成设备配置,请从配置模式输入 commit对 sSub-AS 64513 重复这些步骤。

验证

确认配置工作正常。

验证 BGP 邻居

目的

验证 BGP 是否在配置的接口上运行,以及每个邻居地址的 BGP 会话是否处于活动状态。

操作

从 CLI 中输入 show bgp neighbor 命令。

示例输出
命令名称
content_copy zoom_out_map
user@host> show bgp neighbor
Peer: 10.255.245.12+179 AS 35  Local: 10.255.245.13+2884 AS 35
  Type: Internal    State: Established  (route reflector client)Flags: Sync
  Last State: OpenConfirm   Last Event: RecvKeepAlive
  Last Error: None
  Options: Preference LocalAddress HoldTime Cluster AddressFamily Rib-group Refresh
  Address families configured: inet-vpn-unicast inet-labeled-unicast
  Local Address: 10.255.245.13 Holdtime: 90 Preference: 170
  Flags for NLRI inet-vpn-unicast: AggregateLabel
  Flags for NLRI inet-labeled-unicast: AggregateLabel
  Number of flaps: 0
  Peer ID: 10.255.245.12    Local ID: 10.255.245.13    Active Holdtime: 90
  Keepalive Interval: 30
  NLRI advertised by peer: inet-vpn-unicast inet-labeled-unicast
  NLRI for this session: inet-vpn-unicast inet-labeled-unicast
  Peer supports Refresh capability (2)
Restart time configured on the peer: 300
  Stale routes from peer are kept for: 60
  Restart time requested by this peer: 300
  NLRI that peer supports restart for: inet-unicast inet6-unicast
  NLRI that restart is negotiated for: inet-unicast inet6-unicast
  NLRI of received end-of-rib markers: inet-unicast inet6-unicast
  NLRI of all end-of-rib markers sent: inet-unicast inet6-unicast
  Table inet.0 Bit: 10000
    RIB State: restart is complete
    Send state: in sync
    Active prefixes: 4
    Received prefixes: 6
    Suppressed due to damping: 0
  Table inet6.0 Bit: 20000
    RIB State: restart is complete
    Send state: in sync
    Active prefixes: 0
    Received prefixes: 2
    Suppressed due to damping: 0
  Last traffic (seconds): Received 3    Sent 3    Checked 3
  Input messages:  Total 9      Updates 6       Refreshes 0     Octets 403
  Output messages: Total 7      Updates 3       Refreshes 0     Octets 365
  Output Queue[0]: 0
  Output Queue[1]: 0
  Trace options: detail packets
  Trace file: /var/log/bgpgr size 131072 files 10
意义

输出显示 BGP 邻接方列表以及详细的会话信息。验证以下信息:

  • 将列出每个已配置的对等邻接方。

  • 对于 State,每个 BGP 会话都是 Established

  • 对于 , Type每个对等方都配置为正确的类型(内部或外部)。

  • 对于 , ASBGP 邻接方的 AS 编号是正确的。

验证 BGP 组

目的

验证是否正确配置了 BGP 组。

操作

从 CLI 中输入 show bgp group 命令。

示例输出
命令名称
content_copy zoom_out_map
user@host> show bgp group
Group Type: Internal    AS: 10045       Local AS: 10045
  Name: pe-to-asbr2                                     Flags: Export Eval
  Export: [ match-all ]
  Total peers: 1        Established: 1
  10.0.0.4+179
  bgp.l3vpn.0: 1/1/0
  vpn-green.inet.0: 1/1/0

Groups: 1   Peers: 1    External: 0    Internal: 1    Down peers: 0   Flaps: 0
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
bgp.l3vpn.0            1          1          0          0          0          0
意义

输出显示包含详细组信息的 BGP 组列表。验证以下信息:

  • 将列出每个已配置的组。

  • 对于 , AS每个组的远程 AS 配置正确。

  • 对于 Local AS,每个组的本地 AS 配置正确。

  • 对于 Group Type,每个组都有正确的类型(内部或外部)。

  • 对于 , Total peers将显示组中的预期对等方数。

  • 对于 Established,组中的预期对等方数在该状态下具有 BGP 会话 Established

  • 组内所有对等方的 IP 地址都存在。

验证 BGP 摘要信息

目的

验证 BGP 配置是否正确。

操作

从 CLI 中输入 show bgp summary 命令。

示例输出
命令名称
content_copy zoom_out_map
user@host> show bgp summary
Groups: 1 Peers: 3 Down peers: 0
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0                 6          4          0          0          0          0
Peer               AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Damped...
10.0.0.2        65002      88675      88652       0       2       42:38 2/4/0                0/0/0
10.0.0.3        65002      54528      54532       0       1     2w4d22h 0/0/0                0/0/0
10.0.0.4        65002      51597      51584       0       0     2w3d22h 2/2/0                0/0/0
意义

输出显示 BGP 会话信息的摘要。验证以下信息:

  • 对于 , Groups将显示已配置组的总数。

  • 对于 Peers,将显示 BGP 对等方的总数。

  • 对于 Down Peers,未建立对等方的总数为 0。如果此值不为零,则尚未建立一个或多个对等会话。

  • 在 下 Peer,将显示每个已配置对等方的 IP 地址。

  • 在 下 AS,每个已配置对等方的对等方 AS 正确。

  • 在 下 Up/Dwn State,BGP 状态反映从邻接方接收的路径数、已接受的路径数以及阻尼的路由数(如 0/0/0)。如果字段为 Active,则表示建立 BGP 会话时出现问题。

footer-navigation