当前位置: 首页 > news >正文

OSPF与BGP的联动特性实验案例

拓扑

1、基础配置

AR1
system
sysname AR1
int g 0/0/0
ip add 10.0.12.1 24
int g 0/0/1
ip add 10.0.13.1 24
int l 0
ip add 1.1.1.1 32AR2
system
sysname AR2
int g 0/0/0
ip add 10.0.12.2 24
int g 0/0/1
ip add 10.0.24.2 24
int l 0
ip add 2.2.2.2 32AR3
system
sysname AR3
int g 0/0/1
ip add 10.0.13.3 24
int g 0/0/0
ip add 10.0.34.3 24
int l 0
ip add 3.3.3.3 32AR4
system
sysname AR4
int g 0/0/0
ip add 10.0.34.4 24
int g 0/0/1
ip add 10.0.24.4 24
int g 0/0/2
ip add 10.0.45.4 24
int l 0
ip add 4.4.4.4 32AR5
system
sysname AR5
int g 0/0/0
ip add 10.0.45.5 24
int l 0
ip add 5.5.5.5 32

2、IGP路由配置

AR1
ospf 1 router-id 1.1.1.1
area 0
netw 10.0.12.1 0.0.0.0
netw 10.0.13.1 0.0.0.0
netw 1.1.1.1 0.0.0.0AR2
ospf 1 router-id 2.2.2.2
area 0
netw 10.0.12.2 0.0.0.0
netw 10.0.24.2 0.0.0.0
netw 2.2.2.2 0.0.0.0AR3
ospf 1 router-id 3.3.3.3
area 0
netw 10.0.13.3 0.0.0.0
netw 10.0.34.3 0.0.0.0
netw 3.3.3.3 0.0.0.0AR4
ospf 1 router-id 4.4.4.4
area 0
netw 10.0.24.4 0.0.0.0
netw 10.0.34.4 0.0.0.0
netw 4.4.4.4 0.0.0.0

3、BGP路由配置

AR1
bgp 65001
router-id 1.1.1.1
peer 2.2.2.2 as 65001
peer 2.2.2.2 con l 0
peer 3.3.3.3 as 65001
peer 3.3.3.3 con l 0
peer 4.4.4.4 as 65001
peer 4.4.4.4 con l 0AR2
bgp 65001
router-id 2.2.2.2
peer 1.1.1.1 as 65001
peer 1.1.1.1 con l 0
peer 4.4.4.4 as 65001
peer 4.4.4.4 con l 0AR3
bgp 65001
router-id 3.3.3.3
peer 1.1.1.1 as 65001
peer 1.1.1.1 con l 0
peer 4.4.4.4 as 65001
peer 4.4.4.4 con l 0AR4
bgp 65001
router-id 4.4.4.4
peer 1.1.1.1 as 65001
peer 1.1.1.1 con l 0
peer 1.1.1.1 next-hop-local 
peer 2.2.2.2 as 65001
peer 2.2.2.2 con l 0
peer 2.2.2.2 next-hop-local
peer 3.3.3.3 as 65001
peer 3.3.3.3 con l 0
peer 3.3.3.3 next-hop-local
peer 10.0.45.5 as 65002AR5
bgp 65002
router-id 5.5.5.5
peer 10.0.45.4 as 65001
netw 5.5.5.5 32

查看OSPF邻居状态

[AR1]display ospf peer brief OSPF Process 1 with Router ID 1.1.1.1Peer Statistic Information----------------------------------------------------------------------------Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet0/0/0             2.2.2.2          Full        0.0.0.0          GigabitEthernet0/0/1             3.3.3.3          Full        ----------------------------------------------------------------------------
[AR4]display ospf peer brief OSPF Process 1 with Router ID 4.4.4.4Peer Statistic Information----------------------------------------------------------------------------Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet0/0/0             3.3.3.3          Full        0.0.0.0          GigabitEthernet0/0/1             2.2.2.2          Full        ----------------------------------------------------------------------------

查看BGP邻居状态

[AR4]display bgp peerBGP local router ID : 4.4.4.4Local AS number : 65001Total number of peers : 4		  Peers in established state : 4Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv1.1.1.1         4       65001        5        5     0 00:03:16 Established    02.2.2.2         4       65001        5        5     0 00:03:16 Established    03.3.3.3         4       65001        5        5     0 00:03:14 Established    010.0.45.5       4       65002        5        6     0 00:03:10 Established    0

在AR1上查看路由信息

[AR1]display ip routing-table 5.5.5.5
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface5.5.5.5/32  IBGP    255  0          RD   4.4.4.4         GigabitEthernet
0/0/1IBGP    255  0          RD   4.4.4.4         GigabitEthernet

因为都是默认开销,所以现在形成负载分担了,AR1-AR2-AR4-AR5为主路径,AR1-AR3-AR4-AR5为备份路径,我们修改一下IGP的COST开销。

AR1
int g 0/0/1
ospf cost 100

此时就只剩一条去往5.5.5.5的路由条目了,通过路由迭代,迭代到下一跳为AR2

[AR1]display fib 
Route Flags: G - Gateway Route, H - Host Route,    U - Up RouteS - Static Route,  D - Dynamic Route, B - Black Hole RouteL - Vlink Route
--------------------------------------------------------------------------------FIB Table:Total number of Routes : 17 Destination/Mask   Nexthop         Flag  TimeStamp     Interface      TunnelID
5.5.5.5/32         10.0.12.2       DGHU  t[7407]       GE0/0/0        0x0
4.4.4.4/32         10.0.12.2       DGHU  t[7407]       GE0/0/0        0x0
3.3.3.3/32         10.0.12.2       DGHU  t[7407]       GE0/0/0        0x0
2.2.2.2/32         10.0.12.2       DGHU  t[6823]       GE0/0/0        0x0
1.1.1.1/32         127.0.0.1       HU    t[6751]       InLoop0        0x0
10.0.13.255/32     127.0.0.1       HU    t[6751]       InLoop0        0x0
10.0.13.1/32       127.0.0.1       HU    t[6751]       InLoop0        0x0
10.0.12.255/32     127.0.0.1       HU    t[6751]       InLoop0        0x0
10.0.12.1/32       127.0.0.1       HU    t[6751]       InLoop0        0x0
255.255.255.255/32 127.0.0.1       HU    t[2]          InLoop0        0x0
127.255.255.255/32 127.0.0.1       HU    t[2]          InLoop0        0x0
127.0.0.1/32       127.0.0.1       HU    t[2]          InLoop0        0x0
127.0.0.0/8        127.0.0.1       U     t[2]          InLoop0        0x0
10.0.12.0/24       10.0.12.1       U     t[6751]       GE0/0/0        0x0
10.0.13.0/24       10.0.13.1       U     t[6751]       GE0/0/1        0x0
10.0.24.0/24       10.0.12.2       DGU   t[6827]       GE0/0/0        0x0
10.0.34.0/24       10.0.12.2       DGU   t[7407]       GE0/0/0        0x0

假设此时AR2因为某些原因重启了,AR1会切换至备份链路,当AR2的IGP收敛完成后又会切换回来,但是此时AR2的BGP并没有收敛完成路由并没有学习到位,所以AR1发送数据给AR2时就会导致丢包。

想要解决这个情况,我们可以在AR2上配置Stub Router(末节路由器),使AR2重启后IGP收敛完成后的100s内,其他设备不会以AR2为下一跳计算路由。

AR2
ospf 1
stub-router on-startup 100

配置完成后我们将AR2配置保存重启查看效果

当AR2重启后,OSPF完成收敛的100s内往外发布的1类LSA中的开销会填成65535,其他设备收到这个1类LSA后,就不会以AR2为下一跳计算路由,从而避免了路由黑洞和数据丢包的情况。

以上就是本章的全部内容了,感谢大家的浏览观看,文章若有错误或疑问可联系博主删除更改,非常欢迎大家私聊博主讨论

http://www.dtcms.com/a/278172.html

相关文章:

  • ConcurrentHashMap笔记
  • 从零开始学习深度学习—水果分类之PyQt5App
  • AutoDL挂载阿里云OSS
  • leetGPU解题笔记(1)
  • 【LeetCode Hot100 | 每日刷题】字母异位词分组
  • Can I Trust Your Answer? Visually Grounded Video Question Answering
  • C++高频知识点(十三)
  • 删除screen会话以及查看进程信息的方法
  • 魔力宝贝归来版,虚拟机搭建教程
  • 【SCI 4区推荐】《Journal of Visual Communication and Image Representation》
  • 消息中间件优化高手笔记
  • 退出登录后头像还在?这个缓存问题坑过多少前端!
  • 论文阅读:PolarFree Polarization-based Reflection-Free Imaging
  • IT岗位任职资格体系及发展通道-产品经理岗位任职标准参考
  • 《Python JSON 数据解析全指南:从基础到实战(含 jsonpath 与 Schema 验证)》
  • 九、官方人格提示词汇总(上)
  • 改进广告投入与销售额预测分析
  • CVE-2021-31201
  • 特征选择要解决什么问题
  • 算法题(174):全排列问题
  • 碳水循环(增肌、减脂)
  • AEC原理
  • 白盒测试方法深度解析:从理论到实践
  • Python协程进阶:优雅终止与异常处理详解
  • Mybatis 两级缓存可能导致的问题
  • 「小程序开发」新建页面设置启动页
  • alpinelinux的包管理
  • 力扣刷题记录(c++)09
  • ‘make_unique’ is not a member of ‘std’
  • win10下的wsl2扩充空间