当前位置: 首页 > news >正文

华为配置篇-BGP实验

BGP

  • 一、简述
  • 二、常用命令总结
  • 三、实验

一、简述

二、常用命令总结

display bgp peer #查看 BGP 对等体
display bgp routing-table	#查看 BGP 路由表

#在R1上通过 network 命令发布路由
[R1]bgp 64513
[R1-bgp] network 10.1.1.1 24

#在R2上将路由的下一跳地址修改为自身
[R2]bgp 64512
[R2-bgp] peer 10.0.3.3 next-hop-local	#向对等体10.0.3.3宣告自己知道的路由时,告诉它将路由的下一跳都改为我R2。
[R2-bgp] peer 10.0.4.4 next-hop-local

三、实验

背景
你是公司的网络管理员。公司的网络采用了 BGP 协议作为路由协议。公司的网络由多个自治系统组成,不同的分支机构使用了不同的 AS 号,现在你需要完成公司网络的搭建工作。在公司总部使用了 OSPF 作为 IGP,公司内部不同分支机构使用的是私有的 BGP AS 号。在完成网络搭建以后,你还需要观察 BGP 路由信息的传递。

拓扑
在这里插入图片描述

配置
R1

[V200R003C00]
#
 sysname R1
#
interface GigabitEthernet0/0/0
 ip address 10.0.1.1 255.255.255.0 
#
interface LoopBack0
 ip address 1.1.0.1 255.255.255.255 
#
interface LoopBack1
 ip address 1.1.1.1 255.255.255.0 
#
bgp 64513						#创建区域64513
 router-id 1.1.0.1				#和ospf类似,设置router-id
 peer 2.2.0.2 as-number 64512 	#有个EBGP对等体,在区域64512
 peer 2.2.0.2 ebgp-max-hop 2 	#与这个对等体最大跳数设为2
 peer 2.2.0.2 connect-interface LoopBack0	#与这个对等体连接用LoopBack0接口
 #
 ipv4-family unicast	#默认的
  undo synchronization	#默认的
  network 1.1.1.0 255.255.255.0 
  peer 2.2.0.2 enable	#默认的
#
ip route-static 2.2.0.2 255.255.255.255 10.0.1.2
#
return

R2

[V200R003C00]
#
 sysname R2
#
interface GigabitEthernet0/0/0
 ip address 10.0.1.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 10.0.2.2 255.255.255.0 
#
interface LoopBack0
 ip address 2.2.0.2 255.255.255.255 
#
bgp 64512
 router-id 2.2.0.2
 peer 1.1.0.1 as-number 64513 
 peer 1.1.0.1 ebgp-max-hop 2 
 peer 1.1.0.1 connect-interface LoopBack0
 peer 3.3.0.3 as-number 64512 
 peer 3.3.0.3 connect-interface LoopBack0
 peer 4.4.0.4 as-number 64512 
 peer 4.4.0.4 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 1.1.0.1 enable
  peer 3.3.0.3 enable
  peer 3.3.0.3 next-hop-local 
  peer 4.4.0.4 enable
  peer 4.4.0.4 next-hop-local 
#
ospf 1 router-id 2.2.0.2 
 area 0.0.0.0 
  network 2.2.0.2 0.0.0.0 
  network 10.0.2.2 0.0.0.0 
#
ip route-static 1.1.0.1 255.255.255.255 10.0.1.1
#
return

R3

[V200R003C00]
#
 sysname R3
#
interface GigabitEthernet0/0/1
 ip address 10.0.2.3 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip address 10.0.3.3 255.255.255.0 
#
interface LoopBack0
 ip address 3.3.0.3 255.255.255.255 
#
bgp 64512
 router-id 3.3.0.3
 peer 2.2.0.2 as-number 64512 
 peer 2.2.0.2 connect-interface LoopBack0
 peer 4.4.0.4 as-number 64512 
 peer 4.4.0.4 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 2.2.0.2 enable
  peer 4.4.0.4 enable
#
ospf 1 router-id 3.3.0.3 
 area 0.0.0.0 
  network 3.3.0.3 0.0.0.0 
  network 10.0.2.3 0.0.0.0 
  network 10.0.3.3 0.0.0.0 
#
return

R4

[V200R003C00]
#
 sysname R4
#
interface GigabitEthernet0/0/0
 ip address 10.0.4.4 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip address 10.0.3.4 255.255.255.0 
#
interface LoopBack0
 ip address 4.4.0.4 255.255.255.255 
#
bgp 64512
 router-id 4.4.0.4
 peer 2.2.0.2 as-number 64512 
 peer 2.2.0.2 connect-interface LoopBack0
 peer 3.3.0.3 as-number 64512 
 peer 3.3.0.3 connect-interface LoopBack0
 peer 5.5.0.5 as-number 64514 
 peer 5.5.0.5 ebgp-max-hop 2 
 peer 5.5.0.5 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 2.2.0.2 enable
  peer 2.2.0.2 next-hop-local 
  peer 3.3.0.3 enable
  peer 3.3.0.3 next-hop-local 
  peer 5.5.0.5 enable
#
ospf 1 router-id 4.4.0.4 
 area 0.0.0.0 
  network 4.4.0.4 0.0.0.0 
  network 10.0.3.4 0.0.0.0 
#
ip route-static 5.5.0.5 255.255.255.255 10.0.4.5
#
return

R5

[V200R003C00]
#
 sysname R5
#
interface GigabitEthernet0/0/0
 ip address 10.0.4.5 255.255.255.0 
#
interface LoopBack0
 ip address 5.5.0.5 255.255.255.255 
#
interface LoopBack1
 ip address 5.5.1.5 255.255.255.0 
#
bgp 64514
 router-id 5.5.0.5
 peer 4.4.0.4 as-number 64512 
 peer 4.4.0.4 ebgp-max-hop 2 
 peer 4.4.0.4 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  network 5.5.1.0 255.255.255.0 
  peer 4.4.0.4 enable
#
ip route-static 4.4.0.4 255.255.255.255 10.0.4.4
#
return

总结

  • R2、 R3、 R4 之间基于 Loopback0 接口建立全互联的 IBGP 对等体关系:R2与R3、R2与R4;R3与R2、R3与R4;R4与R2、R4与R3。
  • 默认情况下, EBGP 连接允许的最大跳数为 1,这导致 EBGP 对等体之间只能使用直连链路建立 EBGP 对等体关系, 为使用环回口作为更新源需要手动修改 EBGP 连接允许的最大跳数(直连1个、环回口1个,共2个EBGP对等体连接)。
  • R3 上已经学习到 R1、 R5 上发布的 BGP 路由, 但是都是非有效路由, 这是因为它们的下一跳在 R3 上都不可达, 为此可以在 R2、 R4 上通过 next-hop-local 命令修改下一跳地址为 R2、 R4 的更新源地址。(R2告诉R3,将自己发给它的BGP路由的下一跳都改为R2自己,R4同理
  • 通过本次实验,有了更多理解,EBGP和IBGP之间通过对等体有一个大框架的路由,可以使用networkimport-route将本AS内路由导入bgp路由,进而在某一路由器下,ip路由表获得了bgp提供的一些路由。
    例如,本实验,在R1上通过bgp路由表导入ip路由的只有R5的loopback1,只有这两个的loopback1之间能ping通,而R1的ip路由表中没有到R3、R4的路由,所以无法ping通。

相关文章:

  • 网站建设app开发小程序开发138ip查询网域名解析
  • jsp网站开发实例教程网站建设优化推广系统
  • 网上书城网站建设功能定位网站域名费一年多少钱
  • 做汽车介绍视频的网站吗百度指数排名热搜榜
  • 自己做网站要买什么醴陵网站制作
  • 韶关网站建设的公司百度投广告怎么收费
  • mac Python多版本第三方库的安装路径
  • 深入剖析 JVM:从组成原理到调优实践
  • pyopenjtalk因cmake版本太高导致pip无法安装
  • PHP泛型与集合的未来:从动态类型到强类型的演进
  • MFC中CMap类的用法和原理
  • 【机器人】复现 GraspNet 端到端抓取点估计 | PyTorch2.3 | CUDA12.1
  • c++的特性——多态
  • 服务热升级的方法
  • C++ 中的 decltype:从表达式中推断类型(二十八)
  • RK3588使用笔记:纯linux系统下基础功能配置(不定期更新)
  • MySQL内存管理机制详解
  • 【差分隐私相关概念】数据立方体(Data Cube)
  • C#里使用libxl的对齐/边框/颜色
  • 【极速版 -- 大模型入门到进阶】Transformer: Attention Is All You Need -- 第一弹
  • 基于python大数据的旅游可视化及推荐系统
  • JavaScript中var、let和const的区别
  • 深入理解分布式事务Saga,从入门到面试热点分析详解
  • 05-021-自考数据结构(20331)- 动态查找-例题分析
  • [首发]烽火HG680-KD-海思MV320芯片-2+8G-安卓9.0-强刷卡刷固件包
  • 计算机Python程序代码Java编写web系统c++代做qt设计接单php开发