当前位置:网站首页>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 24R8:
[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 244.动态路由的配置
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 2R2:
[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-localR5:
[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-localR7:
[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-localR8:
[R8]bgp 3
[R8-bgp]router-id 8.8.8.8
[R8-bgp]peer 13.1.1.2 as-number 27.解决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 21R1上的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 24R1路由表

10.测试
R1的环回pingR8的环回

R1的环回pingAS2中的用户网段,以pingR3举例

边栏推荐
- internship:编写excel表的上传方法(导入)
- LeetCode 19:删除链表的倒数第 N 个结点
- In V8 how arrays (with source code, picture and text easier to understand)
- RSS feeds WeChat public - feed43 asain
- 扩展卡尔曼滤波EKF
- Unity 截取3D图像 与 画中画PIP的实现
- 【杂项】通过Excel为字符串产生条码
- View the version number of CUDA, pytorch, etc.
- Nanoprobes丨Nanogold-抗体和链霉亲和素偶联物
- JS获得URL超链接的参数值
猜你喜欢

并查集详解

咱们500万条数据测试一下,如何合理使用索引加速?

FPGA按键消抖+蜂鸣器

BioVendor人Clara细胞蛋白(CC16)Elisa试剂盒检测步骤

小身材有大作用——光模块基础知识(一)

After building the pytorch environment, the pip and conda commands cannot be used

Salesforce's China business may see new changes, rumors may be closing

绕任意轴旋转矩阵推导

【深度学习】基于tensorflow的服装图像分类训练(数据集:Fashion-MNIST)

In V8 how arrays (with source code, picture and text easier to understand)
随机推荐
libnet
FinClip, help smart TV more imagination
分子个数 数论(欧拉函数 前缀和
2023年航空航天、机械与机电工程国际会议(CAMME 2023)
Salesforce's China business may see new changes, rumors may be closing
Free自由协议系统开发
建木DevOps流程的快速运用
POE交换机全方位解读(下)
Apple told Qualcomm: I bought a new campus for $445 million and may plan to speed up self-development of baseband chips
MPLS综合实验
跨域问题解决方式 代理服务器
HNUCM 2022年暑假ACM搜索专项练习
BPF 可移植性和 CO-RE(一次编译,到处运行)
sqlnet.ora文件与连接认证方式的小测试
The problem of disorganized data output by mnn model
Install third-party packages via whl
Go编译原理系列7(Go源码调试)
Talking about the future development direction of my country's industrial parks
越来越火的图数据库到底能做什么?
小身材有大作用——光模块寿命分析(二)