当前位置:网站首页>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举例

边栏推荐
- 简单了解下 TCP,学习握手和挥手以及各种状态到底是怎么样的
- 现货白银需要注意八大事项
- 使用unbound在RHEL7上搭建DNS服务
- 免费的公共WiFi不要乱连,遭中间人攻击了吧?
- Super perfect version of the layout have shortcut, background replacement (solve the problem of opencv Chinese path)
- ES6高级-迭代器与生成器的用法
- win10+cuda11.7+pytorch1.12.0 installation
- 七夕活动浪漫上线,别让网络拖慢和小姐姐的开黑时间
- Talking about the future development direction of my country's industrial parks
- [Miscellaneous] How to install the specified font into the computer and then use the font in the Office software?
猜你喜欢
随机推荐
跨域问题解决方式 代理服务器
我的祖国
通过whl安装第三方包
libnet
射频芯片ATE测试从入门到放弃之参数测试
jav一键生成数据库文档
In V8 how arrays (with source code, picture and text easier to understand)
求解同余方程 数论 扩展欧几里得
机器学习——库
Graph-node:创建一个新的subgraph
ENS域名注册量创历史新高 逆市增长之势?光环之下存在炒作风险
libnet
2015年开源大事件汇总
七夕活动浪漫上线,别让网络拖慢和小姐姐的开黑时间
Free自由协议系统开发
leetcode/子串中不能有重复字符的最长子串
RSS订阅微信公众号初探-feed43
Justin Sun: Web3.0 and the Metaverse will assist mankind to enter the online world more comprehensively
双目IMU标定kalibr
Flutter教程之为什么 Flutter 是创业的最佳选择?









