当前位置:网站首页>BGP实验(含MPLS)
BGP实验(含MPLS)
2022-08-04 00:06:00 【aweike】
目录
实验要求:
实验步骤:
1.IP地址的规划
R1到R2为11.1.1.1/24网段,12.1.1.1/24网段 R1的环回的IP地址为1.1.1.1/24
R7到R8为13.1.1.1/24网段 R8的环回的IP地址为3.3.3.3/24
整个AS2区域的网段地址为172.16.0.0/16网段
AS2区域内每个路由器都有两个环回,一个用于建邻,一个用于通讯
将172.16.0.0/16划分为
建邻环回为172.16.0.2/32 172.16.0.3/32 172.16.0.4/32 172.16.0.5/32 172.16.0.6/32 172.16.0.7/32
通讯环回为172.16.2.1/24 172.16.3.1/24 172.16.4.1/24 172.16.5.1/24 172.16.6.1/24 172.16.7.1/24
骨干链路为172.16.1.0/30 172.16.1.4/30 172.16.1.8/30 172.16.1.12/30 172.16.1.16/30
172.16.1.20/30 172.16.1.24/30
2.拓扑结构的搭建
3.IP地址的配置
以R1和R8为例
R1:
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 1.1.1.1 32
[R1-LoopBack0]interface LoopBack 1
[R1-LoopBack1]ip address 2.2.2.2 24
[R1-LoopBack1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip address 11.1.1.1 24
[R1-GigabitEthernet0/0/0]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip address 12.1.1.1 24
R8:
[R8]interface LoopBack 0
[R8-LoopBack0]ip address 3.3.3.3 32
[R8-LoopBack0]interface LoopBack 1
[R8-LoopBack1]ip address 4.4.4.4 24
[R8-LoopBack1]interface g0/0/0
[R8-GigabitEthernet0/0/0]ip address 13.1.1.1 24
4.动态路由的配置
AS2中起OSPF协议,以R2为例
R2:
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
之后进入通讯的环回接口修改类型
[R2]interface LoopBack 1
[R2-LoopBack1]ospf network-type broadcast
5.MPLS的配置
AS2中都需要配置
以R2为例:
[R2]mpls lsr-id 172.16.0.2 必须先定义mpls的router-id,要为本地设备的真实ip地址,且邻居可达
[R2]mpls 再开启mpls协议
[R2-mpls]mpls ldp 再激活LDP协议
[R2-mpls-ldp]q
[R2]interface g0/0/1 之后需要在所有标签经过的接口上开启协议
[R2-GigabitEthernet0/0/1]mpls 先开启MPLS
[R2-GigabitEthernet0/0/1]mpls ldp 再激活LDP协议
[R2-GigabitEthernet0/0/1]q
[R2]interface g0/0/2 之后需要在所有标签经过的接口上开启协议
[R2-GigabitEthernet0/0/2]mpls 先开启MPLS
[R2-GigabitEthernet0/0/2]mpls ldp 再激活LDP协议
6.BGP的配置
R1:
[R1]bgp 1
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 11.1.1.2 as-number 2
[R1-bgp]peer 12.1.1.2 as-number 2
R2:
[R2]bgp 2
[R2-bgp]router-id 172.16.0.2
[R2-bgp]peer 11.1.1.1 as-number 1
[R2-bgp]peer 172.16.0.5 as-number 2
[R2-bgp]peer 172.16.0.5 connect-interface LoopBack 0
[R2-bgp]peer 172.16.0.5 next-hop-local
[R2-bgp]peer 172.16.0.7 as-number 2
[R2-bgp]peer 172.16.0.7 connect-interface LoopBack 0
[R2-bgp]peer 172.16.0.7 next-hop-local
R5:
[R5]bgp 2
[R5-bgp]router-id 172.16.0.5
[R5-bgp]peer 12.1.1.1 as-number 1
[R5-bgp]peer 172.16.0.2 as-number 2
[R5-bgp]peer 172.16.0.2 connect-interface LoopBack 0
[R5-bgp]peer 172.16.0.2 next-hop-local
[R5-bgp]peer 172.16.0.7 as-number 2
[R5-bgp]peer 172.16.0.7 connect-interface LoopBack 0
[R5-bgp]peer 172.16.0.7 next-hop-local
R7:
[R7]bgp 2
[R7-bgp]ro
[R7-bgp]route-select
[R7-bgp]router-id 172.16.0.7
[R7-bgp]peer 13.1.1.1 as-number 3
[R7-bgp]peer 172.16.0.2 as-number 2
[R7-bgp]peer 172.16.0.2 connect-interface LoopBack 0
[R7-bgp]peer 172.16.0.2 next-hop-local
[R7-bgp]peer 172.16.0.5 as-number 2
[R7-bgp]peer 172.16.0.5 connect-interface LoopBack 0
[R7-bgp]peer 172.16.0.5 next-hop-local
R8:
[R8]bgp 3
[R8-bgp]router-id 8.8.8.8
[R8-bgp]peer 13.1.1.2 as-number 2
7.解决BGP的路由黑洞
MPLS协议并不会为通过BGP协议学习的路由条目分配标签号;
而是在访问这些BGP路由目标网段时,在流量中压入到达这些网段的BGP下一跳设备地址的标签号;
例:R2从BGP邻居5.5.5.5 学习到6.6.6.0 网段的路由;R2在访问6.6.6.0 时,将在数据包中压入到达5.5.5.5ip地址的标签号,来穿越中间没有运行BGP协议的设备;实现打破路由黑洞;
注:华为设备默认不为BGP协议执行下一跳标签机制,cisco默认执行;
华为设备需要开启 route recursive-lookup tunnel 路由基于隧道进行递归查找
在R2、R5、R7上配置
[R2]route recursive-lookup tunnel
[R5]route recursive-lookup tunnel
[R7]route recursive-lookup tunnel
在R3、R4、R6上写缺省,指向最近的配置了BGP的路由器
[R3]ip route-static 0.0.0.0 0 172.16.1.1
[R4]ip route-static 0.0.0.0 0 172.16.1.18
[R6]ip route-static 0.0.0.0 0 172.16.1.21
并在R2、R5、R7上配置防环接口并宣告
[R2]ip route-static 172.16.0.0 21 NULL 0
[R2]bgp 2
[R2-bgp]network 172.16.0.0 21
[R5]ip route-static 172.16.0.0 21 NULL 0
[R5]bgp 2
[R5-bgp]network 172.16.0.0 21
[R7]ip route-static 172.16.0.0 21 NULL 0
[R7]bgp 2
[R7-bgp]network 172.16.0.0 21
R1上的OSPF路由表
8.宣告用户网段
[R2-bgp]network 172.16.2.0 24
[R2-bgp]network 172.16.3.0 24
[R2-bgp]network 172.16.4.0 24
R1路由表
9.写策略
在R1上写
[R1]ip ip-prefix a permit 172.16.2.0 24
[R1]route-policy a permit node 10
[R1-route-policy]if-match ip-prefix a
[R1-route-policy]apply as-path 2 2 2 additive
[R1-route-policy]q
[R1]route-policy a permit node 20
[R1-route-policy]q
[R1]bgp 1
[R1-bgp]peer 11.1.1.2 route-policy a import
R1路由表
在R5上的宣告
[R5]bgp 2
[R5-bgp]network 172.16.5.0 24
[R5-bgp]network 172.16.6.0 24
[R5-bgp]network 172.16.7.0 24
R1路由表
10.测试
R1的环回pingR8的环回
R1的环回pingAS2中的用户网段,以pingR3举例
边栏推荐
- BioVendor人Clara细胞蛋白(CC16)Elisa试剂盒检测步骤
- Justin Sun: Web3.0 and the Metaverse will assist mankind to enter the online world more comprehensively
- 【MySQL —— 索引】
- libnet
- Using matlab to solve the linear optimization problem based on matlab dynamic model of learning notes _11 】 【
- Super perfect version of the layout have shortcut, background replacement (solve the problem of opencv Chinese path)
- BPF 可移植性和 CO-RE(一次编译,到处运行)
- 教你如何定位不合理的SQL?并优化之
- XSLT – 服务器端概述
- Internship: Upload method for writing excel sheet (import)
猜你喜欢
Apple told Qualcomm: I bought a new campus for $445 million and may plan to speed up self-development of baseband chips
POE交换机全方位解读(下)
Minimized installation of debian11
一文搞定 SQL Server 执行计划
View the version number of CUDA, pytorch, etc.
2022-08-03:以下go语言代码输出什么?A:2;B:3;C:1;D:0。 package main import “fmt“ func main() { slice := []i
【面经】被虐了之后,我翻烂了equals源码,总结如下
After building the pytorch environment, the pip and conda commands cannot be used
【杂项】通过Excel为字符串产生条码
Unity 截取3D图像 与 画中画PIP的实现
随机推荐
Spinnaker调用Jenkins API 返回403错误
Flutter教程之为什么 Flutter 是创业的最佳选择?
简单了解下 TCP,学习握手和挥手以及各种状态到底是怎么样的
射频芯片ATE测试从入门到放弃之参数测试
一文参透分布式存储系统Ceph的架构设计、集群搭建(手把手)
689. 三个无重叠子数组的最大和
面试必问的HashCode技术内幕
米哈游--测试开发提前批
c语言分层理解(c语言指针(上))
七夕活动浪漫上线,别让网络拖慢和小姐姐的开黑时间
libnet
迭代扩展卡尔曼滤波IEKF
【深度学习】基于tensorflow的服装图像分类训练(数据集:Fashion-MNIST)
电子邮件安全或面临新威胁!
YOLOv7改进之二十二:涨点神器——引入递归门控卷积(gnConv)
Jar a key generation document database
POE交换机全方位解读(上)
ros mavros stereo读取rosbag并记录IMU和图片到文件夹
Super perfect version of the layout have shortcut, background replacement (solve the problem of opencv Chinese path)
孙宇晨:Web3.0和元宇宙将协助人类更加全面地进入网络世界