BGP的基本配置

一、拓扑图

二、实验过程

1.使用直连接口IP地址建立EBGP对等体关系

配置IP地址和环回:

R1

**[R1]int g0/0/0

R1-GigabitEthernet0/0/0\]ip address 12.0.0.1 24 \[R1\]int l0 \[R1-LoopBack0\]ip address 1.1.1.1 32** ![](https://i-blog.csdnimg.cn/direct/cd5ec3379b9d435dbe7402d886167fcd.png) R2: \[R2\]int g0/0/0 \[R2-GigabitEthernet0/0/0\]ip address 12.0.0.2 24 \[R2-GigabitEthernet0/0/0\]int g0/0/1 \[R2-GigabitEthernet0/0/1\]ip address 23.0.0.2 24 \[R2-GigabitEthernet0/0/1\]int l0 \[R2-LoopBack0\]ip address 2.2.2.2 32 ![](https://i-blog.csdnimg.cn/direct/b51f30f367ed403a94589a78a1c2954e.png) R3: \[R3\]INT G0/0/0 \[R3-GigabitEthernet0/0/0\]ip address 23.0.0.3 24 \[R3-GigabitEthernet0/0/0\]int g0/0/1 \[R3-GigabitEthernet0/0/1\]ip address 34.0.0.3 24 \[R3-GigabitEthernet0/0/1\]int l0 \[R3-LoopBack0\]ip address 3.3.3.3 32 ![](https://i-blog.csdnimg.cn/direct/bd963de5aa7e4f41be32083d14732449.png) R4: \[R4\]INT G0/0/0 \[R4-GigabitEthernet0/0/0\]ip address 34.0.0.4 24 \[R4-GigabitEthernet0/0/0\]int g0/0/1 \[R4-GigabitEthernet0/0/1\]ip address 45.0.0.4 24 \[R4-GigabitEthernet0/0/1\]int l0 \[R4-LoopBack0\]ip address 4.4.4.4 32 ![](https://i-blog.csdnimg.cn/direct/f3e7e5bfffc74d2c8a14d046d1bb1aaa.png) ### 启动BGP协议: R1: \[R1\]bgp 100 ---启动BGP协议 \[R1-bgp\]router-id 1.1.1.1 ---编写RID \[R1-bgp\]peer 12.0.0.2 as-number 200 ---配置BGP对等体IP地址以及对等体所在AS号 ![](https://i-blog.csdnimg.cn/direct/3db4e8369af44478b91ff33eb503f28f.png) R2: \[R2\]bgp 200 \[R2-bgp\]router-id 2.2.2.2 \[R2-bgp\]peer 12.0.0.1 as-number 100 ![](https://i-blog.csdnimg.cn/direct/7c94c5e1f0f54f98b7a228fd76ae2a16.png) ### 使用环回接口IP地址建立IGBP对等关系建立: **1.首先要先建立OSPF设置** **R1: \[R1\]ospf 1 router-id 2.2.2.2 \[R1-ospf-1\]area 0 \[R1-ospf-1-area-0.0.0.0\]network 23.0.0.2 0.0.0.0 \[R1-ospf-1-area-0.0.0.0\]network 2.2.2.2 0.0.0.0** ![](https://i-blog.csdnimg.cn/direct/caaf97b0c9e447bfb6b144fcf3a18d91.png) R2: \[R2\]ospf 1 router-id 2.2.2.2 \[R2-ospf-1\]area 0 \[R2-ospf-1-area-0.0.0.0\]network 23.0.0.2 0.0.0.0 \[R2-ospf-1-area-0.0.0.0\]network 2.2.2.2 0.0.0.0 ![](https://i-blog.csdnimg.cn/direct/95054f1ce345454791956455e3132c06.png) R3: \[R3\]ospf 1 router-id 3.3.3.3 \[R3-ospf-1\]area 0 \[R3-ospf-1-area-0.0.0.0\]network 23.0.0.3 0.0.0.0 \[R3-ospf-1-area-0.0.0.0\]network 34.0.0.3 0.0.0.0 \[R3-ospf-1-area-0.0.0.0\]network 3.3.3.3 0.0.0.0 ![](https://i-blog.csdnimg.cn/direct/928762183b3b47138cf9e9173407f73d.png) R4: \[R4\]ospf 1 router-id 4.4.4.4 \[R4-ospf-1\]area 0 \[R4-ospf-1-area-0.0.0.0\]network 4.4.4.4 0.0.0.0 \[R4-ospf-1-area-0.0.0.0\]network 34.0.0.4 0.0.0.0 ![](https://i-blog.csdnimg.cn/direct/ebfbe3a2ea994ea59c22ea15379f9f52.png) **2.开始建立IBGP对等关系** R2: \[R2\]bgp 200 \[R2-bgp\]peer 3.3.3.3 as-number 200 ---使用环回地址 \[R2-bgp\]peer 3.3.3.3 connect-interface LoopBack 0 ---将与3.3.3.3这个IP地址建邻 的连接接口设定为本地的环回0接口 \[R2-bgp\]peer 4.4.4.4 as-number 200 \[R2-bgp\]peer 4.4.4.4 connect-interface LoopBack 0 ![](https://i-blog.csdnimg.cn/direct/cfae5cca8c184614aee69ff45c43868a.png) ![](https://i-blog.csdnimg.cn/direct/32d87343da9d44149a25d2524f1c946d.png) R3: \[R3\]bgp 200 \[R3-bgp\]router-id 3.3.3.3 \[R3-bgp\]peer 2.2.2.2 as-number 200 ---双方均需要配置 **---此时无法建立邻居关系,这是因为R2和R3设备发送的TCP报文的源IP地址是物理链路IP,而对于对端 设备而言,没有相关IP地址的peer信息。故无法建立邻居关系 ---解决思路:将源IP地址修改为换回地址** \[R3-bgp\]peer 2.2.2.2 connect-interface LoopBack 0 \[R3-bgp\]peer 4.4.4.4 as-number 200 \[R3-bgp\]peer 4.4.4.4 connect-interface LoopBack 0 ![](https://i-blog.csdnimg.cn/direct/f39a041f937c4d58be11d1d6698b7618.png) ![](https://i-blog.csdnimg.cn/direct/8385c4579a5044d8aad4065cecb0d8c3.png) R4: \[R4\]bgp 200 \[R4-bgp\]router-id 4.4.4.4 \[R4-bgp\]peer 3.3.3.3 as-number 200 \[R4-bgp\]peer 3.3.3.3 connect-interface LoopBack 0 \[R4-bgp\]peer 2.2.2.2 as-number 200 \[R4-bgp\]peer 2.2.2.2 connect-interface LoopBack 0 ![](https://i-blog.csdnimg.cn/direct/3eab23607ec84ff5b4e3be3456d3dad0.png) ![](https://i-blog.csdnimg.cn/direct/d5f281bf91af47878b2d908177d1a23c.png) ### 使用环回接口IP地址建立EBGP对等体关系 **R4:** \[R4\]bgp 200 \[R4-bgp\]peer 5.5.5.5 as-number 300 \[R4-bgp\]peer 5.5.5.5 ebgp-max-hop 3 \[R4-bgp\]peer 5.5.5.5 connect-interface LoopBack 0 ![](https://i-blog.csdnimg.cn/direct/95b40fe7f3d544f190a6e2f9ae68406c.png) ![](https://i-blog.csdnimg.cn/direct/7acfdd881ba24dc68af32e1a363562e0.png) ![](https://i-blog.csdnimg.cn/direct/697cfd05756642d69c54e4da916ffd88.png) R5: ![](https://i-blog.csdnimg.cn/direct/178758c26f4c4bc2917c1e56aad34870.png) ![](https://i-blog.csdnimg.cn/direct/1e2a655128064f3ab98182346bee6091.png) ### 在R1和R5上进行路由发布 R1: \[R1\]bgp 100 \[R1-bgp\]network 1.1.1.1 32 ![](https://i-blog.csdnimg.cn/direct/985bd38396854127a7f68ce9e48bb112.png) R5: \[R5\]bgp 300 \[R5-bgp\]net \[R5-bgp\]network 10.1.1.1 24 ![](https://i-blog.csdnimg.cn/direct/d46095a94eee47eebf6b8c09319c1357.png) ### 测试结果: ![](https://i-blog.csdnimg.cn/direct/3f67d0a06c464ca2a997bcdbe06bc2ea.jpeg)

相关推荐
_君落羽_3 分钟前
Linux操作系统——TCP服务端并发模型
linux·服务器·c++
哦你看看9 小时前
计算机网络技术(下)
网络·计算机网络
幽络源小助理9 小时前
如何从零开始学习黑客技术?网络安全入门指南
网络·学习·web安全
Rverdoser10 小时前
网站开发用什么语言好
服务器
四时久成11 小时前
服务器认证系统
运维·服务器
徐子元竟然被占了!!11 小时前
Windows Server 2019 DateCenter搭建 FTP 服务器
运维·服务器·windows
wayuncn13 小时前
影响服务器托管费用的因素
运维·服务器·数据中心·服务器托管·物理服务器租用·服务器机柜·idc机房托管
喜欢你,还有大家13 小时前
Linux笔记10——shell编程基础-4
linux·运维·服务器·笔记
玩转以太网13 小时前
基于 W55MH32Q-EVB 实现 FatFs 文件系统+FTP 服务器
服务器·单片机·物联网
不懂机器人13 小时前
linux编程----网络通信(TCP)
linux·服务器·tcp/ip