解决BGP中IBGP的路由黑洞的配置方法

?

R1与R2间EBGP,R4与R5间EBGP,R2与R4间IBGP,但由于R3学不到相关的路由,造成路由黑洞。处理的方法主要以下几个:

以下是路由器配置:

R1:

interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.1 255.255.255.252
!
router bgp 100
 bgp log-neighbor-changes
 network 1.1.1.1 mask 255.255.255.255
 neighbor 192.168.1.2 remote-as 200

R5:

interface Loopback0
 ip address 5.5.5.5 255.255.255.255
!
interface FastEthernet0/1
 ip address 192.168.1.14 255.255.255.252
 speed auto
 duplex auto
!
router bgp 300
 bgp log-neighbor-changes
 network 5.5.5.5 mask 255.255.255.255
 neighbor 192.168.1.13 remote-as 200

1、IBGP全连接

R2:

interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.5 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.2 255.255.255.252
!
router ospf 1
 router-id 2.2.2.2
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 200
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 neighbor 4.4.4.4 remote-as 200
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
 neighbor 192.168.1.1 remote-as 100

R3:

interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.9 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.6 255.255.255.252
!
router ospf 1
 router-id 3.3.3.3
 network 3.3.3.3 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 200
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
 neighbor 4.4.4.4 remote-as 200
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self

R4:

interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.13 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.10 255.255.255.252
!
router ospf 1
 router-id 4.4.4.4
 network 4.4.4.4 0.0.0.0 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 200
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
 neighbor 3.3.3.3 remote-as 200
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 neighbor 192.168.1.14 remote-as 300

2、路由反射器

R2:

interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.5 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.2 255.255.255.252
!
router ospf 1
 router-id 2.2.2.2
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 200
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 neighbor 192.168.1.1 remote-as 100

R3:

interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.9 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.6 255.255.255.252
!
router ospf 1
 router-id 3.3.3.3
 network 3.3.3.3 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 200
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 route-reflector-client
 neighbor 4.4.4.4 remote-as 200
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 route-reflector-client

R4:

interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.13 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.10 255.255.255.252
!
router ospf 1
 router-id 4.4.4.4
 network 4.4.4.4 0.0.0.0 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 200
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 neighbor 192.168.1.14 remote-as 300

3、BGP邦连

R2:

interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.5 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.2 255.255.255.252
!
router ospf 1
 router-id 2.2.2.2
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
!
router bgp 65530
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 bgp confederation identifier 200
 bgp confederation peers 65531
 neighbor 3.3.3.3 remote-as 65531

 neighbor 3.3.3.3 ebgp-multihop 255
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 neighbor 192.168.1.1 remote-as 100

R3:

interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.9 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.6 255.255.255.252
!
router ospf 1
 router-id 3.3.3.3
 network 3.3.3.3 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 65531
 bgp router-id 3.3.3.3
 bgp log-neighbor-changes
 bgp confederation identifier 200
 bgp confederation peers 65530 65532
 neighbor 2.2.2.2 remote-as 65530

 neighbor 2.2.2.2 ebgp-multihop 255
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
 neighbor 4.4.4.4 remote-as 65532
 neighbor 4.4.4.4 ebgp-multihop 255
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self

R4:

interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.13 255.255.255.252
 speed auto
 duplex auto
!
interface FastEthernet0/1
 ip address 192.168.1.10 255.255.255.252
!
router ospf 1
 router-id 4.4.4.4
 network 4.4.4.4 0.0.0.0 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 65532
 bgp log-neighbor-changes
 bgp confederation identifier 200
 bgp confederation peers 65531
 neighbor 3.3.3.3 remote-as 65531

 neighbor 3.3.3.3 ebgp-multihop 255
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 neighbor 192.168.1.14 remote-as 300

4、配置MPLS

R2:

interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.5 255.255.255.252
 mpls ip
!
interface FastEthernet0/1
 ip address 192.168.1.2 255.255.255.252
!
router ospf 1
 router-id 2.2.2.2
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 4.4.4.4 remote-as 200
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
 neighbor 192.168.1.1 remote-as 100
R3:

interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.9 255.255.255.252
 mpls ip
!
interface FastEthernet0/1
 ip address 192.168.1.6 255.255.255.252
 mpls ip
!
router ospf 1
 router-id 3.3.3.3
 network 3.3.3.3 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
 network 192.168.1.8 0.0.0.3 area 0

R4:

interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.13 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.10 255.255.255.252
 mpls ip
!
router ospf 1
 router-id 4.4.4.4
 network 4.4.4.4 0.0.0.0 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 200
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
 neighbor 192.168.1.14 remote-as 300

5、BGP路由重分发到IGP(不建议)

R2:

interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.5 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.2 255.255.255.252
!
router ospf 1
 router-id 2.2.2.2
 redistribute bgp 200 subnets
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 4.4.4.4 remote-as 200
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
 neighbor 192.168.1.1 remote-as 100

R3:

interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.9 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.6 255.255.255.252
!
router ospf 1
 router-id 3.3.3.3
 network 3.3.3.3 0.0.0.0 area 0
 network 192.168.1.4 0.0.0.3 area 0
 network 192.168.1.8 0.0.0.3 area 0

R4:

interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.13 255.255.255.252
!
interface FastEthernet0/1
 ip address 192.168.1.10 255.255.255.252
!
router ospf 1
 router-id 4.4.4.4
 redistribute bgp 200 subnets
 network 4.4.4.4 0.0.0.0 area 0
 network 192.168.1.8 0.0.0.3 area 0
!
router bgp 200
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 200
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
 neighbor 192.168.1.14 remote-as 300

说明:
因为水平分割的抑制,BGP路由器从IBGP邻居收的路由不会再传递给IBGP邻居,这是为了防止环路的产生。即使R2与R3、R3与R4建立了邻居关系,在没有其他设置的情况下,R3也不会将R2传递来的路由传递给R4,同样R3也不会将R4传递过来的路由给R2。

原文地址:https://www.cnblogs.com/gelare/p/12652424.html

时间: 2024-11-06 13:04:00

解决BGP中IBGP的路由黑洞的配置方法的相关文章

(转)在Eclipse中进行C/C++开发的配置方法(20140721最新版)

因准备考试原因需要在windows下配置C++标准运行环境,找到此文,Mark之. 先列举下自己遇到的情况: 1 JRE安装不上,点了exe文件后没有反应:   安装JDK!!! 2 Eclipse找不到JRE:   将jdk安装目录下的jre文件夹,copy到eclipse根目录下. 3 没有按原文所说的改名字.运行正常. 原贴地址: http://blog.csdn.net/baimafujinji/article/details/38026421 Eclipse 是一个开放源代码的.基于J

转:在Eclipse中进行C/C++开发的配置方法(20140721最新版)

http://blog.csdn.net/baimafujinji/article/details/38026421 Eclipse 是一个开放源代码的.基于Java的可扩展开发平台.就其本身而言,它只是一个框架和一组服务,用于通过插件组件构建开发环境.——语出百度百科. 简单的说Eclipse 是免费的开源的Java IDE,而且非常好用,特别是引入一些可扩展的插件后,它的功能可以变得非常强大. 但其实Eclipse不仅可以用来进行Java编程,它所支持的语言是多种多样的,C.C++.Ada.

在Eclipse中进行C/C++开发的配置方法(20140721最新版)

Eclipse 是一个开放源代码的.基于Java的可扩展开发平台.就其本身而言,它只是一个框架和一组服务,用于通过插件组件构建开发环境.--语出百度百科. 简单的说Eclipse 是免费的开源的Java IDE,而且非常好用,特别是引入一些可扩展的插件后,它的功能可以变得非常强大. 但其实Eclipse不仅可以用来进行Java编程,它所支持的语言是多种多样的,C.C++.Ada.Python.PHP等等.在Windows下,很多人习惯于在Visual C++(或者说是Visual Studio)

让你提前认识软件开发(51):VC++集成开发环境中Linux下Pclint工程的配置方法及常见错误修改

第3部分 软件研发工作总结 VC++集成开发环境中Linux下Pclint工程的配置方法及常见错误修改 [文章摘要] Pclint是一种C/C++软件代码静态分析工具.它是一种更加严格的编译器,能够发现普通编译器所不能发现的代码中的很多问题,因此被广泛应用于软件开发项目中. 本文介绍了如何在VC++集成开发环境中配置Linux下的Pclint工程,给出了C语言中pclint规则A检查的常见错误,并描述了对应的修改办法. [关键词] VC++  Pclint  配置  操作  修改 1. 前言 P

CentOS 6.6 中jdk1.6的安装和配置方法

Linux中JDK1.6的安装和配置方法 一.安装 创建安装目录,在/usr/java下建立安装路径,并将文件考到该路径下: # mkdir /usr/java 1.jdk-6u11-linux-i586.bin 这个是自解压的文件,在linux上安装如下: # chmod 755 jdk-6u11-linux-i586.bin # ./jdk-6u11-linux-i586.bin (注意,这个步骤一定要在jdk-6u11-linux-i586.bin所在目录下) 在按提示输入yes后,jdk

NLB多播模式下跨路由访问的配置方法

前些时间因为需大量访问共享文件,为提高访问的并发速度,就配置了两台服务器,采用windows的NBL来配置,配置方法在网上很多,配置完后,采用多播在本地可以访问,但其它网段就无法访问:后来又在网上查资料,有些说最好采用单播模式,这样支持跨网段的访问,又将NBL的工作模式改成单播模式,但出现有些机子能访问,有些不能访问,依据单播的工作原理,得知会修改网卡的物理地址改成以02BF开头的mac地址,在三层交换机上查看mac地址转发表,发现02bf开头的地地址只出现在一个物理端口上,另一台计臬机的端口上

ASP.NET Core MVC 中两种路由的简单配置

1.全局约定路由 这种方式配置优先级比较低,如果控制器或者方法上标记了特性路由那么优先走特性路由. 当建立好一个mvc项目里,路由都是默认配置好的. 如果建立的是空项目那么需要手动配置: 1.需要在ConfigureServices方法中添加mvc服务 services.AddMvc(); 2.在Configure添加mvc中间件: app.UseMvcWithDefaultRoute(); //添加mvc中间件并使用默认路由配置 这里添加mvc中间时使用的是默认的路由配置,默认的路由配置就是跟

Linux中增加软路由的两种方法/删除的方法

第一种: route add -net 172.16.6.0 netmask 255.255.255.0 gw 172.16.2.254 dev eth0 route del gw 172.16.2.254 route del -net 172.16.86.0/24 route /* 显示当前路由表 */ 第二种: 实现的功能和上面的一样 ip route add 172.16.6.0/24 via 172.16.2.254 dev eth0 ip route del gw 172.16.2.2

yii2中gii外网访问的配置方法

if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = 'yii\debug\Module'; $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', 'allo