• BGP协议下的路由聚合、路由反射器、联邦的具体配置与运用(详解)


           想要了解BGP协议下的路由聚合、路由反射器、联邦的具体命令配置,需要5通过如下的小实验来模拟现实网络环境来了解与掌握BGP协议。

     要求:1、AS1存在两个环回,一个IP地址为192.168.1.0/24该地址不能在任何协议中宣告

                     AS3中存在两个环回,一个IP地址为192.168.2.0/24该地址不能在任何协议中宣告,最终要求这两个环回可以互相通讯

                     AS1的另一个环回为10.0.0.0/24,AS3的另一个环回为11.0.0.0/24

               2、整个AS2的IP地址为172.16.0.0/16,请合理划分

               3、AS间的骨干链路IP地址随意定制

               4、使用BGP协议让整个网络的环回可以互相访问

               5、减少路由条目数量,避免环回出现

    目录

    一、首先给AS2区域根据172.16.0.0/16网段进行合理划分

    二、按照划分的网段对路由器的接口进行IP地址的配置

    (1)R1

    (2)R2

    (3)R3

    (4)R4

    (5)R5

    (6)R6

    (7)R7

    (8)R8

    三、在每个路由器上配置ospf协议

    (1)R1

    (2)R2

    (3)R3

    (4)R4

    (5)R5

    (6)R6

    (7)R7 

    (8)R8

    四、对路由器进行BGP边界网关协议的配置

    (1)R1与R2之间进行EBGP的建立

    (2)R7与R8之间进行EBGP的建立

    (3)AS2区域中64512内R/2/3/4之间建立联邦

    (4)AS2区域中64513内的R/5/6/7之间建立联邦

    (5)R2与R5之间建立EBGP邻居关系

    (6)R4与R7之间建立EBGP邻居关系

    (7)R2与R5之间,R4与R7之间建立EBGP关系后还需修改TTL值

    五、路由反射器

    在R3与R6上配置路由反射器用来打破IBGP的水平分割

    六、整个网络的环回可以互相访问

    七、创建虚拟隧道

    (1)对R1

    (2)对R8

    (3)此时便可使R1与R8的另外两个环回互相访问


    一、首先给AS2区域根据172.16.0.0/16网段进行合理划分

    172.16.0.0/18-----AS 64512                                    172.16.64.0/18----AS 64513

           172.16.0.0/21                                                         172.16.64.0/21

           172.16.8.0/21                                                         172.16.72.0/21

           172.16.16.0/21                                                       172.16.80.0/21

           172.16.24.0/21                                                       172.16.88.0/21

           172.16.32.0/21                                                       172.16.96.0/21

           172.16.40.0/21                                                       172.16.104.0/21

           172.16.48.0/21                                                       172.16.112.0/21

           172.16.56.0/21                                                       172.16.120.0/21

           172.16.128.0/18----骨干一

           172.16.192.0/18----骨干二

    二、按照划分的网段对路由器的接口进行IP地址的配置

    (1)R1

    1. [R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
    2. [R1-LoopBack0]ip add 192.168.1.1 24
    3. [R1-LoopBack1]ip add 10.0.0.1 24

    (2)R2

    1. [R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
    2. [R2-GigabitEthernet0/0/1]ip add 172.16.0.1 21
    3. [R2-GigabitEthernet0/0/2]ip add 172.16.128.1 18

    (3)R3

    1. [R3-GigabitEthernet0/0/0]ip add 172.16.0.2 21
    2. [R3-GigabitEthernet0/0/1]ip add 172.16.8.1 21
    3. [R3-LoopBack0]ip add 172.16.24.1 21

    (4)R4

    1. [R4-GigabitEthernet0/0/0]ip add 172.16.8.2 21
    2. [R4-GigabitEthernet0/0/1]ip add 172.16.192.1 18
    3. [R4-LoopBack0]ip add 172.16.32.1 21

    (5)R5

    1. [R5-GigabitEthernet0/0/0]ip add 172.16.128.2 18
    2. [R5-GigabitEthernet0/0/1]ip add 172.16.64.1 21
    3. [R5-LoopBack0]ip add 172.16.80.1 21

    (6)R6

    1. [R6-GigabitEthernet0/0/0]ip add 172.16.64.2 21
    2. [R6-GigabitEthernet0/0/1]ip add 172.16.72.1 21
    3. [R6-LoopBack0]ip add 172.16.88.1 21

    (7)R7

    1. [R7-GigabitEthernet0/0/0]ip add 172.16.72.2 21
    2. [R7-GigabitEthernet0/0/1]ip add 172.16.192.2 21
    3. [R7-GigabitEthernet0/0/2]ip add 78.0.0.1 24
    4. [R7-LoopBack0]ip add 172.16.96.1 21

    (8)R8

    1. [R8-GigabitEthernet0/0/0]ip add 78.0.0.2 24
    2. [R8-LoopBack0]ip add 192.168.2.1 24
    3. [R8-LoopBack1]ip add 11.0.0.1 24

    三、在每个路由器上配置ospf协议

    (1)R1

    1. [R1]ospf 1 router-id 1.1.1.1
    2. [R1-ospf-1]a 0
    3. [R1-ospf-1-area-0.0.0.0]network 10.0.0.1 0.0.0.0
    4. [R1-ospf-1-area-0.0.0.0]network 12.0.0.1 0.0.0.0

    (2)R2

    1. [R2]ospf 1 router-id 2.2.2.2
    2. [R2-ospf-1-area-0.0.0.0]network 12.0.0.2 0.0.0.0
    3. [R2-ospf-1-area-0.0.0.0]network 172.16.0.1 0.0.0.0
    4. [R2-ospf-1-area-0.0.0.0]network 172.16.16.1 0.0.0.0
    5. [R2-ospf-1-area-0.0.0.0]network 172.16.128.1 0.0.0.0

    (3)R3

    1. [R3]ospf 1 router-id 3.3.3.3
    2. [R3-ospf-1]a 0
    3. [R3-ospf-1-area-0.0.0.0]network 172.16.0.2 0.0.0.0
    4. [R3-ospf-1-area-0.0.0.0]network 172.16.24.1 0.0.0.0
    5. [R3-ospf-1-area-0.0.0.0]network 172.16.8.1 0.0.0.0

    (4)R4

    1. [R4]ospf 1 router-id 4.4.4.4
    2. [R4-ospf-1]a 0
    3. [R4-ospf-1-area-0.0.0.0]network 172.16.8.2 0.0.0.0
    4. [R4-ospf-1-area-0.0.0.0]network 172.16.32.1 0.0.0.0
    5. [R4-ospf-1-area-0.0.0.0]network 172.16.192.1 0.0.0.0

    (5)R5

    1. [R5]ospf 1 router-id 5.5.5.5
    2. [R5-ospf-1]a 0
    3. [R5-ospf-1-area-0.0.0.0]network 172.16.128.2 0.0.0.0
    4. [R5-ospf-1-area-0.0.0.0]network 172.16.64.1 0.0.0.0
    5. [R5-ospf-1-area-0.0.0.0]network 172.16.80.1 0.0.0.0

    (6)R6

    1. [R6]ospf 1 router-id 6.6.6.6
    2. [R6-ospf-1]a 0
    3. [R6-ospf-1-area-0.0.0.0]network 172.16.64.2 0.0.0.0
    4. [R6-ospf-1-area-0.0.0.0]network 172.16.72.1 0.0.0.0
    5. [R6-ospf-1-area-0.0.0.0]network 172.16.88.1 0.0.0.0

    (7)R7 

    1. [R7]ospf 1 router-id 7.7.7.7
    2. [R7-ospf-1]a 0
    3. [R7-ospf-1-area-0.0.0.0]network 172.16.72.2 0.0.0.0
    4. [R7-ospf-1-area-0.0.0.0]network 172.16.96.1 0.0.0.0
    5. [R7-ospf-1-area-0.0.0.0]network 78.0.0.1 0.0.0.0

    (8)R8

    1. [R8]ospf 1 router-id 8.8.8.8
    2. [R8-ospf-1]a 0
    3. [R8-ospf-1-area-0.0.0.0]network 78.0.0.2 0.0.0.0
    4. [R8-ospf-1-area-0.0.0.0]network 11.0.0.1 0.0.0.0

    四、对路由器进行BGP边界网关协议的配置

    (1)R1与R2之间进行EBGP的建立

    1. [R1]bgp 1
    2. [R1-bgp]router-id 1.1.1.1
    3. [R1-bgp]peer 12.0.0.2 as-number 2
    4. [R1-bgp]
    5. Oct 15 2022 19:06:40-08:00 R1 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
    6. peer 12.0.0.2 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, St
    7. ateChangeReason=Up)
    8. [R2]bgp 64512
    9. [R2-bgp]peer 12.0.0.1 as-number 1
    10. [R2-bgp]
    11. Oct 15 2022 20:00:57-08:00 R2 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
    12. peer 12.0.0.1 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, St
    13. ateChangeReason=Up)

    (2)R7与R8之间进行EBGP的建立

    1. [R7]bgp 2
    2. [R7-bgp]router-id 7.7.7.7
    3. [R7-bgp]peer 78.0.0.2 as-number 3
    4. [R7-bgp]
    5. Oct 15 2022 20:02:38-08:00 R7 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
    6. peer 78.0.0.2 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, St
    7. ateChangeReason=Up)
    8. [R8]bgp 3
    9. [R8-bgp]router-id 8.8.8.8
    10. [R8-bgp]peer 78.0.0.1 as-number 2
    11. [R8-bgp]
    12. Oct 15 2022 19:12:31-08:00 R8 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
    13. peer 78.0.0.1 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, St
    14. ateChangeReason=Up)

    (3)AS2区域中64512内R/2/3/4之间建立联邦

    1. [R2]bgp 64512
    2. [R2-bgp]confederation id 2
    3. [R2-bgp]peer 172.16.24.1 as-number 64512
    4. [R2-bgp]peer 172.16.24.1 next-hop-local
    5. [R3]bgp 64512
    6. [R3-bgp]confederation id 2
    7. [R3-bgp]peer 172.16.16.1 as-number 64512
    8. [R3-bgp]peer 172.16.16.1 next-hop-local
    9. [R3-bgp]peer 172.16.32.1 as-number 64512
    10. [R3-bgp]peer 172.16.32.1 next-hop-local
    11. [R4]bgp 64512
    12. [R4-bgp]confederation id 2
    13. [R4-bgp]peer 172.16.24.1 as-number 64512
    14. [R4-bgp]peer 172.16.24.1 next-hop-local

    (4)AS2区域中64513内的R/5/6/7之间建立联邦

    1. [R5]bgp 64513
    2. [R5-bgp]confederation id 2
    3. [R5-bgp]peer 172.16.88.1 as-number 64513
    4. [R5-bgp]peer 172.16.88.1 next-hop-local
    5. [R6]bgp 64513
    6. [R6-bgp]confederation id 2
    7. [R6-bgp]peer 172.16.80.1 as-number 64513
    8. [R6-bgp]peer 172.16.80.1 next-hop-local
    9. [R6-bgp]peer 172.16.96.1 as-number 64513
    10. [R6-bgp]peer 172.16.96.1 next-hop-local
    11. [R7]bgp 64513
    12. [R7-bgp]confederation id 2
    13. [R7-bgp]peer 172.16.88.1 as-number 64513
    14. [R7-bgp]peer 172.16.88.1 next-hop-local

    (5)R2与R5之间建立EBGP邻居关系

    1. [R2]bgp 64512
    2. [R2-bgp]confederation peer-as 64513
    3. [R2-bgp]peer 172.16.128.2 as-number 64513
    4. [R2-bgp]
    5. Oct 15 2022 19:51:13-08:00 R2 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
    6. peer 172.16.128.2 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public
    7. , StateChangeReason=Up)
    8. [R5]bgp 64513
    9. [R5-bgp]confederation peer-as 64512
    10. [R5-bgp]peer 172.16.128.1 as-number 64512
    11. [R5-bgp]
    12. Oct 15 2022 19:51:13-08:00 R5 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
    13. peer 172.16.128.1 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public
    14. , StateChangeReason=Up)

    (6)R4与R7之间建立EBGP邻居关系

    1. [R4]bgp 64512
    2. [R4-bgp]confederation peer-as 64513
    3. [R4-bgp]peer 172.16.192.2 as-number 64513
    4. [R4-bgp]
    5. Oct 15 2022 19:55:22-08:00 R4 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
    6. peer 172.16.192.2 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public
    7. , StateChangeReason=Up)
    8. [R7]bgp 64513
    9. [R7-bgp]confederation peer-as 64512
    10. [R7-bgp]peer 172.16.192.1 as-number 64512
    11. [R7-bgp]
    12. Oct 15 2022 19:55:22-08:00 R7 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
    13. peer 172.16.192.1 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public
    14. , StateChangeReason=Up)

    (7)R2与R5之间,R4与R7之间建立EBGP关系后还需修改TTL值

    1. [R2-bgp]peer 172.16.128.2 ebgp-max-hop
    2. [R5-bgp]peer 172.16.128.1 ebgp-max-hop
    1. [R4-bgp]peer 172.16.192.2 ebgp-max-hop
    2. [R7-bgp]peer 172.16.192.1 ebgp-max-hop

    五、路由反射器

    反射规则
    1,如果路由反射器从自己客户处学习到一条路由信息,则他将把该路由信息反射给自
    己所有的客户以及非客户。
    2,如果RR从自己的非客户处学习到一条路由信息,则他将把该路由信息反射给自己所
    有的客户。
    "非非不传"
    3,当路由器执行路由反射时,他只将自己使用的最优的BGP路由进行反射

    在R3与R6上配置路由反射器用来打破IBGP的水平分割

    1. [R3-bgp]peer 172.16.16.1 reflect-client
    2. [R6-bgp]peer 172.16.80.1 reflect-client

    六、整个网络的环回可以互相访问

    1. <R1>ping 172.16.16.1
    2. PING 172.16.16.1: 56 data bytes, press CTRL_C to break
    3. Reply from 172.16.16.1: bytes=56 Sequence=1 ttl=255 time=40 ms
    4. Reply from 172.16.16.1: bytes=56 Sequence=2 ttl=255 time=20 ms
    5. Reply from 172.16.16.1: bytes=56 Sequence=3 ttl=255 time=20 ms
    6. Reply from 172.16.16.1: bytes=56 Sequence=4 ttl=255 time=10 ms
    7. Reply from 172.16.16.1: bytes=56 Sequence=5 ttl=255 time=20 ms
    8. --- 172.16.16.1 ping statistics ---
    9. 5 packet(s) transmitted
    10. 5 packet(s) received
    11. 0.00% packet loss
    12. round-trip min/avg/max = 10/22/40 ms
    13. <R1>ping 172.16.24.1
    14. PING 172.16.24.1: 56 data bytes, press CTRL_C to break
    15. Reply from 172.16.24.1: bytes=56 Sequence=1 ttl=254 time=30 ms
    16. Reply from 172.16.24.1: bytes=56 Sequence=2 ttl=254 time=30 ms
    17. Reply from 172.16.24.1: bytes=56 Sequence=3 ttl=254 time=40 ms
    18. Reply from 172.16.24.1: bytes=56 Sequence=4 ttl=254 time=20 ms
    19. Reply from 172.16.24.1: bytes=56 Sequence=5 ttl=254 time=20 ms
    20. --- 172.16.24.1 ping statistics ---
    21. 5 packet(s) transmitted
    22. 5 packet(s) received
    23. 0.00% packet loss
    24. round-trip min/avg/max = 20/28/40 ms
    25. <R1>ping 172.16.32.1
    26. PING 172.16.32.1: 56 data bytes, press CTRL_C to break
    27. Reply from 172.16.32.1: bytes=56 Sequence=1 ttl=253 time=40 ms
    28. Reply from 172.16.32.1: bytes=56 Sequence=2 ttl=253 time=30 ms
    29. Reply from 172.16.32.1: bytes=56 Sequence=3 ttl=253 time=40 ms
    30. Reply from 172.16.32.1: bytes=56 Sequence=4 ttl=253 time=30 ms
    31. Reply from 172.16.32.1: bytes=56 Sequence=5 ttl=253 time=30 ms
    32. --- 172.16.32.1 ping statistics ---
    33. 5 packet(s) transmitted
    34. 5 packet(s) received
    35. 0.00% packet loss
    36. round-trip min/avg/max = 30/34/40 ms
    37. <R1>ping 172.16.88.1
    38. PING 172.16.88.1: 56 data bytes, press CTRL_C to break
    39. Reply from 172.16.88.1: bytes=56 Sequence=1 ttl=253 time=40 ms
    40. Reply from 172.16.88.1: bytes=56 Sequence=2 ttl=253 time=40 ms
    41. Reply from 172.16.88.1: bytes=56 Sequence=3 ttl=253 time=40 ms
    42. Reply from 172.16.88.1: bytes=56 Sequence=4 ttl=253 time=30 ms
    43. Reply from 172.16.88.1: bytes=56 Sequence=5 ttl=253 time=40 ms
    44. --- 172.16.88.1 ping statistics ---
    45. 5 packet(s) transmitted
    46. 5 packet(s) received
    47. 0.00% packet loss
    48. round-trip min/avg/max = 30/38/40 ms
    49. <R1>ping 172.16.96.1
    50. PING 172.16.96.1: 56 data bytes, press CTRL_C to break
    51. Reply from 172.16.96.1: bytes=56 Sequence=1 ttl=252 time=60 ms
    52. Reply from 172.16.96.1: bytes=56 Sequence=2 ttl=252 time=40 ms
    53. Reply from 172.16.96.1: bytes=56 Sequence=3 ttl=252 time=40 ms
    54. Reply from 172.16.96.1: bytes=56 Sequence=4 ttl=252 time=50 ms
    55. Reply from 172.16.96.1: bytes=56 Sequence=5 ttl=252 time=50 ms
    56. --- 172.16.96.1 ping statistics ---
    57. 5 packet(s) transmitted
    58. 5 packet(s) received
    59. 0.00% packet loss
    60. round-trip min/avg/max = 40/48/60 ms
    61. <R1>

    七、创建虚拟隧道

    (1)对R1

    1. [r1]int t0/0/1
    2. [r1-Tunnel0/0/1]ip add 192.168.3.1 24
    3. [r1-Tunnel0/0/1]tunnel-protocol gre
    4. [r1-Tunnel0/0/1]source 10.0.0.1
    5. [r1-Tunnel0/0/1]description 11.0.0.1
    6. [r1]ip route-static 192.168.2.0 24 192.168.3.2

    (2)对R8

    1. [r8]int t0/0/1
    2. [r8-Tunnel0/0/1]ip add 192.168.3.2 24
    3. [r8-Tunnel0/0/1]tunnel-protocol gre
    4. [r8-Tunnel0/0/1]source 11.0.0.1
    5. [r8-Tunnel0/0/1]description 10.0.0.1
    6. [r8]ip route-static 192.168.1.0 24 192.168.3.1

    (3)此时便可使R1与R8的另外两个环回互相访问

     

  • 相关阅读:
    经典猜数游戏(python类封装)
    反射及暴力反射
    K8s中集成Heketi使用Glusterfs
    【Zookeeper】ZooKeeper的一些重要功能和作用
    Docker 镜像读写层核心概念:rootfs、Union mount、image以及layser原理详解
    Base64编码与解码
    2022年宜昌市企业研发投入补贴申报条件、流程及时间汇总
    js构造函数
    Python基础入门例程20-NP20 增加派对名单(一)(列表)
    你一定要知道的四个程序员接外包的网站,悄悄把技术变现!
  • 原文地址:https://blog.csdn.net/m0_63172083/article/details/127338323