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)

相关推荐
Me4神秘31 分钟前
Linux国产与国外进度对垒
linux·服务器·安全
Me4神秘1 小时前
电信、移动、联通、广电跨运营商网速慢原因
网络
数通Dinner2 小时前
RSTP 拓扑收敛机制
网络·网络协议·tcp/ip·算法·信息与通信
牛奶咖啡133 小时前
Linux系统的常用操作命令——文件远程传输、文件编辑、软件安装的四种方式
运维·服务器·软件安装·linux云计算·scp文件远程传输·vi文件编辑·设置yum的阿里云源
weixin_437398213 小时前
转Go学习笔记(2)进阶
服务器·笔记·后端·学习·架构·golang
liulilittle4 小时前
SNIProxy 轻量级匿名CDN代理架构与实现
开发语言·网络·c++·网关·架构·cdn·通信
tan77º4 小时前
【Linux网络编程】Socket - UDP
linux·服务器·网络·c++·udp
小白爱电脑5 小时前
光纤的最小弯曲半径是多少?
网络
szxinmai主板定制专家5 小时前
【精密测量】基于ARM+FPGA的多路光栅信号采集方案
服务器·arm开发·人工智能·嵌入式硬件·fpga开发
你不知道我是谁?5 小时前
负载均衡--四层、七层负载均衡的区别
运维·服务器·负载均衡