实验拓扑图如下:BGP实验案例配置
IP地址规划:如图

思路:AS2运行OSPF协议,AS1,AS2,AS3之间建立EBGP邻居关系,之后宣告需要的网段

建立邻居关系
建立EBGP,IBGP邻居关系
R1和R2建立EBGP邻居关系
R1(config)#router bgp 1
R1(config-router)#bgp router-id 1.1.1.1
R1(config-router)#neighbor 12.1.1.2 remote-as 2

R3和R2,R4建立IBGP邻居关系
R3(config)#router bgp 64512
R3(config-router)#bgp router-id 3.3.3.3
R3(config-router)#neighbor 172.16.2.1 remote-as 64512
R3(config-router)#neighbor 172.16.2.1 up lo 0
R3(config-router)#neighbor 172.16.4.1 remote-as 64512
R3(config-router)#neighbor 172.16.4.1 up lo 0
R3(config-router)#bgp confederation identifier 2

R4和R3建立IBGP邻居关系,R4和R7建立IBGP中的EBGP邻居关系
R4(config)#router bgp 64512
R4(config-router)#bgp router-id 4.4.4.4
R4(config-router)#neighbor 172.16.3.1 remote-as 64512
R4(config-router)#neighbor 172.16.3.1 up lo 0
R4(config-router)#neighbor 172.16.7.1 remote-as 64513
R4(config-router)#nei
R4(config-router)#neighbor 172.16.7.1 up lo 0
R4(config-router)#neighbor 172.16.7.1 ebgp-multihop
R4(config-router)#bgp confederation identifier 2
R4(config-router)#bgp confederation peers 64513

R5和R2建立IBGP中的EBGP邻居关系,R5和R6建立IBGP邻居关系
R5(config)#router bgp 64513
R5(config-router)#bgp router-id 5.5.5.5
R5(config-router)#neighbor 172.16.2.1 remote-as 64512
R5(config-router)#neighbor 172.16.2.1 up lo 0
R5(config-router)#neighbor 172.16.2.1 ebgp-multihop
R5(config-router)#neighbor 172.16.6.1 remote-as 64513
R5(config-router)#neighbor 172.16.6.1 up lo 0
R5(config-router)#bgp confederation identifier 2
R5(config-router)#bgp confederation peers 64512

R6和R5,R7建立IBGP邻居关系
R6(config)#router bgp 64513
R6(config-router)#bgp router-id 6.6.6.6
R6(config-router)#neighbor 172.16.5.1 remote-as 64513
R6(config-router)#neighbor 172.16.5.1 up lo 0
R6(config-router)#neighbor 172.16.7.1 remote-as 64513
R6(config-router)#neighbor 172.16.7.1 up lo 0
R6(config-router)#bgp confederation identifier 2

R7和R6建立IBGP邻居关系,R7和R4建立IBGP中的EBGP邻居关系,R7和R8建立EBGP邻居关系
R7(config)#router bgp 64513
R7(config-router)#bgp router-id 7.7.7.7
R7(config-router)#neighbor 172.16.6.1 remote-as 64513
R7(config-router)#neighbor 172.16.6.1 up lo 0
R7(config-router)#neighbor 172.16.4.1 remote-as 64512
R7(config-router)#neighbor 172.16.4.1 up lo 0
R7(config-router)#neighbor 172.16.4.1 ebgp-multihop
R7(config-router)#neighbor 78.1.1.2 remote-as 3
R7(config-router)#bgp confederation identifier 2
R7(config-router)#bgp confederation peers 64512

R8(config)#router bgp 3
R8(config-router)#bgp router-id 8.8.8.8
R8(config-router)#neighbor 78.1.1.1 remote-as 2

查看邻居表
BGP实验案例配置
BGP实验案例配置
BGP实验案例配置
BGP实验案例配置
BGP实验案例配置
BGP实验案例配置
BGP实验案例配置
BGP实验案例配置

宣告
有2种宣告方式(利用BGP的宣告特点,BGP的聚合配置)此处均用利用BGP的宣告特点进行宣告
R3,R6成为RR
R3(config)#router bgp 64512
R3(config-router)#neighbor 172.16.4.1 route-reflector-client
R6(config)#router bgp 64513
R6(config-router)#neighbor 172.16.7.1 route-reflector-client

宣告R1还回
R1(config)#ip route 10.1.1.0 255.255.255.0 null 0
R1(config-router)#network 10.1.1.0 mask 255.255.255.0
R2传递给R3,R5时修改下一跳(真机中使用专用命令,策略route-map)
R2(config-router)#neighbor 172.16.5.1 next-hop-self
R2(config-router)#neighbor 172.16.3.1 next-hop-self

R2-R7不用宣告环回,因为IBGP中存在OSPF协议
R2(config)#ip route 0.0.0.0 0.0.0.0 null 0
R2(config)#router bgp 64512
R2(config-router)#network 172.16.0.0 mask 255.255.248.0

R7(config)#ip route 0.0.0.0 0.0.0.0 null 0
R7(config)#router bgp 64513
R7(config-router)#network 172.16.0.0 mask 255.255.248.0

宣告R8还回
R8(config)#ip route 10.1.2.0 255.255.255.0 null 0
R8(config)#router bgp 3
R8(config-router)#network 10.1.2.0 mask 255.255.255.0

查看BGP表,R2,R4,R5,R7表均正常,此时R3,R6出现路由环路
(R7将汇总路由给R4,R6,其中R4正常传递给R2,而R7传递给R6时下一跳优选7,又给了7)
BGP实验案例配置
BGP实验案例配置
解决BGP路由环路加关键字as-set字样
BGP实验案例配置
此时BGP路由环路解决
BGP实验案例配置
此时的路由表
BGP实验案例配置
BGP实验案例配置
BGP实验案例配置
BGP实验案例配置
BGP实验案例配置
BGP实验案例配置
BGP实验案例配置
BGP实验案例配置

R1,R8的一个环回不能宣告而需要通信,建立v*n
BGP实验案例配置
R1(config)#int tun 0
R1(config-if)#ip address 192.168.3.1 255.255.255.0
R1(config-if)#tun so 10.1.1.1
R1(config-if)#tun de 10.1.2.1
R1(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.2

R8(config)#int tun 0
R8(config-if)#ip address 192.168.3.2 255.255.255.0
R8(config-if)#tun so 10.1.2.1
R8(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1
BGP实验案例配置
认证
R1(config)#router bgp 1
R1(config-router)#neighbor 12.1.1.2 password doudou123

R2(config)#router bgp 64512
R2(config-router)#neighbor 12.1.1.1 password doudou123
BGP实验案例配置
总结:
1、IBGP中不用逐一宣告环回,IBGP内网中运行有协议已经宣告过,之间环回可以互相学到,只用在边界R2,R7上聚合成一条发给别的AS--------及达到减少条目的要求
2、BGP环回问题,路由可达但是查看路由表,BGP表时却发现环路,加as-set关键字样防环

相关文章:

  • 2021-09-21
  • 2021-05-18
  • 2021-11-27
  • 2021-06-21
  • 2021-08-28
  • 2021-09-18
  • 2021-08-29
  • 2021-12-05
猜你喜欢
  • 2021-08-24
  • 2021-05-07
  • 2021-04-23
  • 2021-06-21
  • 2022-12-23
  • 2021-06-14
  • 2021-06-29
相关资源
相似解决方案