实验14 BGP路由聚合与反射

实验任务一:配置BGP路由反射器

  1. 建立物理连接

  2. RTA和RTB建立EBGP对等体,RTC分别和RTB,RTD建立IBGP对等体,
    [RTD]ip route-static 2.2.2.2 32 10.0.0.9
    [RTD]ip route-static 3.3.3.3 32 10.0.0.9

[RTC]ip route-static 2.2.2.2 32 10.0.0.5
[RTC]ip route-static 4.4.4.4 32 10.0.0.10

[RTB]ip route-static 3.3.3.3 32 10.0.0.6
[RTB]ip route-static 4.4.4.4 32 10.0.0.6

[RTA]bgp 100
[RTA-bgp-default]peer 10.0.0.2 as-number 200
[RTA-bgp-default]address-family ipv4
[RTA-bgp-default-ipv4]peer 10.0.0.2 enable
[RTA-bgp-default-ipv4]import-route direct

[RTB-LoopBack0]bgp 200
[RTB-bgp-default]peer 10.0.0.1 as-number 100
[RTB-bgp-default]address-family ipv4
[RTB-bgp-default-ipv4]peer 10.0.0.1 enable
[RTB-bgp-default]peer 3.3.3.3 as-number 200
[RTB-bgp-default]address-family ipv4
[RTB-bgp-default-ipv4]peer 3.3.3.3 enable
[RTB-bgp-default-ipv4]peer 3.3.3.3 next-hop-local
[RTB-bgp-default-ipv4]import-route direct

[RTC]bgp 200
[RTC-bgp-default]peer 2.2.2.2 as-number 200
[RTC-bgp-default]peer 4.4.4.4 as-number 200
[RTC-bgp-default]peer 2.2.2.2 connect-interface LoopBack 0
[RTC-bgp-default]peer 4.4.4.4 connect-interface LoopBack 0
[RTC-bgp-default]address-family ipv4
[RTC-bgp-default-ipv4]peer 2.2.2.2 enable
[RTC-bgp-default-ipv4]peer 4.4.4.4 enable
[RTC-bgp-default-ipv4]import-route direct

[RTD]bgp 200
[RTD-bgp-default]peer 3.3.3.3 as-number 200
[RTD-bgp-default]peer 3.3.3.3 connect-interface LoopBack 0
[RTD-bgp-default]address-family ipv4
[RTD-bgp-default-ipv4]peer 3.3.3.3 enable
[RTD-bgp-default-ipv4]import-route direct
3. 查看RTC和RTD的路由
[RTC-bgp-default-ipv4]display ip routing-table

Destinations : 21 Routes : 21

Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.1/32 BGP 255 0 2.2.2.2 GE0/0
2.2.2.2/32 Static 60 0 10.0.0.5 GE0/0
3.3.3.3/32 Direct 0 0 127.0.0.1 InLoop0
4.4.4.4/32 Static 60 0 10.0.0.10 GE0/1
10.0.0.0/30 BGP 255 0 2.2.2.2 GE0/0
10.0.0.4/30 Direct 0 0 10.0.0.6 GE0/0
10.0.0.4/32 Direct 0 0 10.0.0.6 GE0/0
10.0.0.6/32 Direct 0 0 127.0.0.1 InLoop0
10.0.0.7/32 Direct 0 0 10.0.0.6 GE0/0
10.0.0.8/30 Direct 0 0 10.0.0.9 GE0/1
10.0.0.8/32 Direct 0 0 10.0.0.9 GE0/1
10.0.0.9/32 Direct 0 0 127.0.0.1 InLoop0
10.0.0.11/32 Direct 0 0 10.0.0.9 GE0/1
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

[RTD-bgp-default-ipv4]display ip routing-table

Destinations : 16 Routes : 16

Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.2/32 Static 60 0 10.0.0.9 GE0/0
3.3.3.3/32 Static 60 0 10.0.0.9 GE0/0
4.4.4.4/32 Direct 0 0 127.0.0.1 InLoop0
10.0.0.4/30 BGP 255 0 3.3.3.3 GE0/0
10.0.0.8/30 Direct 0 0 10.0.0.10 GE0/0
10.0.0.8/32 Direct 0 0 10.0.0.10 GE0/0
10.0.0.10/32 Direct 0 0 127.0.0.1 InLoop0
10.0.0.11/32 Direct 0 0 10.0.0.10 GE0/0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

[RTD4]display bgp routing-table ipv4

Total number of routes: 6

BGP local router ID is 4.4.4.4
Status codes: * - valid, > - best, d - dampened, h - history
s - suppressed, S - stale, i - internal, e - external
a - additional-path
Origin: i - IGP, e - EGP, ? - incomplete

 Network            NextHop         MED        LocPrf     PrefVal Path/Ogn
  • i 3.3.3.3/32 3.3.3.3 0 100 0 ?

  • 4.4.4.4/32 127.0.0.1 0 32768 ?

  • i 10.0.0.4/30 3.3.3.3 0 100 0 ?

  • 10.0.0.8/30 10.0.0.10 0 32768 ?

  • i 3.3.3.3 0 100 0 ?
  • 10.0.0.10/32 127.0.0.1 0 32768 ?
    可以看出RTD不能学习到RTA的路由。RTC可以学习RTA的路由1.1.1.1/32
    原因:
    1.从ebgp对等体学习路由,发送给ibgp邻居时,不改变下一跳,RTC因为修改了下一跳为ibgp对等体,所以RTC才有了1.1.1.1/32的路由。
    2.从ibgp对等体学习路由,不发送给其他ibgp邻居,所以RTD不存在1.1.1.1/32的路由。

解决RTD不能学习RTB路由方法:
方法1:建立IBGP全连接
方法2:配置BGP反射
[RTC]bgp 200
[RTC-bgp-default]address-family ipv4
[RTC-bgp-default-ipv4]peer 2.2.2.2 reflect-client
[RTC-bgp-default-ipv4]peer 4.4.4.4 reflect-client

display ip routing-table

Destinations : 18 Routes : 18

Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.1/32 BGP 255 0 2.2.2.2 GE0/0
2.2.2.2/32 Static 60 0 10.0.0.9 GE0/0
3.3.3.3/32 Static 60 0 10.0.0.9 GE0/0
4.4.4.4/32 Direct 0 0 127.0.0.1 InLoop0
10.0.0.0/30 BGP 255 0 2.2.2.2 GE0/0
10.0.0.4/30 BGP 255 0 3.3.3.3 GE0/0
10.0.0.8/30 Direct 0 0 10.0.0.10 GE0/0
10.0.0.8/32 Direct 0 0 10.0.0.10 GE0/0
10.0.0.10/32 Direct 0 0 127.0.0.1 InLoop0
10.0.0.11/32 Direct 0 0 10.0.0.10 GE0/0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

实验任务二:BGP路由聚合
1.查看RTA路由表
[RTA]display ip routing-table

Destinations : 18 Routes : 18

Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.2/32 BGP 255 0 10.0.0.2 GE0/0
3.3.3.3/32 BGP 255 0 10.0.0.2 GE0/0
4.4.4.4/32 BGP 255 0 10.0.0.2 GE0/0
10.0.0.0/30 Direct 0 0 10.0.0.1 GE0/0
10.0.0.0/32 Direct 0 0 10.0.0.1 GE0/0
10.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
10.0.0.3/32 Direct 0 0 10.0.0.1 GE0/0
10.0.0.4/30 BGP 255 0 10.0.0.2 GE0/0
10.0.0.8/30 BGP 255 0 10.0.0.2 GE0/0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
2.配置自动聚合
[RTB-bgp-default-ipv4]summary automatic
[RTA-bgp-default-ipv4]display ip routing-table

Destinations : 19 Routes : 19

Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
2.0.0.0/8 BGP 255 0 10.0.0.2 GE0/0
3.3.3.3/32 BGP 255 0 10.0.0.2 GE0/0
4.4.4.4/32 BGP 255 0 10.0.0.2 GE0/0
10.0.0.0/8 BGP 255 0 10.0.0.2 GE0/0
10.0.0.0/30 Direct 0 0 10.0.0.1 GE0/0
10.0.0.0/32 Direct 0 0 10.0.0.1 GE0/0
10.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
10.0.0.3/32 Direct 0 0 10.0.0.1 GE0/0
10.0.0.4/30 BGP 255 0 10.0.0.2 GE0/0
10.0.0.8/30 BGP 255 0 10.0.0.2 GE0/0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

[RTA]display bgp routing-table ipv4

Total number of routes: 9

BGP local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - dampened, h - history
s - suppressed, S - stale, i - internal, e - external
a - additional-path
Origin: i - IGP, e - EGP, ? - incomplete

 Network            NextHop         MED        LocPrf     PrefVal Path/Ogn
  • 1.1.1.1/32 127.0.0.1 0 32768 ?

  • e 2.0.0.0 10.0.0.2 0 0 200?

  • e 3.3.3.3/32 10.0.0.2 0 200?

  • e 4.4.4.4/32 10.0.0.2 0 200?

  • e 10.0.0.0 10.0.0.2 0 0 200?

  • 10.0.0.0/30 10.0.0.1 0 32768 ?

  • 10.0.0.1/32 127.0.0.1 0 32768 ?

  • e 10.0.0.4/30 10.0.0.2 0 200?

  • e 10.0.0.8/30 10.0.0.2 0 200?

[RTB-bgp-default-ipv4]aggregate 10.0.0.0 7 detail-suppressed//抑制路由
[RTB-bgp-default-ipv4]display bgp routing-table ipv4

Total number of routes: 9

BGP local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - dampened, h - history
s - suppressed, S - stale, i - internal, e - external
a - additional-path
Origin: i - IGP, e - EGP, ? - incomplete

 Network            NextHop         MED        LocPrf     PrefVal Path/Ogn
  • e 1.1.1.1/32 10.0.0.1 0 0 100?

  • 2.0.0.0 127.0.0.1 0 32768 ?

  • i 3.3.3.3/32 3.3.3.3 0 100 0 ?

  • i 4.4.4.4/32 4.4.4.4 0 100 0 ?

  • 10.0.0.0/7 127.0.0.1 32768 ?
    s > 10.0.0.0 127.0.0.1 0 32768 ?
    s >e 10.0.0.0/30 10.0.0.1 0 0 100?
    s >i 10.0.0.4/30 3.3.3.3 0 100 0 ?
    s >i 10.0.0.8/30 3.3.3.3 0 100 0 ?
    综上所述:

  1. 配置summary automatic命令后,BGP将对通过import-route命令引入的IGP子网路由进行聚合,从而减少路由信息的数量。且BGP发过来的路由信息没有掩码。
  2. 自动聚合生成的路由可以参与手动聚合。且抑制路由前面有个s标记。

[RTB-bgp-default-ipv4]aggregate 10.0.0.0 28 detail-suppressed//抑制具体路由

[RTA-bgp-default-ipv4]display ip routing-table

Destinations : 17 Routes : 17

Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.2/32 BGP 255 0 10.0.0.2 GE0/0
3.3.3.3/32 BGP 255 0 10.0.0.2 GE0/0
4.4.4.4/32 BGP 255 0 10.0.0.2 GE0/0
10.0.0.0/28 BGP 255 0 10.0.0.2 GE0/0
10.0.0.0/30 Direct 0 0 10.0.0.1 GE0/0
10.0.0.0/32 Direct 0 0 10.0.0.1 GE0/0
10.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
10.0.0.3/32 Direct 0 0 10.0.0.1 GE0/0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

1.如果参与聚合的具体路由所包含的Origin属性不同,那么聚合路由按照Incomplete、EGP、IGP的顺序选择Origin属性。例如,存在Origin属性为Incomplete和IGP的具体路由时,聚合路由的Origin属性为Incomplete。
2.如果参与聚合的具体路由包含不同的团体属性(或扩展团体属性)值,且聚合后的路由中不包含ATOMIC_AGGREGATE属性(原子聚合属性),则生成的聚合路由的团体属性(或扩展团体属性)中携带所有的团体属性(或扩展团体属性)值。
3.对比自动聚合,手动聚合路由后面有掩码,自动没有掩码。

posted @ 2019-07-07 22:13  Akiz  阅读(926)  评论(0编辑  收藏  举报