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)

相关推荐
sakoba6 分钟前
Docker学习其二(容器卷,Docker网络,Compose)
运维·网络·学习·docker·容器·基础
A了LONE28 分钟前
cv弹窗,退款确认弹窗
java·服务器·前端
惜.己2 小时前
appium中urllib3.exceptions.LocationValueError: No host specified. 的错误解决办法
网络·appium
吉凶以情迁2 小时前
window服务相关问题探索 go语言服务开发探索调试
linux·服务器·开发语言·网络·golang
卍郝凝卍2 小时前
云上服务器常见的存储方式和类型
大数据·服务器·数据库
专注VB编程开发20年2 小时前
UDP受限广播地址255.255.255.255的通信机制详解
网络·udp·智能路由器
柏木乃一3 小时前
Linux初步认识与指令与权限
linux·运维·服务器·shell·权限
189228048613 小时前
NX947NX955美光固态闪存NX962NX966
大数据·服务器·网络·人工智能·科技
Sadsvit4 小时前
Linux 进程管理与计划任务
linux·服务器·网络