// //
//

Loading

BGP - 不同 AS 间运行的协议

在之前介绍的网络场景中,ERGRP,OPSF,RIP 等都是运行在单独一个 AS(自治系统之间)。这些协议统称为 IGP - 内部网关协议 ,目的主要是为自治系统内发现邻居和计算路由,从而找到合适的路径。

而 BGP 这样的协议,运行在不同的 AS 间(比如联通和电信间的通信)。目的是为了传递路由和控制路由。这类协议统称为 EGP - 外部网关协议。

BGP 特点

  • BGP 运行在不同 AS 间,端口为 179.
  • 是路径矢量路由协议
  • 增量更新,只发送更新的路由,原因在于 BGP 支持海量的路由传输(几十,上百万路由)
  • 无环路
  • 路由策略丰富,对路由进行过滤和选择
  • 基于 TLV 结构,易于扩展
  • 收敛较慢,由于基于 TCP 可靠传输,而且数量较大。
  • BGP 管理值 AD 分为两种:
    • 20:通过 EGP 邻居学到的路由 AD 为 20
    • 200:通过 IBGP 学习到的路由 AD 为 200 (一般在 AS 内都有 IGP - OSPF,EIGRP 等,而 IBGP 收敛很慢所以 AD 值较大)

关于路径矢量路由协议:

在这里,将 AS 65050 的路由传递给 AS 65010 时:

其中经过 65050->65030->65020 三个节点,并知道节点的方向,这就是基于路径矢量的路由协议。

BGP 数据结构

BGP 邻居表:建立的 Peer(对等体) 信息。

BGP 表:通过 BGP 协议学习到的路由(所有路由)。

路由表:实际转发的路由表(最优路由)。

BGP 协议术语

AS:自治系统,由一个技术管理机构管理,使用统一选录策略的一些路由器的集合。每一个自治系统都有一个唯一的自治系统编号,像公有 IP 一样,需要向 IANA 机构申请。同样也有私有的 AS 编号。

  • 两字节 AS 编号:0 - 65535,早期。其中 1 - 64511 公有编号,64512 - 65535 私有编号。
  • 四字节 AS 编号:四字节设备兼容两字节设备。1 - 42.。。

BGP 邻居种类:

  • IBGP:运行在同一 AS 号的设备。
  • EBGP:运行在不同 AS 号的设备。

BGP 连接邻居依赖与 TCP,只要 TCP 可达,就可以建立邻居。不用直连。

Peer:BGP 建立的邻居,叫对等体 - Peer.

BGP 报文

Open 报文:在 TCP 连接建立后的第一个报文,用于建立邻居。

Update 报文:用于在 Peer 间交换路由信息。可以发布或者撤销多条属性相同的路由信息

BGP 路由信息都会带有属性,如果属性相同。Update 可以同时发布属性一致的多条路由,在一个 Update 中,如果不一致,则需要在多个 Update 报文传送。

Keepalive 报文:BGP 周期性向 Peer 发送 Keepalive 报文,默认 60s 发送一次,保留时间 Hold 为 180s.

Notification 报文:当 BGP 检测到错误状态时,会像 Peer 发送错误报文,之后会断开连接。

Route Refresh 报文:在路由器开启路由刷新的功能后,如果在 BGP 入口路由器重新配置策略后,该路由器向对端 Peer 发送 Route Refresh 报文,让对端 Peer 重新发送路由。

新策略之后当接收到路由信息才生效,对已经进入路由表的路由,策略无法生效。

BGP 工作原理

  1. 首先通过 TCP 建立连接,TCP 建立成功后。开始发送 BGP 的 Open 报文,Open 用于建立 peer 关系。协商参数:
    1. BGP 版本
    2. BGP 连接保持时间
    3. Router ID
    4. 认证信息等
  2. BGP 连接建立后,如果有路由需要发送。会发送 Update 报文。
    1. Update 报文中,携带 BGP 属性。用于对端 Peer 选择路径。
    2. 在本地路由发生变化时,同样需要发送 Update 报文。
  3. 在本端和对端 Peer 都无新路由通告时,趋于稳定状态。此时定时发送 Keepalived 消息以保持 BGP 连接的有效性。、
  4. 当本地 BGP 发生错误时,需要发送 Notification 报文给对端。或者本端 Peer 关闭 BGP 时,同样会发送 Notification 报文。

BGP 路由生成方式

  1. 通过 network 宣告路由,将 IP 路由表已经存在的路由宣告至 BGP 网络中。

  2. 通过 redistribute 引入 static,直连,外部协议的路由。

BGP 路由传递原则

  1. 当存在多条到达同一目的地址的有效路由时,BGP 设备只会将最优路由通告给对端 Peer.

  2. 从 IBGP 对等体获得的 BGP,只能发给 EBGP 对等体,不发给 IBGP 对等体(BGP 水平分割)。

  3. 从 EBGP 对等体学到的路由可以发给 EBGP,IBGP 对等体。

  4. BGP 与 IGP 同步:在 IBGP 加入路由表并发布给 EBGP 对等体前,会先检查 IGP 路由表,在 IGP 路由表也存在该路由,才会加入路由表中,并发布给 EBGP 对等体。思科设备默认关闭。见拓展1。简单来说就是,只有 IGP(EIGRP,OSPF)能学到的路由,才会发布给 EGBP 对等体。

比如 ISP1 和 R1 连接的 Peer 关系属于 EBGP 的邻居关系,所以 R1 通过 EBGP 学到的路由,会发给 R3 和 R2 (属于 IBGP)。

但是,R3 和 R2 不会将从 R1 学到的路由发给 R4. 因为 R3 和 R4,R2 和 R4 之间是 IBGP 的邻居关系。

假设 IBGP 学到的路由能传给 IBGP,这样 R3 会传给 R4,R4 会传给 R2,这样就存在成环的风险。

但是,R1 和 R4 之间可以通过 TCP 建立 IBGP 邻居关系,R1 可将路由传给 R4.

BGP 属性

BGP 属性分为四类,是一套参数,是对路由的进一步描述,使得 BGP 能够对路由进行过滤和选择:

  • 公认必遵属性:
    • 所以 BGP 路由器必须遵守,必须存在于 Update 报文中。如果缺少该属性,路由信息就会出错。
    • 组成:
      • Origin
      • AS Path
      • Next hop
  • 公认任意属性:
    • 所以 BGP 必须能识别,但可以不存在 Update 报文中。
    • 组成:
      • Local Preference
      • Atomic Aggregate
  • 可选过滤属性:
    • 在 AS 直接具有可传递的属性
    • BGP 路由器可以不支持该属性,但仍然会接受该属性,并传递给其他对等体
    • 组成:
      • Aggregator
      • Community
  • 可选非过滤属性:
    • 如果 BGP 路由器可以不支持该属性,则不传递给其他对等体
    • 组成:
      • MED(其实是 Metric)
      • Originator ID
      • Cluster List

公认必尊

Origin:路由的起源,标记了该路由如何成为 BGP 路由,共有三类生成方式:

  1. 使用 network 命令,注入到 BGP 路由中,标识符为 i, 表示 Origin 属性为 IGP.
  2. 通过 EGP 学到的路由,注入到 BGP 路由中,标识符 e, 表示 Origin 属性为 EGP, 现在已经不存在了。
  3. 通过重分布命令,或其他方式,注入到 BGP 路由中,标识符 . 表示 Origin 属性为 incomplete.

如果通过三种方式学到同一个路由,会选择最优的。优先级为:IGP > EGP > Incomplete.

AS Path: AS 路径列表,记录了某条路由从本地到目的地所有经过的 AS 号列表。如果发现在列表中,有本 AS 号,则不接受该路由,从而避免 AS 路由环路。

  1. 当 BGP 设备通告一条路由时:
    • 如果将该路由通告给其他 AS ,便会将本地 AS 号添加到 AS Path 中,并通过 Update 报文通告给邻居路由器。(实验1,R1 产生 1.0,通告给 R2)
    • 如果该路由通告给本地 AS,会在 Update 报文中,添加空的 AS Path,通过 Update 报文通告给邻居路由器。
  2. 当 BGP 设备传播从其他 BGP 设备学习到的路由时:
    • 当 BGP 设备将这条路由通告给其他 AS,会将本地 AS 加入到 AS Path 最前端。(比如在实验1 中,R4 给 R5 传递 1.0 的路由)
    • 通告本地 AS 时,不会改变该 AS Path 的值。(比如在实验1 中,R2 传给 R4 1.0 的路由)

Next Hop:记录了路由的下一跳信息。BGP 的下一跳和 IGP 不同,不一定时邻居设备的 IP 地址。遵循下面原则:

  • BGP 设备将本地始发的路由发给 IBGP Peer 时,会将该路由信息的下一跳属性设置为本地与对端建立 BGP 邻居关系的接口地址。
    • 比如在实验1 中,R2 和 R4 通过 2.2.2.2 接口和 4.4.4.4 接口建立邻居。R2 上有几条始发的路由,在传递给 R4 后,R4 看到的路由 next hop 为 2.2.2.2.
  • BGP 设备通过 network 或重分布学习的 IGP 路由,发布给 IBGP Peer,下一跳地址为注入 IGP 的下一跳。
    • 比如在实验 1 中,R3 声明了一个回环接口 3.3.3.3/32, 然后通过 R3 上 OSPF 协议传递给 R2,此时去往 3.0 网络的 next hop 为 23.1.1.3 - R3 的e0/0 接口。这时 R2 通过重分布命令将 3.0 网络引入 BGP. 此时 R4 收到的去往 3.0 网络的下一跳地址仍然为 23.1.1.3.
  • BGP 设备在向 IBGP Peer 发布从 EBGP 学到的路由时,不改变路由的下一跳。
    • 比如在实验1 中,比如 R2 从 R1 学到 1.0 网络的路由,在 R2 去往 1.0 网络下一跳为 12.1.1.1. 在 R4 上该路由下一跳仍然为 12.1.1.1.
  • BGP 设备在向 EBGP Peer 发布路由时,会将该路由的下一跳设置建立建立邻居的接口地址。
    • 比如在实验1 中,比如 R2 向 R1 传递 5.0 网络的路由,在 R1 上看,去往 5.0 网络的下一跳地址为 R2 e0/0 接口 - 12.1.1.2.

公认任意

Local Preference:调整进入的路由,影响出的数据。

  • 仅在本 AS , IBGP 对等体有效,表明路由器 BGP 的优先级,默认为 100,越大越好。用于判断流量离开 AS 时的最近路径。

比如在 AS 65040 中,想要访问 AS 为 65020 的 209 网络的地址。可以通过 R3 或者 R5 学习到,所以对于 AS 65040 来说,入口有两个。假设我们想要将去往 209 网络的流量,全都经过 R2,R1 去往的也走 R2,这时就可以修改该 AS 的 Local Preference 将其设置为 200。

Atomic Aggregate: 当进行路由汇总时,该属性作为警告信息,警告下游邻居此路由是一条汇总路由,可能产生环路。

可选过滤

Community 属性:类似于 IBGP 中的 TAG 属性,为一些路由设置策略。下面是公共 community 属性:

  • Internet:默认情况下,所以路由都属于 Internet 团体,具有此属性的路由可以被通告给所以 BGP Peer
  • no-advertise: 具有此属性的路由,不通告给其他任何 Peer 对等体(EBGP + IBGP)
  • local-AS: 具有此属性的路由在收到后,不能被发到其他 AS, 只允许本地 AS.
  • no-export: 具有此属性的路由,不通告给其他EBGP Peer 对等体。

Aggregator 属性:标识发生聚合的节点,携带发生聚合节点的 Router-ID 和 AS 号。

可选非过滤

MED 属性:相当于 IGP Metric,用于判断流量进入本地 AS 时的最佳路由,注意和 Local Preference 区分,Local Preference 是影响流量出的优先级。

如图AS 为 65020 中 R1 和上面 AS 为 65010 的 R1 和 R2 建立了邻居,对于 AS 为 65020 中 R1 来说可以学习到两条去往 172 网络的路由,这时通过调整 MED,来控制选择那条路由,MED 越小越好。所以流量进入时,会选择 R2.

BGP 选路原则

当到达统一目的地存在多条路由时,BGP 会话会依照如下的策略顺序进行路由选择:

如果此路由的下一跳不可达,忽略此路由。

  1. 优先选择权重最高的(weight)路由 - Cisco 路由器私有属性
    • 在本地设备配置,只针对本身有效
  2. 优先选择本地优先级(local Preference)最高的路由,见 BGP 属性。
  3. 优选本地生成的路由。
    • 本地生成路由时:手动聚合 > 自动聚合 > network 宣告 > 重分布
  4. 优选 AS 路径最短的路由
  5. 比较 Origin 属性,见 BGP 属性。
    • Origin 优先级:IGP > EGP > Incomplete
  6. 优选 MED 值最低的路由,见 BGP 属性。
    • 在同一个 AS 才有效,不同 AS 没有可比性
  7. 优选从 EBGP 学来的路由(EBGP > IBGP)
  8. 优选下一跳到 IGP Metric 小的路由。
  9. 如果配置负载分担,执行负载分担
  10. 建立邻居时间更久的 EBGP 邻居。
    1. 可能出现同一个邻居,建立多条线路的情况 ,就是通过两个接口建立邻居。所以如果相同,继续向下比较。
  11. 优选 originator_ID 较小的路由器发布的路由,如果前者,则优选 Router ID 较小的路由器发布的路由
  12. 优选 Cluster_List 最短的路由
  13. 比较对等体 IP 地址,选择较小的 IP 地址的对等体学来的路由。

针对 weight 说明

如 R1 在去往 209 网络时,可通过 R4 或者 R2,R3 的路径。这时可以在 R1 本地进行设置,将去往 R2 的权重调高,从而将流量都走 R2. 注意该属性是 CISCO 设备的特有属性。并且该 Weight 值只能影响 R1,在 R1 传递路由给其他 Peer 时,不会传递该 Weight.

BGP 连接状态

Idle:BGP 初始状态,在 Start 事件启动后,才会正常开始建立连接。

Connect:等待 TCP 建立连接(默认 32 s).

  • TCP 建立成功,标识 TCP Established 状态,进入 Open Sent 状态。
  • TCP 建立失败,进入 Active 状态。再次尝试建立 TCP,如果还失败,就卡在 Active 状态。超时后回到 Connect 状态。
  • 如果超时,会一直在 Connect 状态,发生其他错误回到 Idle 状态。

Open Sent 状态:发送 BGP open 报文,同时等待接收 对方的 BGP Open 报文。

  • 如果 Open 报文没问题,进入 Open Confirm 状态。
  • 否则回到 Idle.

Open Confirm 状态:

  • 如果收到 Keepalived 报文,进行邻居维护。
  • 收到 Notification 报文,表示有错误,回到 Idle 状态。

Established 状态:经过 Open Confirm 验证后。

BGP 路由汇总

由于 BGP 的数量条目非常巨大,可以达到几十,上百万条。所以路由汇总,在 BGP 就格外的重要。

但在 BGP 汇总时,也会有一些问题,比如:

  • 如果聚合前的多个 AS 发布的路由携带了一些不同的属性,那么聚合后,这些属性怎么办?
  • 在聚合后,以前的路由相当于汇总成了一条路由,但发布者变成了聚合者,AS_PATH 中不再带有之前 AS 的标号,这就可能存在出现环路的风险。

汇总方法:

  • 手动配置:配置静态路由指向 NULL0,然后在 BGP 中通过此汇总路由,如果需要过滤明细,则通过 route-map 过滤。
  • 自动配置:在 BGP 中,进行宣告 aggregate-address 100.1.0.0 255.255.252.0
    • as-set: 还原路由 AS 的属性,将聚合前的发布者添加到 AS_PATH 列表
    • summary-only:仅仅发布汇总路由

为汇总后的聚合路由设置 community 属性:

  • 通过 route-map 配置 community 属性,需要在开启 as-set 和 send-community 配置后,才会传递 community 属性
  • 如果聚合前路由含有 community 的属性,在聚合后也会含有 community 属性

为聚合路由设置 suppress-map:用于限制某些路由发送

  • 如发送汇总后的路由,以及汇总前的一部分路由

为聚合路由设置属性:通过 attribute-map 修改汇总的路由属性:

  • 为汇总后的路由添加一些新的 BGP 属性

为聚合路由设置 advertise-map 属性:汇总并通告某些路由:

  • 当有 route-map 中的路由存在时,才会出现汇总路由
  • 并且汇总路由只继承 advertise-map xxx 中路由的属性,用于移除某些不想要的明细路由的属性。

举例来说:

假如有四个网段:
192.168.0.0/24
192.168.1.0/24
192.168.2.0/24
192.168.3.0/24

想汇总成:
192.168.0.0/22

当由于 192.168.4.0/24 网络不太稳定,所以想实现:在汇总路由时,当 192.168.4.0/24 网段存在时,才会汇总该路由。
而且聚合后的属性,是 192.168.4.0/24 该网段的属性。

BGP 路由过滤

BGP 路由过滤工具:

  • Route-map
  • Prefix-list
  • AS-Path access-list:通过正则表达式过滤。由于 BGP 传输海量的路由,上面两种方式配置操作太麻烦。

使用直连物理口建立 BGP 邻居:

  1. 在 R1 出站,使用 route-map 过滤 100.1.1.0/24, 100.1.2.0/24 的路由。
  2. 在 R3 入站,使用 prefix-list 过滤 10.1.2.0/24,10.1.3.0/24 路由。
  3. 在 R4 入站,使用 as-path access-list 过滤来自 AS 100 的路由。
# route-map 过滤
R1(config)#access-list 1 permit 100.1.1.0 0.0.0.0
R1(config)#access-list 1 permit 100.1.2.0 0.0.0.0
R1(config)#route-map deny_100.map deny 10
R1(config-route-map)#match ip address 1
R1(config-route-map)#exit
R1(config)#route-map deny_100.map permit 20
R1(config-route-map)#exit
R1(config)#router bgp 100
R1(config-router)#neighbor 12.1.1.2 route-map deny_100.map out
R1(config-router)#exit
R1(config)#end
R1#clear ip bgp 12.1.1.2 out

# prefix-list
R3(config)#ip prefix-list deny_10.pre deny 10.1.2.0/24
R3(config)#ip prefix-list deny_10.pre deny 10.1.3.0/24
R3(config)#ip prefix-list deny_10.pre permit 0.0.0.0/0 le 32
R3(config)#router bgp 200
R3(config-router)#neighbor 23.1.1.2 prefix-list deny_10.pre in
R3#clear ip bgp 23.1.1.2 in

# as-path access-list 
R4(config)#ip as-path access-list 1 deny 100$
R4(config)#ip as-path access-list 1 permit .*

R4(config)#router bgp 300
R4(config-router)#neighbor 34.1.1.3 filter-list 1 in
R4#clear ip bgp 34.1.1.3 in

BGP - Peer Group

考虑到可能需要建立多个相同 peer 的情况,为了简化 BGP 对邻居的参数配置,通过 BGP-Peer Group 属性,将需要相同配置和策略的 peer 宣告进一个 Peer Group 中。

限制:对于一个 Peer-Group 来说,所有 Peer(邻居)必须全为 IGP 邻居,或者 EGP 邻居。

假设有这样的场景:

在 AS 100 中,有多台路由器,需要建立全互联的 IGP 邻居,并使用环回口建立。

在配置过程中,很多配置都一样。所以可以通过 Peer Group,将要建立邻居的路由器邻居地址放在一起,这样仅需要配置一次,就相当于和 Peer Group 中所有的邻居建立了 IGP 关系。

R1 和 R2,R3 建立 IBGP 关系,并使用环回口,并建立 Peer Group.

这里由于想通过环回口建立 R1,R2,R3 之间的关系,所以需要通过在内部使用 IGP - OSPF 传递相关的路由,保证 TCP 可达。才能建立邻居关系。

# R1 Peer-Group 配置
router bgp 100
 bgp router-id 1.1.1.1
 # 声明 group,并配置统一命令
 neighbor AS_100 peer-group
 neighbor AS_100 remote-as 100
 neighbor AS_100 update-source Loopback0
 neighbor AS_100 next-hop-self
 # 将 peer ip 声明到该 group 中
 neighbor 2.2.2.2 peer-group AS_100
 neighbor 3.3.3.3 peer-group AS_100
router ospf 100
 router-id 1.1.1.1
 network 1.1.1.1 0.0.0.0 area 0
 network 12.1.1.0 0.0.0.255 area 0
 network 13.1.1.0 0.0.0.255 area 0

# R2 正常配置
R2#show running-config | s router
router ospf 100
 router-id 2.2.2.2
 network 2.2.2.2 0.0.0.0 area 0
 network 12.1.1.0 0.0.0.255 area 0
router bgp 100
 bgp router-id 2.2.2.2
 neighbor 1.1.1.1 remote-as 100
 neighbor 1.1.1.1 update-source Loopback0

# R3 正常配置
R3#show running-config | s router
router ospf 100
 router-id 3.3.3.3
 network 3.3.3.3 0.0.0.0 area 0
 network 13.1.1.0 0.0.0.255 area 0
router bgp 100
 bgp router-id 3.3.3.3
 neighbor 1.1.1.1 remote-as 100
 neighbor 1.1.1.1 update-source Loopback0

R1 和 R4,R5 建立 EBGP 关系,并使用 Peer Group,并配置属性过滤 22 网段的路由。

# R1 建立 EBGP Peer-group 组
router bgp 100
 neighbor AS200_300 peer-group
 neighbor 14.1.1.4 remote-as 200
 neighbor 14.1.1.4 peer-group AS200_300
 neighbor 15.1.1.5 remote-as 300
 neighbor 15.1.1.5 peer-group AS200_300
 # 这里由于 neighbor 的 AS 不一样,所以需要分开声明。

# R4 BGP 配置
router bgp 200
 bgp router-id 4.4.4.4
 bgp log-neighbor-changes
 neighbor 14.1.1.1 remote-as 100

# R5 BGP 配置
router bgp 300
 bgp router-id 5.5.5.5
 bgp log-neighbor-changes
 neighbor 15.1.1.1 remote-as 100
 
 # 这里将 2.0 和 3.0 通过 BGP 宣告给 EBGP 邻居,然后想过滤 3.0 的路由,
 # 这时如果对于 peer 有经常需要改变策略的情况,直接对 Peer-Group 进行操作就可以了。
 # R1 宣告网络
 network 2.2.2.2 mask 255.255.255.255
 network 3.3.3.3 mask 255.255.255.255
 # 设置策略
R1(config)#ip prefix-list f.pre deny 2.2.2.2/32
R1(config)#ip prefix-list f.pre perm
R1(config)#ip prefix-list f.pre permit 0.0.0.0/0 le 32
R1(config)#router bgp 100
R1(config-router)#neighbor AS200_300 prefix-list f.pre out

# 在 R4 查看,没有 2.0 的网络:
R4#show ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>   1.1.1.0/24       14.1.1.1                 0             0 100 i
 *>   3.3.3.3/32       14.1.1.1                11             0 100 i

BGP 认证

BGP 使用 Md5 进行认证,使用 peer-group 的拓扑。

# R2 配置认证
 neighbor 1.1.1.1 remote-as 100 password cisco
 clear ip bgp 1.1.1.1
 
 # R3 配置认证
 neighbor 1.1.1.1 remote-as 100 password cisco
 
 # R1 配置认证
 R1(config-router)#neighbor AS_100 password cisco

BGP 反射器

在 BGP 路由传递规则的第二条中,我们知道,从 IBGP 对等体获得的 BGP,只能发给 EBGP 对等体,不发给 IBGP 对等体(BGP 水平分割)。

但这样也有问题,比如如下场景中:

根据 BGP 水平分割原则,从 IBGP 学到的路由不能传给 IBGP,所以这里 R2 R4 R5 都需要和 R3 建立 IBGP 的关系,但如果未来这三台路由器,也从其他 AS 学来路由,所以就需要对这四台设备建立全互联的 IBGP 关系,建立的总数就是:n(n-1)/2 = 6 条。如果设备的数量多起来后,就需要维护大量的 Peer 关系。造成性能的浪费。

为了学习到 IBGP 的路由,可以通过路由反射器(RR),减少建立 IGP 的全互联的关系。

路由反射器 RR 具有的角色:

  • 客户机(Client):与 RR 形成反射邻居关系的 IBGP 设备。
  • 非客户机(Non-Client):不是 RR 也不是客户机的 IBGP 设备。
  • 集群(Cluster):路由反射器及其客户机的集合。

路由反射器 RR 具有的功能:

  • 允许从 IBGP 学到的路由,反射到其他 IBGP 对等体设备。

路由反射器 RR 反射规则:

  • 从 EBGP 对等体学到的路由,可以发给非客户机和客户机。
  • 从非客户机 IBGP 对等体学到的路由,发布给此 RR 的所有客户机。
  • 从客户机学到的路由,发布给此 RR 的所有客户机和非客户机。(发起此路由的客户机除外)

背景:

R1 和 R2 建立,EBGP 关系。

R2,R3,R4,R5 建立 IBGP 关系,并建立 OSPF 保证内部网络可达。

R5 和 R6 建立 EBGP 关系。

这里想要实现:在 R1 上有 1.0 网络,R6 上有 6.0 网络,并配置在环回口上。想要让 R1 收到 R6 的路由,R6 收到 R1 的路由。

根据 BGP 水平分割原则,R2 从 EBGP 学到的路由,可以传给 R3,但 R3 是从 IBGP 学到的路由,不能传给 R4. 所以 1.0 路由再次中断。

同理,6.0 的路由在 R3 中断。

正常传递 BGP 路由:

# R1
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
interface Ethernet0/0
 ip address 12.1.1.1 255.255.255.0
router bgp 65100
 bgp router-id 1.1.1.1
 bgp log-neighbor-changes
 network 1.1.1.1 mask 255.255.255.255
 neighbor 12.1.1.2 remote-as 65200

# R2 
interface Ethernet0/0
 ip address 12.1.1.2 255.255.255.0
interface Ethernet0/1
 ip address 23.1.1.2 255.255.255.0
router bgp 65200
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 neighbor 12.1.1.1 remote-as 65100
 neighbor 23.1.1.3 remote-as 65200
 neighbor 23.1.1.3 next-hop-self
 # 宣告内部网络给 R1 和 R6
 network 12.1.1.0 mask 255.255.255.0
 network 23.1.1.0 mask 255.255.255.0
router ospf 100
 network 23.1.1.0 0.0.0.255 area 0


# R3
interface Ethernet0/0
 ip address 23.1.1.3 255.255.255.0
 duplex auto
interface Ethernet0/1
 ip address 34.1.1.3 255.255.255.0
interface Ethernet0/2
 no ip address
 shutdown
router bgp 65200
 bgp router-id 3.3.3.3
 bgp log-neighbor-changes
 neighbor 23.1.1.2 remote-as 65200
 neighbor 34.1.1.4 remote-as 65200
 router ospf 100
 network 23.1.1.0 0.0.0.255 area 0
 network 34.1.1.0 0.0.0.255 area 0


# R4
interface Ethernet0/0
 ip address 34.1.1.4 255.255.255.0
interface Ethernet0/1
 ip address 45.1.1.4 255.255.255.0
router bgp 65200
 bgp router-id 4.4.4.4
 neighbor 34.1.1.3 remote-as 65200
 neighbor 45.1.1.5 remote-as 65200
router ospf 100
 network 34.1.1.0 0.0.0.255 area 0
 network 45.1.1.0 0.0.0.255 area 0


# R5
interface Ethernet0/0
 ip address 45.1.1.5 255.255.255.0
interface Ethernet0/1
 ip address 56.1.1.5 255.255.255.0
router bgp 65200
 bgp router-id 5.5.5.5
 neighbor 45.1.1.4 remote-as 65200
 neighbor 45.1.1.4 next-hop-self
 neighbor 56.1.1.6 remote-as 65300
 network 45.1.1.0 mask 255.255.255.0
 network 56.1.1.0 mask 255.255.255.0
router ospf 100
 network 45.1.1.0 0.0.0.255 area 0

# R6
interface Loopback0
 ip address 6.6.6.6 255.255.255.255
interface Ethernet0/0
 ip address 56.1.1.6 255.255.255.0
router bgp 65300
 bgp router-id 6.6.6.6
 network 6.6.6.6 mask 255.255.255.255
 neighbor 56.1.1.5 remote-as 65200

配置反射器:

# R3 将 34.1.1.4 设置成客户端,自己成为 RR,此时会将 1.0 网络发给 R4
R3(config)#router bgp 65200
R3(config-router)#neighbor 34.1.1.4  route-reflector-client

# R4 将 45.1.1.5 设置成客户端,自己成为 RR,此时会将 1.0 网络发给 R5
R4(config)#router bgp 65200
R4(config-router)#neighbor 45.1.1.5 route-reflector-client

这样就实现了 R1 的路由传给 R6。R6 的路由传给 R1。

现在分析一下这个过程:
1.0 网络:
由于 R3 是 RR,客户端是 R4. 所以 RR 会将 1.0 网络传给客户端 R4.
由于 R4 是 RR,客户端是 R5.从非客户机学来的路由可以传给本 RR 的客户机。所以 RR 会将 1.0 网络传给客户端 R5.
R5 和 R6 是 EBGP,所以将路由传给 R6.

6.0 网络:
R5 从 EBGP 学到 6.0 网络。
由于 R5 是 R4 的客户机,从客户机学到的路由,发布给此 RR 的所有客户机和非客户机。
R2 是 R3 的客户机,所以 R2 会收到 R3 发来的路由。
R2 和 R1 是 EBGP,所以会将路由传给 R1.

配置反射器会不会造成环路?

通过 cluster_list 进行反射器防环:

如上面的拓扑中,R5 和 R1 建立 IBGP 关系,R5 学到的路由会传给 R1,而 R2 R3 R4 收不到。所以将 R4 配置成 RR,传递给 R3。R3 配置成 RR,传给 R2,R2 配置成 RR,传给 R1(可能 R1 也有自己的路由需要发送。)。看起来这样就形成了环路。

但实际上不会,通过 cluster_list 防止环路。在每个 cluster 中,如果经过反射器,反射器就会将自己的 Router-Id 添加到 cluster_list 中。如果发现在 cluster_list 中有自己的 router_id,说明这个路由曾经是自己反射过去的,从而避免环路。

路由的 cluster_list 变化如下:

  • cluster_list: R1_ID
  • cluster_list: R4_ID, R1_ID
  • cluster_list: R3_ID, R4_ID, R1_ID
  • cluster_list: R2_ID, R3_ID, R4_ID, R1_ID
  • R1 检测发现包含自己的 ID,所以将该路由扔掉。

通过 Originator ID 进行始发者防止环路:

假如 R1 上一个回环口 Io 1 1.1.1.1 的路由,想让 R3,R4 收到 R1 的路由,注意此时 R1 不是 RR。而 R4 和 R3 是 RR。

1.1.1.1 的路由是 R1 的路由,不是从其他 IBGP 学到的路由,所以能正常传递给 R4. R4 作为反射器传递给 R3,R3 作为反射器又传递给 R1.

但此时 R1 发现该路由的 Originator ID 为自己,所以将该路由丢弃掉。

BGP 联盟

BGP 联盟采用在一个 AS 内部,建立多个子 AS 的方法,将一个大 AS 拆分成多个子 AS,让 AS 内部建立 EBGP 邻居,解决 IBGP 水平分割的问题。建议使用私有 AS 号(64512 - 65534). 对于外界来说,并不知道该 AS 内部拥有多个子 AS.

# R2
# 声明子 AS 号
router bgp 65023
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 # 指定父 AS 号
 bgp confederation identifier 65200
 neighbor 12.1.1.1 remote-as 65100
 neighbor 23.1.1.3 remote-as 65023
 neighbor 23.1.1.3 next-hop-self

# R3
router bgp 65023
 bgp router-id 3.3.3.3
 # 指定父 AS 号
 bgp confederation identifier 65200
 # 指定另一个子 AS 的号,用于和不使用 BGP 联盟进行区分
 bgp confederation peers 65045
 neighbor 23.1.1.2 remote-as 65023
 neighbor 34.1.1.4 remote-as 65045
 
 # R4
 router bgp 65045
 bgp router-id 4.4.4.4
# 指定父 AS 号
 bgp confederation identifier 65200
# 指定另一个子 AS 的号,用于和不使用 BGP 联盟进行区分
 bgp confederation peers 65023
 neighbor 34.1.1.3 remote-as 65023
 neighbor 45.1.1.5 remote-as 65045

# R5
router bgp 65045
 bgp router-id 5.5.5.5
 # 指定父 AS 号
 bgp confederation identifier 65200
 neighbor 45.1.1.4 remote-as 65045
 neighbor 45.1.1.4 next-hop-self
 neighbor 56.1.1.6 remote-as 65300
 
# 在 R1 查看 6.0 的 bgp 路由信息,发现 AS Path 中并没有子 AS PAth。
R1#show ip bgp 
     Network          Next Hop            Metric LocPrf Weight Path
 *>   1.1.1.1/32       0.0.0.0                  0         32768 i
 *>   6.6.6.6/32       12.1.1.2                           0           65200 65300 i

# 在 R2 中查看 6.0 bgp 路由信息,发现有 65045 的子 AS Path.
R2#show ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>   1.1.1.1/32       12.1.1.1                 0             0 65100 i
 *>i  6.6.6.6/32       45.1.1.5                 0    100      0 (65045) 65300 i

BGP - IPV6

router bgp 200
# 建立正常 Peer 和 IPV4 一样
neighbor 3003::3 remote-as 200
# 对 neighbor 各种属性的配置,在 address-famliy 下
address-family ipv6
neighbor 3003::3 activate
neighbor 3003::3 next-hop-self
exit-address-family

配置

实验1:EBGP 和 IBGP 之间的相互通信

R1 和 R2 之间建立 EBGP 邻居。

R2 和 R4 之间建立 IBGP 邻居,使用回环接口。因为回环接口是虚拟接口,不是物理接口。从而可以保证线路的稳定,假设 R2 到 R4 可以存在多条路径,不会因为某一条断了,之间邻居关系就消失。

R2,R3,R4 运行 OSPF,实现 R2,R3,R4 之间的网络可达。

R4 和 R5 之间建立 EBGP 邻居。

实现:R1 访问 5.0 网络,R5 访问 1.0 网络的全网互通。

# R1 
!
interface Loopback1
 ip address 1.1.1.1 255.255.255.0
!
interface Ethernet0/0
 ip address 12.1.1.1 255.255.255.0
 duplex auto
!
!
router bgp 100
 bgp router-id 1.1.1.1
 bgp log-neighbor-changes
 # 宣告的路由
 network 1.1.1.0 mask 255.255.255.0
 # 建立 EBGP 邻居
 neighbor 12.1.1.2 remote-as 200
!
# 查看邻居信息 
R1#show ip bgp summary

# 查看 BGP 路由表
1#show ip bgp
BGP table version is 2, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
              t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>   1.1.1.0/24       0.0.0.0                  0         32768 i

# R2
!
interface Loopback1
 ip address 2.2.2.2 255.255.255.0
!
interface Ethernet0/0
 ip address 12.1.1.2 255.255.255.0
 duplex auto
!
interface Ethernet0/1
 ip address 23.1.1.2 255.255.255.0
 duplex auto
!
router ospf 100
 router-id 2.2.2.2
 network 2.2.2.2 0.0.0.0 area 0
 network 23.1.1.2 0.0.0.0 area 0
!
router bgp 200
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 neighbor 4.4.4.4 remote-as 200
 # 由于是通过虚拟接口建立邻居,所以建立时需要指定通过哪个接口建立,否则无法建立邻居关系,物理接口没有这个问题
 neighbor 4.4.4.4 update-source Loopback1
 # BGP 在默认传递路由时,不会更改下一跳地址,默认将其视为一个整体。
 # 而且在传递路由时,BGP 只传递最优路由,如果不设置,R1 根本不会传递 5.5.5.5 的路由。
 # 由于 R3,R4 没有去往 1.1.1.1 的路由,虽然 1.0 网络存在在 BGP 路由表中,但不可达,所以将下一跳地址改为 R2 自己
 neighbor 4.4.4.4 next-hop-self
 neighbor 12.1.1.1 remote-as 100
!
# R3 
!
interface Ethernet0/0
 ip address 23.1.1.3 255.255.255.0
 duplex auto
!
interface Ethernet0/1
 ip address 34.1.1.3 255.255.255.0
 duplex auto
!
router ospf 100
 router-id 3.3.3.3
 network 23.1.1.0 0.0.0.255 area 0
 network 34.1.1.0 0.0.0.255 area 0
!
# R4
!
interface Loopback0
 ip address 4.4.4.4 255.255.255.0
!
interface Ethernet0/0
 ip address 34.1.1.4 255.255.255.0
 duplex auto
!
interface Ethernet0/1
 ip address 45.1.1.4 255.255.255.0
 duplex auto
!
router ospf 100
 network 4.4.4.4 0.0.0.0 area 0
 network 34.1.1.4 0.0.0.0 area 0
!
router bgp 200
 bgp router-id 4.4.4.4
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 200
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 45.1.1.5 remote-as 300
 neighbor 2.2.2.2 next-hop-self
!

# 如果有延迟通过该命令刷新
R2#clear ip bgp interna
# R5
!
interface Loopback5
 ip address 5.5.5.5 255.255.255.0
!
interface Ethernet0/0
 ip address 45.1.1.5 255.255.255.0
 duplex auto
!
router bgp 300
 bgp router-id 5.5.5.5
 bgp log-neighbor-changes
 network 5.5.5.0 mask 255.255.255.0
 neighbor 45.1.1.4 remote-as 200
!

拓展1:BGP 和 IGP 传递路由原则

但这时有个问题,R1 和 R5 虽然能够学习到 BGP 的路由,但依然无法正常通信。R1 使用 Lo 0 接口 ping 不通 5.5.5.5 的接口,原因在于:

R1 想要访问 5.0 网络,需要将数据给 R2,R2 想要访问 5.0 网络,需要将数据包给 4.0 网络,而去 4.0 网络,需要将数据包给 R3. 可是 R3 并没有去往 5.0 网络的路由,因此产生了路由黑洞。

换句话说,如果在传递 BGP 路由前,先去检测 IGP 到这条路由是否可达,如果可达就去传。但该功能默认在思科设备上关闭的,其实现在很多厂商的设备都将该属性设置是关闭的。

因为 BGP 的目的在于传递路由,而不是检测自己能不能可达。

解决上面的问题也很简单,将 R3 也建立 IBGP 的邻居关系就可以了。

在 EBGP 间使用回环接口建立 EBGP 邻居

在 R1 上配置 11 网络的回环口,增加默认路由:

# 配合回环接口和静态路由
R1(config)#int lo 11
R1(config-if)#ip addr 11.11.11.11 255.255.255.255
R1(config-if)#exit
R1(config)#ip route 22.22.22.22 255.255.255.255 12.1.1.2

# 配合 bgp 邻居
R1(config)#router bgp 100
R1(config-router)#no neighbor 12.1.1.2 remote-as 200
R1(config-router)#neighbor 22.22.22.22 update-source lo 11

在 R2 上配置 22 网络的回环口,增加默认路由:

R2(config)#int lo 22
R2(config-if)#ip addr 22.22.22.22 255.255.255.255
R2(config)#ip route 11.11.11.11 255.255.255.255 12.1.1.1

R2(config)#router bgp 200
R2(config-router)#no neighbor 12.1.1.1 remote-as 100
R2(config-router)#neighbor 11.11.11.11 remote-as 100
R1(config-router)#neighbor 11.11.111.1 update-source lo 22

R1 查看 EBGP 邻居,发现无法建立:

R1#show ip bgp summary
BGP router identifier 1.1.1.1, local AS number 100
BGP table version is 4, main routing table version 4
1 network entries using 144 bytes of memory
1 path entries using 84 bytes of memory
1/1 BGP path/bestpath attribute entries using 160 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 388 total bytes of memory
BGP activity 2/1 prefixes, 2/1 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
22.22.22.22     4          200       0       0        1    0    0 never    Idle


R1#ping 22.22.22.22
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 22.22.22.22, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/5 ms

发现无法正常建立,原因在于:

EBGP 的直连检测功能:在建立邻居时,会检测下直连的接口是否是物理接口。

如果一定要使用回环接口,可以通过该命令,将网络层 TTL 值修改为 255, 从而打破直连检测功能

R1(config)#router bgp 100
R1(config-router)#neighbor 22.22.22.22 ebgp-multihop

R2(config)#router bgp 200
R2(config-router)#neighbor 11.11.11.11 ebgp-multihop

# 发现邻居可以正常建立了
R1#show ip bgp summary
BGP router identifier 1.1.1.1, local AS number 100
BGP table version is 5, main routing table version 5
2 network entries using 288 bytes of memory
2 path entries using 168 bytes of memory
2/2 BGP path/bestpath attribute entries using 320 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 800 total bytes of memory
BGP activity 3/1 prefixes, 3/1 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
22.22.22.22     4          200       6       6        5    0    0 00:01:34        1

但在实际中,不同 AS 一般对应不同的机构,所以使用物理接口比较常见,因为使用回环接口往往需要考虑安全,策略等因素。

实验2:BGP 选路

这里假设 AS 200 为外部 ISP 的自治系统,AS 100 为内部的自治系统。这里我们想在 AS 100 内进行配置,实现 BGP 的选路操作。

准备工作:

  1. 首先在 AS 100 中,建立 R1,R2,R3 的邻居关系,通过 IGP - OSPF 实现,路由的互通。然后在 R1,R2,R3 中建立 IBGP 的 Peer 关系。
# 建立如下接口:
R1>show ip inter br
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                12.1.1.1        YES manual up                    up
Ethernet0/1                13.1.1.1        YES manual up                    up
Ethernet0/2                unassigned      YES unset  administratively down down
Ethernet0/3                unassigned      YES unset  administratively down down
Loopback0                  1.1.1.1         YES manual up                    up
Loopback10                 10.1.1.1        YES manual up                    up
Loopback11                 10.11.11.11     YES manual up                    up

R2>show ip inter br
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                12.1.1.2        YES manual up                    up
Ethernet0/1                23.1.1.2        YES manual up                    up
Ethernet0/2                24.1.1.2        YES manual up                    up
Ethernet0/3                unassigned      YES unset  administratively down down
Loopback0                  2.2.2.2         YES manual up                    up

R3>show ip inte br
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                13.1.1.3        YES manual up                    up
Ethernet0/1                23.1.1.3        YES manual up                    up
Ethernet0/2                35.1.1.3        YES manual up                    up
Ethernet0/3                unassigned      YES unset  administratively down down
Loopback0                  3.3.3.3         YES manual up                    up
# 通过回环口,建立 IBGP 邻居关系
# R1
R1#show running-config | s bgp
router bgp 100
 bgp router-id 1.1.1.1
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 100
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 3.3.3.3 remote-as 100
 neighbor 3.3.3.3 update-source Loopback0

# R2
R2#show running-config | s bgp
router bgp 100
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 neighbor 1.1.1.1 remote-as 100
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 3.3.3.3 remote-as 100
 neighbor 3.3.3.3 update-source Loopback0

# R3
router bgp 100
 bgp router-id 3.3.3.3
 bgp log-neighbor-changes
 neighbor 1.1.1.1 remote-as 100
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 2.2.2.2 remote-as 100
 neighbor 2.2.2.2 update-source Loopback0
  1. 同样在 AS 200 中,建立 R4,R5,R6 的邻居关系,通过 IGP - OSPF 实现,路由的互通。然后在 R4,R5,R6 中建立 IBGP 的 Peer关系。

    R4>show ip inter br
    Interface                  IP-Address      OK? Method Status                Protocol
    Ethernet0/0                24.1.1.4        YES manual up                    up
    Ethernet0/1                45.1.1.4        YES manual up                    up
    Ethernet0/2                46.1.1.4        YES manual up                    up
    Ethernet0/3                unassigned      YES unset  administratively down down
    Loopback0                  4.4.4.4         YES manual up                    up
    
    R5>show ip inter br
    Interface                  IP-Address      OK? Method Status                Protocol
    Ethernet0/0                35.1.1.5        YES manual up                    up
    Ethernet0/1                45.1.1.5        YES manual up                    up
    Ethernet0/2                56.1.1.5        YES manual up                    up
    Ethernet0/3                unassigned      YES unset  administratively down down
    Loopback0                  5.5.5.5         YES manual up                    up
    
    R6>show ip inter br
    Interface                  IP-Address      OK? Method Status                Protocol
    Ethernet0/0                46.1.1.6        YES manual up                    up
    Ethernet0/1                56.1.1.6        YES manual up                    up
    Ethernet0/2                unassigned      YES unset  administratively down down
    Ethernet0/3                unassigned      YES unset  administratively down down
    Loopback0                  6.6.6.6         YES manual up                    up
    Loopback10                 10.6.6.6        YES manual up                    up
    Loopback11                 10.66.66.66     YES manual up                    up
    
    # 通过回环口,建立 IBGP 邻居关系
    # R4
    R1#show running-config | s bgp
    router bgp 200
     bgp router-id 4.4.4.4
     bgp log-neighbor-changes
     neighbor 5.5.5.5 remote-as 200
     neighbor 5.5.5.5 update-source Loopback0
     neighbor 6.6.6.6 remote-as 200
     neighbor 6.6.6.6 update-source Loopback0
    
    # R5
    R2#show running-config | s bgp
    router bgp 200
     bgp router-id 5.5.5.5
     bgp log-neighbor-changes
     neighbor 4.4.4.4 remote-as 200
     neighbor 4.4.4.4 update-source Loopback0
     neighbor 6.6.6.6 remote-as 200
     neighbor 6.6.6.6 update-source Loopback0
    
    # R6
    router bgp 200
     bgp router-id 6.6.6.6
     bgp log-neighbor-changes
     neighbor 4.4.4.4 remote-as 200
     neighbor 4.4.4.4 update-source Loopback0
     neighbor 5.5.5.5 remote-as 200
     neighbor 5.5.5.5 update-source Loopback0
    
  2. 最后在 R2 和 R4,R3 和R5 之间连接 EBGP 的 Peer 关系。

# R2
R2(config)#router bgp 100
R2(config-router)#neighbor 24.1.1.4 remote-as 200

# R4
R4(config)#router bgp 200
R4(config-router)#neighbor 24.1.1.2 remote-as 100

# R3
R3(config)#router bgp 100
R3(config-router)#neighbor 35.1.1.5 remote-as 200

# R5
R5(config-router)#router bgp 200
R5(config-router)#neighbor 35.1.1.3 remote-as 100

在 R1 和 R6 将回环口的路由,宣告到 BGP 中

# R6
R6(config)#router bgp 200
R6(config-router)#network 10.6.6.6 mask 255.255.255.255
R6(config-router)#network 10.66.66.66 mask 255.255.255.255

# R1 查询 BGP 路由表,发现已经收到了 R6 的两条路由
R1#show ip bgp
BGP table version is 1, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
              t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i  10.6.6.6/32      3.3.3.3                  0    100      0 200 i
 *>i                   2.2.2.2                  0    100      0 200 i
 * i  10.66.66.66/32   3.3.3.3                  0    100      0 200 i
 *>i                   2.2.2.2                  0    100      0 200 i

 
 但可以发现,下一跳地址为 35.1.1.5 和  24.1.1.4 ,但由于当前路由表中,并没有该路由所以,ping 不同这两个网段。
 所以需要修改 next-hop
 
 # R2 将传给其他 IBGP 路由的 next-hop 修改为自己
R2(config)#router bgp 100
R2(config-router)#neighbor 1.1.1.1  next-hop-self
R2(config-router)#neighbor 3.3.3.3  next-hop-self

# R3 
R3(config)#router bgp 100
R3(config-router)#neighbor 1.1.1.1  next-hop-self
R3(config-router)#neighbor 2.2.2.2  next-hop-self

# 同样的问题也会在 R6 上出现,修改 R5 和 R4 的下一跳
R4(config)#router bgp 200
R4(config-router)#neighbor 5.5.5.5 next-hop-self
R4(config-router)#neighbor 6.6.6.6 next-hop-self
R5(config)#router bgp 200
R5(config-router)#neighbor 4.4.4.4 next-hop-self
R5(config-router)#neighbor 6.6.6.6 next-hop-self
R6#clear ip bgp in

# R6 ping
R6#ping 10.1.1.1 source lo10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 10.6.6.6
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

目前已经实现,R1 和 R6 的回环地址互通了。

调整 BGP 路径

先来分析下,目前 10.1.1.1 访问 10.6.6.6 的情况:

R1#traceroute 10.6.6.6 source 10.1.1.1
Type escape sequence to abort.
Tracing the route to 10.6.6.6
VRF info: (vrf in name/id, vrf out name/id)
  1 12.1.1.2 0 msec 1 msec 0 msec
  2 24.1.1.4 1 msec 1 msec 0 msec
  3 46.1.1.6 1 msec 1 msec *
# 发现出流量走:R1-R2-R4-R6,原因在于,根据之前 BGP 的选路原则 R2 比 R3 建立的连接时间长,所以走 R2。 R4 和 R5 同理。

R6#traceroute 10.1.1.1 source 10.6.6.6
Type escape sequence to abort.
Tracing the route to 10.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
  1 46.1.1.4 0 msec 0 msec 1 msec
  2 24.1.1.2 1 msec 0 msec 1 msec
  3 12.1.1.1 0 msec 1 msec *
# 发现 R6 到 R1:走 R6-R4-R1,同样 R4 比 R5 的连接时间长,所以走 R2.

需求1:让 10.1.1.1 访问 10.6.6.6 的流量走 R1-R3-R5-R6, 回程流量走 R6-R4-R2-R1.

通过调整 Local_preference 和 MED 实现

# Local_preference 影响出流量的路由
# 这里 locPrf 的值相等为100,我们想走 R3,只需将 3.3.3.3 的路由的 LocPrf 值调大。可以在 R1 的 in 方向做策略,或者 R3 的出方向做策略。
R1>show ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.1.1.1/32      0.0.0.0                  0         32768 i
 * i  10.6.6.6/32      3.3.3.3                  0    100      0 200 i
 *>i                   2.2.2.2                  0    100      0 200 i
 *>   10.11.11.11/32   0.0.0.0                  0         32768 i
 * i  10.66.66.66/32   3.3.3.3                  0    100      0 200 i
 *>i                   2.2.2.2                  0    100      0 200 i

# 前缀列表抓取流量
R1(config)#ip prefix-list net-10.6.pre permit 10.6.6.6
# route-map 设置策略,改变 local preference
R1(config)#route-map locpre.map permit 10
R1(config-route-map)#match ip address prefix-list net-10.6.pre
R1(config-route-map)#set local-preference 120

# 在 BGP 邻居调用
R1(config)#router bgp 100
R1(config-router)#neighbor 3.3.3.3 route-map locpre.map in

# 再次查看路由,发现走 3.3.3.3 网络
R1#show ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.1.1.1/32      0.0.0.0                  0         32768 i
 *>i  10.6.6.6/32      3.3.3.3                  0    120      0 200 i
 * i                   2.2.2.2                  0    100      0 200 i
 *>   10.11.11.11/32   0.0.0.0                  0         32768 i
 * i  10.66.66.66/32   3.3.3.3                  0    100      0 200 i
 *>i                   2.2.2.2                  0    100      0 200 i
# 修改 MED(Metric),影响进入的路由
# 原来回包走 R2, 虽然现在也走 R2,但是通过第 11 个路径匹配规则选择的,所以想将优先级提前。
# 在 R3 上,配置使其发给其他 AS 路由的 Metric 比 R2 小。
# 抓取
R3(config)#ip prefix-list net-1.1.pre permit 10.1.1.1/32 
# 编写 route-map 策略
R3(config-route-map)#route-m med.map permit 10
R3(config-route-map)#match ip address  net-1.1.pre
R3(config-route-map)#set metric 10
R3(config-route-map)#route-m med.map permit 20
# 应用策略
R3(config)#router bgp 100
R3(config-router)#neighbor 35.1.1.5 route-map med.map out

# 这里模拟器出现了 bug,将 10.11 网络的 metric 也变成了 10,可以使用 acl 匹配
R3(config-route-map)#access-list 1 permit 10.1.1.1 0.0.0.0
R3(config-route-map)#route-map  med.map permit 10
R3(config-route-map)#match ip address 1

需求2:让 10.11.11.11 访问 10.66.66.66 的流量走 R1-R2-R4-R6, 回程流量走 R6-R5-R3-R1.

通过调整 weight 和 AS_PATH 实现

# 通过调整 Weight ,可以影响本路由器发出流量的路由路径
# 这里可以在 R2 上进行路由策略,控制发给 R1 的路由 weight
# 也可以在 R1 上进行路由策略,控制接收 R2 的路由 weight.
# 目前去往 66 网络,走 2.2.2.2,原因在于选路的比较原则 11. 现在通过调整 weight,提高优先级,还走 2.2.2.2.
R1#show ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.1.1.2/32      0.0.0.0                  0         32768 i
 * i  10.6.6.6/32      2.2.2.2                  0    100      0 200 i
 *>i                   3.3.3.3                  0    120      0 200 i
 *>   10.11.11.11/32   0.0.0.0                  0         32768 i
 *>i  10.66.66.66/32   2.2.2.2                  0    100      0 200 i
 * i                   3.3.3.3                  0    100      0 200 i
R1(config)#ip access-list standard weight.acl
R1(config-std-nacl)#permit 10.6.6.6 0.0.0.0
R1(config-std-nacl)#exit
R1(config)#route-map weight.map permit 10
R1(config-route-map)#match ip address  weight.acl
R1(config-route-map)#set weight 30
R1(config-route-map)#exit
R1(config)#route-map weight.map permit 20
R1(config-route-map)#exit
R1(config)#router bgp 100
R1(config-router)#neighbor 2.2.2.2 route-map weight.map in

# 可以看到 weight 变为 30
R1#show ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.1.1.1/32      0.0.0.0                  0         32768 i
 *>i  10.6.6.6/32      2.2.2.2                  0    100     30 200 i
 * i                   3.3.3.3                  0    120      0 200 i
 *>   10.11.11.11/32   0.0.0.0                  0         32768 i
 *>i  10.66.66.66/32   2.2.2.2                  0    100      0 200 i
 * i                   3.3.3.3                  0    100      0 200 i
# 调整 AS_PATH, 对于 R6 来说,对于 AS_PATH 会优先选择短的。
# 所以在 R2 上,增加 AS_PATH 的长度。让 R6 选择 R3 传来的。
R6>show ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>i  10.1.1.1/32      4.4.4.4                  0    100      0 100 i
 *>   10.6.6.6/32      0.0.0.0                  0         32768 i
 *>i  10.11.11.11/32   4.4.4.4                  0    100      0 100 i
 * i                   5.5.5.5                  0    100      0 100 i
 *>   10.66.66.66/32   0.0.0.0                  0         32768 i

# 抓取 10.11.11.11 的流量
R2(config)#access-list 1 permit 10.11.11.11 0.0.0.0
# 改变发布给其他 router 的 as path
R2(config)#route-map as.map permit 10
R2(config-route-map)#match ip address 1
# 这里添加两个 100 是比较好的做法。添加其他 AS 也可以,比如 300,但假设 300 真的存在,由于 BGP 的规则,可能会被丢弃。
R2(config-route-map)#set as-path prepend 100 100
R2(config-route-map)#exit
R2(config)#route-map as.map permit 20
R2(config)#router bgp 100
R2(config-router)#neighbor 24.1.1.4 route-map as.map out

# 可以看到 R4 学到的 10.11.11.11 的路由 AS PATH 为 100 100 100
R4>show ip bgp
BGP table version is 11, local router ID is 4.4.4.4
     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.1.1.2/32      24.1.1.2                               0 100 i
 *>i  10.6.6.6/32      6.6.6.6                  0    100      0 i
 *    10.11.11.11/32   24.1.1.2                               0 100 100 100 i
 *>i                   5.5.5.5                  0    100      0 100 i
 *>i  10.66.66.66/32   6.6.6.6                  0    100      0 i

实验3:BGP 路由聚合

预配:

R1,R2 配置相关接口
R1,R2,R3,R4 配置不同 AS,并建立 BGP Peer.

# 配置完后,查看 R3 BGP 路由表
R3#show ip bgp

     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.1.0.0/24      13.1.1.1                 0             0 100 i
 *>   10.1.1.0/24      13.1.1.1                 0             0 100 i
 *>   10.1.2.0/24      13.1.1.1                 0             0 100 i
 *>   10.1.3.0/24      13.1.1.1                 0             0 100 i
 *>   20.1.0.0/24      23.1.1.2                 0             0 200 i
 *>   20.1.1.0/24      23.1.1.2                 0             0 200 i
 *>   20.1.2.0/24      23.1.1.2                 0             0 200 i
 *>   20.1.3.0/24      23.1.1.2                 0             0 200 i
 *>   100.1.0.0/24     13.1.1.1                 0             0 100 i
 *>   100.1.1.0/24     13.1.1.1                 0             0 100 i
 *>   100.1.2.0/24     23.1.1.2                 0             0 200 i
 *>   100.1.3.0/24     23.1.1.2                 0             0 200 i

方法一:手动聚合

在 R3 上,将 R1 和 R2 100.0 网络的路由进行聚合:

# 配置 NULL0 接口,避免路由环路。
ip route 100.1.0.0 255.255.252.0 Null0

# 宣告汇总网络
R3(config)#router bgp 300
R3(config-router)#network 100.1.0.0 mask 255.255.252.0

# 在 R4 上查看, 可以看到多出了  10.1.0.0/22 的路由
R4>show ip route
      100.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
B        100.1.0.0/22 [20/0] via 34.1.1.3, 00:00:11
B        100.1.0.0/24 [20/0] via 34.1.1.3, 00:00:11
B        100.1.1.0/24 [20/0] via 34.1.1.3, 00:00:11
B        100.1.2.0/24 [20/0] via 34.1.1.3, 00:00:11
B        100.1.3.0/24 [20/0] via 34.1.1.3, 00:00:11

# 因为聚合的路由已经存在了,最好去除明细路由
# 抓取 prefix
ip prefix-list deny100.pre seq 5 permit 100.1.0.0/24
ip prefix-list deny100.pre seq 10 permit 100.1.1.0/24
ip prefix-list deny100.pre seq 15 permit 100.1.2.0/24
ip prefix-list deny100.pre seq 20 permit 100.1.3.0/24
# route--map deny
route-map d100.map deny 10
match ip address prefix-list deny100.pre
route-map d100.map permit 20

配置 NULL0 的作用:假设有另一个 ISP 网络,并将 10.0/16 网络分给了 R3,假设 R3 上连接了一个 ISP 的网络,并配置了一条默认路由,将流量指向 ISP 的接口,此时 R3 的一个接口 down 了,但发给此接口的流量不会丢弃,会走默认路由发给 ISP, 但由于 ISP 分给 R3 的网络的 10.0/16 会再把路由传回来,从而形成环路,直到 TTL 达到 255

方法二:BGP 自动汇总

# 使用 BGP 自动汇总
R3(config)#router bgp 300
R3(config-router)#aggregate-address 100.1.0.0 255.255.252.0
# 查看 R3 路由表,同样多出一条 NULL 接口
      100.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
B        100.1.0.0/22 [200/0], 00:00:16, Null0
B        100.1.0.0/24 [20/0] via 13.1.1.1, 01:13:12
B        100.1.1.0/24 [20/0] via 13.1.1.1, 01:13:12
B        100.1.2.0/24 [20/0] via 23.1.1.2, 01:02:29
B        100.1.3.0/24 [20/0] via 23.1.1.2, 01:02:29

# 在 R4 查看
R4>show ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.1.0.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.1.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.2.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.3.0/24      34.1.1.3                               0 300 100 i
 *>   20.1.0.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.1.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.2.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.3.0/24      34.1.1.3                               0 300 200 i
 *>   100.1.0.0/24     34.1.1.3                               0 300 100 i
 *>   100.1.0.0/22     34.1.1.3                 0             0 300 i
 *>   100.1.1.0/24     34.1.1.3                               0 300 100 i
 *>   100.1.2.0/24     34.1.1.3                               0 300 200 i
 *>   100.1.3.0/24     34.1.1.3                               0 300 200 i
# 在 R4 查看被聚合后的路由 
R4>show ip bgp 100.1.0.0/22
BGP routing table entry for 100.1.0.0/22, version 113
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 13
  300, (aggregated by 300 3.3.3.3) # 聚合者属性
    34.1.1.3 from 34.1.1.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, external, atomic-aggregate, best # atomic-aggregate 原子聚合属性
      rx pathid: 0, tx pathid: 0x0

将聚合后的路由 100.1.0.0/22 还原, 原来的 AS_PATH:

# 在 R4 上查看 100.1.0.0/22 的 AS_PATH, 是 300,
# 但始发者是 AS 100 和 200. 所以这里最好加上属性,防止未来可能产生的环路
R3(config)#router bgp 300
# 添加 as-set 属性,表示打开记录之前始发 as 的路径
R3(config-router)#aggregate-address 100.1.0.0 255.255.252.0 as-set

# 在 R4 上查看
R4>show ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.1.0.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.1.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.2.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.3.0/24      34.1.1.3                               0 300 100 i
 *>   20.1.0.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.1.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.2.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.3.0/24      34.1.1.3                               0 300 200 i
 *>   100.1.0.0/24     34.1.1.3                               0 300 100 i
  # 这里的 {100,200} 表示始发是由 AS 100 和 200 聚合而来,并且没有先后顺序
 *>   100.1.0.0/22     34.1.1.3                 0             0 300 {100,200} i 
 *>   100.1.1.0/24     34.1.1.3                               0 300 100 i
 *>   100.1.2.0/24     34.1.1.3                               0 300 200 i
 *>   100.1.3.0/24     34.1.1.3                               0 300 200 i
# 仅发送汇总路由给 R4
R3(config)#router bgp 300
 R3(config-router)#aggregate-address 100.1.0.0 255.255.252.0 summary-only
 
 # 在 R4上,仅有汇总路由,没有明细路由
R4>show ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.1.0.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.1.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.2.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.3.0/24      34.1.1.3                               0 300 100 i
 *>   20.1.0.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.1.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.2.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.3.0/24      34.1.1.3                               0 300 200 i
 *>   100.1.0.0/22     34.1.1.3                 0             0 300 i

在 R1 上配置 community 属性,查看 R3 在聚合后,R4 是否聚合 community 属性:

# R1 配置 route-map,设置 community 属性
R3(config)#route-map bgp_comm.map permit 10
R3(config)#match ip address 1
R3(config)#set community 100
R3(config)#route-map bgp_comm.map permit 20

# bgp 应用 route-map,并打开 send-community
R3(config)#router bgp 100
R3(config)# neighbor 13.1.1.3 send-community
R3(config)# neighbor 13.1.1.3 route-map bgp_comm.map out

# R3 同样设置 send-community:
router bgp 300
 aggregate-address 100.1.0.0 255.255.252.0 as-set summary-only
 neighbor 34.1.1.4 send-community

# R4 查看发现,有 community 属性
R4#show ip bgp 100.1.0.0/22
BGP routing table entry for 100.1.0.0/22, version 120
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 14
  300 {100,200}, (aggregated by 300 3.3.3.3)
    34.1.1.3 from 34.1.1.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Community: 100 # 有该属性
      rx pathid: 0, tx pathid: 0x0

# 同样如果在 R2 上配置,不同的 community 为 200,同样也会传递到 R4 中。

可以发现,如果聚合前路由含有 community 的属性,在聚合后也会含有 community 属性,但需要开启 as-set 和 send-community

通过 suppress-map 选择通告部分明细路由:

# 通过 route-map 抓取,想要抑制的网段
R3(config)#access-list 10 permit 10.1.2.0 0.0.0.0
R3(config)#route-map supressed.map permit 10
R3(config-route-map)#match ip address 10

# 在 BGP 上调用,通过 aggregate-address 宣告聚合后的网段,通过 as-set 保留该网段的起始发布者,通过 suppress-map 抑制匹配的路由发送
R3(config-router)#aggregate-address 10.1.0.0 255.255.252.0 as-set suppress-map supressed.map

R3#show ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.1.0.0/24      13.1.1.1                 0             0 100 i
 *>   10.1.0.0/22      0.0.0.0                       100  32768 100 i
 *>   10.1.1.0/24      13.1.1.1                 0             0 100 i
 s>   10.1.2.0/24      13.1.1.1                 0             0 100 i
 *>   10.1.3.0/24      13.1.1.1                 0             0 100 i
 *>   20.1.0.0/24      23.1.1.2                 0             0 200 i
 *>   20.1.1.0/24      23.1.1.2                 0             0 200 i
 *>   20.1.2.0/24      23.1.1.2                 0             0 200 i
 *>   20.1.3.0/24      23.1.1.2                 0             0 200 i
 s>   100.1.0.0/24     13.1.1.1                 0             0 100 i # 发现该网段被抑制
 *>   100.1.0.0/22     0.0.0.0                       100  32768 {100,200} i
 s>   100.1.1.0/24     13.1.1.1                 0             0 100 i
 s>   100.1.2.0/24     23.1.1.2                 0             0 200 i
 s>   100.1.3.0/24     23.1.1.2                 0             0 200 i


# 在 R4 上查看,发现后汇总的路由 10.1.0.0/22 ,未汇总的路由  10.1.0.0/24, 10.1.1.0/24,10.1.3.0/24 
# 没有 10.1.2.0/24 ,说明被抑制
R4>show ip bgp

     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.1.0.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.0.0/22      34.1.1.3                 0             0 300 100 i
 *>   10.1.1.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.3.0/24      34.1.1.3                               0 300 100 i
 *>   20.1.0.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.1.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.2.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.3.0/24      34.1.1.3                               0 300 200 i
 *>   100.1.0.0/22     34.1.1.3                 0             0 300 {100,200} i

修改汇总后的 BGP 属性,比如修改 origin 属性:

# 设置要修改网段的属性
R3(config)#ip prefix-list att.pre permit 100.1.0.0/22
R3(config)#route-map att.map permit 10
R3(config-route-map)#match ip address att.pre
R3(config-route-map)#set origin incomplete

# 通过设置 attribute-map 修改属性
R3(config)#router bgp
R3(config)#router bgp 300
R3(config-router)#aggregate-address 100.1.0.0 255.255.252.0 summary-only attribute-map att.map

# 在 R4 查看 origin 变成 ?
R4>show ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.1.0.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.0.0/22      34.1.1.3                 0             0 300 100 i
 *>   10.1.1.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.3.0/24      34.1.1.3                               0 300 100 i
 *>   20.1.0.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.1.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.2.0/24      34.1.1.3                               0 300 200 i
 *>   20.1.3.0/24      34.1.1.3                               0 300 200 i
 *>   100.1.0.0/22     34.1.1.3                 0             0 300 ?     # 变成 ?

通过 advertise-map,宣告保留传递的明细路由的属性

# 在 R1 上增加  20.1.4.0/24 的网段,并通告给 bgp
# 在 R3 聚合 20 网段的路由,并通过 summary-only 仅通告汇总后的路由,并且让 R4 收到的汇总路由仅包含 R1 通告网络的 BGP 的属性
# 就可以使用 advertise-map

R3(config)#access-list 5 permit 20.1.4.0
R3(config)#route-map adv.map permit 10
R3(config-route-map)#match ip address 5
 
R3(config)#router bgp 300
R3(config-router)# aggregate-address 20.1.0.0 255.255.0.0 as-set summary-only advertise-map adv.map

# R4 上汇总后的路由,仅保留 advtise 上的属性
R4#show ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.1.0.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.0.0/22      34.1.1.3                 0             0 300 100 i
 *>   10.1.1.0/24      34.1.1.3                               0 300 100 i
 *>   10.1.3.0/24      34.1.1.3                               0 300 100 i
 *>   20.1.0.0/16      34.1.1.3                 0             0 300 100 i # as=200 被抑制了 
 *>   100.1.0.0/22     34.1.1.3                 0             0 300 ?

参考

BGP-NULL0

IBGP和EBGP 的区别

posted @ 2020-10-20 15:39  来份锅包肉  阅读(3313)  评论(0编辑  收藏  举报