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

浮动路由和BFD配置

拓扑图

前期的拓扑图没有交换机
在这里插入图片描述

配置步骤

1、配置IP地址

终端IP地址的配置

路由器IP地址的配置

配置router的对应接口的IP地址
<Huawei>sys
[Huawei]sysname router
[router]interface Ethernet 0/0/0
[router-Ethernet0/0/0]ip address 192.168.10.254 24
[router-Ethernet0/0/0]q
[router]undo info-center enable 
[router]interface Ethernet 0/0/1
[router-Ethernet0/0/1]ip address 192.168.20.254 24
[router-Ethernet0/0/1]q
[router]interface GigabitEthernet0/0/0
[router-GigabitEthernet0/0/0]ip address 12.1.1.1 30
[router-GigabitEthernet0/0/0]q
[router]interface GigabitEthernet 0/0/1
[router-GigabitEthernet0/0/1]ip address 13.1.1.1 30
[router-GigabitEthernet0/0/1]q检查一下配置情况
router]display ip interface brief 
*down: administratively down
!down: FIB overload down
^down: standby
(l): loopback
(s): spoofing
(d): Dampening Suppressed
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 6
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 6Interface                         IP Address/Mask      Physical   Protocol  
Ethernet0/0/0                     192.168.10.254/24    up         up        
Ethernet0/0/1                     192.168.20.254/24    up         up        
GigabitEthernet0/0/0              12.1.1.1/30          up         up        
GigabitEthernet0/0/1              13.1.1.1/30          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
GigabitEthernet0/0/3              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Serial0/0/0                       unassigned           down       down      
Serial0/0/1                       unassigned           down       down      
Serial0/0/2                       unassigned           down       down      
Serial0/0/3                       unassigned           down       down 
配置dianxin路由器的IP地址
<Huawei>sys
[Huawei]undo info-center enable 
[Huawei]interface GigabitEthernet  0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 12.1.1.2 30
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 100.1.1.1 30
[Huawei-GigabitEthernet0/0/1]q
[Huawei]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.1.1.2/30          up         up        
GigabitEthernet0/0/1              100.1.1.1/30         up         up        
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
[Huawei]sysname dianxin
[dianxin]
配置liantong路由器的IP地址
<Huawei>sys
[Huawei]undo info-center enable
[Huawei]sysname liantong
[liantong]interface g0/0/0
[liantong-GigabitEthernet0/0/0]ip address 13.1.1.2 30
[liantong-GigabitEthernet0/0/0]int g0/0/1
[liantong-GigabitEthernet0/0/1]ip add 200.1.1.1 30
[liantong-GigabitEthernet0/0/1]q
[liantong]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              13.1.1.2/30          up         up        
GigabitEthernet0/0/1              200.1.1.1/30         up         up        
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
[liantong]
配置互联网的路由器的配置
<Huawei>sys
[Huawei]sysname hulianwang
[hulianwang]undo info-center enable 
[hulianwang]int g0/0/0
[hulianwang-GigabitEthernet0/0/0]ip add 100.1.1.2 30
[hulianwang-GigabitEthernet0/0/0]int g0/0/1
[hulianwang-GigabitEthernet0/0/1]ip  add 200.1.1.2 30
[hulianwang-GigabitEthernet0/0/1]q
环回口:这个地址就不会因为物理接口状态变化而丢失,用于建立路由邻居或远程管理非常理想。
[hulianwang]interface LoopBack 0
[hulianwang-LoopBack0]ip add 22.22.22.22 32 
[hulianwang-LoopBack0]q
[hulianwang]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              100.1.1.2/30         up         up        
GigabitEthernet0/0/1              200.1.1.2/30         up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         22.22.22.22/32       up         up(s)     
NULL0                             unassigned           up         up(s)     
[hulianwang]

2、配置OSPF

在互联网路由器中宣告网段
[hulianwang]ospf
[hulianwang-ospf-1]area 0
[hulianwang-ospf-1-area-0.0.0.0]network 0.0.0.0 0.0.0.0
[hulianwang-ospf-1-area-0.0.0.0]q
[hulianwang-ospf-1]
在liantong路由器中宣告网段
[liantong]ospf 1
[liantong-ospf-1]area 0
[liantong-ospf-1-area-0.0.0.0]network 0.0.0.0 0.0.0.0
[liantong-ospf-1-area-0.0.0.0]q
[liantong-ospf-1][liantong]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 13       Routes : 13       Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface12.1.1.0/30  OSPF    10   3           D   200.1.1.2       GigabitEthernet
0/0/113.1.1.0/30  Direct  0    0           D   13.1.1.2        GigabitEthernet
0/0/013.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/013.1.1.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/022.22.22.22/32  OSPF    10   1           D   200.1.1.2       GigabitEthernet
0/0/1100.1.1.0/30  OSPF    10   2           D   200.1.1.2       GigabitEthernet
0/0/1127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0200.1.1.0/30  Direct  0    0           D   200.1.1.1       GigabitEthernet
0/0/1200.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1200.1.1.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0[liantong]
在dianxin路由器中宣告网段
[dianxin]ospf 1
[dianxin-ospf-1-area-0.0.0.0]net 0.0.0.0 0.0.0.0
[dianxin-ospf-1-area-0.0.0.0]q
[dianxin-ospf-1]
[dianxin]display ospf peer bOSPF Process 1 with Router ID 12.1.1.2Peer Statistic Information----------------------------------------------------------------------------Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet0/0/1             100.1.1.2        Full        ----------------------------------------------------------------------------
[dianxin][dianxin]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 13       Routes : 13       Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface12.1.1.0/30  Direct  0    0           D   12.1.1.2        GigabitEthernet
0/0/012.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/012.1.1.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/013.1.1.0/30  OSPF    10   3           D   100.1.1.2       GigabitEthernet
0/0/122.22.22.22/32  OSPF    10   1           D   100.1.1.2       GigabitEthernet
0/0/1100.1.1.0/30  Direct  0    0           D   100.1.1.1       GigabitEthernet
0/0/1100.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1100.1.1.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0200.1.1.0/30  OSPF    10   2           D   100.1.1.2       GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0[dianxin]

3、配置出口路由器router

[router]acl 2000
[router-acl-basic-2000]rule 10 permit source 192.168.10.0 0.0.0.255
[router-acl-basic-2000]rule 20 permit source 192.168.20.0 0.0.0.255
[router-acl-basic-2000]q
[router]
[router]int g0/0/0
[router-GigabitEthernet0/0/0]nat outbound 2000
[router-GigabitEthernet0/0/0]int g0/0/1
[router-GigabitEthernet0/0/1]nat outbound 2000
[router-GigabitEthernet0/0/1]q配置出口的默认路由,也就是静态路由,很重要
[router]ip route-static 0.0.0.0 0 12.1.1.2
[router]ip route-static 0.0.0.0 0 13.1.1.2

经过上述实验PC1可以ping通22.22.22.22

测试浮动路由

  • 现在两个静态路由的优先级都是60,优先级越小优先选择谁
<router>dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 17       Routes : 18       Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface0.0.0.0/0   Static  60   0          RD   12.1.1.3        InLoopBack0Static  60   0          RD   13.1.1.3        InLoopBack012.1.1.0/30  Direct  0    0           D   12.1.1.1        GigabitEthernet
0/0/2
  • 测试更改静态路由的优先级
[router]ip route-static 0.0.0.0 0 13.1.1.3 preference 100
Info: Succeeded in modifying route.
  • 配置上述,命令之后,路由表如下,优先级为100的被隐藏。若优先级为60的静态路由shutdown,则会显示优先级为100的静态路由。
[router]dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 17       Routes : 17       Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface0.0.0.0/0   Static  60   0          RD   12.1.1.3        InLoopBack012.1.1.0/30  Direct  0    0           D   12.1.1.1        GigabitEthernet
0/0/212.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/2

1754407230110

4、新增加交换机

1754407029507

1754407376018

  • 新增加的交换机的链路是绿色的(通的),但是静态路由的选择没有改变,该怎么解决?
  • 使用BFD,做链路的探测。

5、配置BFD

  • BFD(Bidrectional Forwarding Detection,双向转发检测)用于快速检测系统设备之间的发送和接受两个方向的通信故障,并在出现故障时通知生成应用。BFD广泛用于链路故障检测,并能实现与接口、静态路由、动态路由等联动检测。
在router路由器中配置
开启bfd
[router]bfd  
[router-bfd]q
绑定对端IP,源IP
[router]bfd 1 bind peer-ip 12.1.1.3 source-ip 12.1.1.1 auto 
使bdf生效
[router-bfd-session-1]commit 
在dianxin路由器中配置BFD
[Huawei]bfd
[Huawei-bfd]q
[Huawei]bfd 1 bind peer-ip 12.1.1.1 source-ip 12.1.1.3 auto 
Info: The configuration succeeds, but BFD session cannot be created for the mome
nt because the route cannot be found.
[Huawei-bfd-session-1]commit
Info: The configuration succeeds, but BFD session cannot be created for the mome
nt because the route cannot be found.
[Huawei-bfd-session-1]q[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]undo shutdown[Huawei]display bfd session all
--------------------------------------------------------------------------------
Local Remote     PeerIpAddr      State     Type        InterfaceName            
--------------------------------------------------------------------------------8192  8192       12.1.1.1        Up        S_AUTO_PEER       -                  
--------------------------------------------------------------------------------Total UP/DOWN Session Number : 1/0
[Huawei]
[router]ip route-static 0.0.0.0 0 12.1.1.3 track bfd-session 1
Info: Succeeded in modifying route.
[router]

1754408210788

http://www.xdnf.cn/news/17219.html

相关文章:

  • 协同过滤基础——基线预测器(Baseline Predictors)
  • hyper-v实战系列:显卡虚拟化(GPU分区)--windows篇详解
  • Spring配置JDBC,使用JdbcTemplate套件和Druid套件
  • java回顾八股文中想起的知识点
  • Docker使用的常见问题
  • 开源密码恢复实用程序 Hashcat 7.0.0 发布
  • cf.训练
  • 数据结构 实现单链表
  • STM32学习笔记2-GPIO的输出模式
  • 机器学习通关秘籍|Day 03:决策树、随机森林与线性回归
  • 去哪儿StarRocks实践
  • 2025国赛数学建模C题详细思路模型代码获取,备战国赛算法解析——层次分析法
  • RabbitMQ削峰填谷详解:让系统在流量洪峰中“稳如泰山”
  • 零基础人工智能学习规划之路
  • 从LCM到SomeIP,再到DDS:技术演进与工作原理剖析
  • NuGet03-私有仓库搭建
  • 虚幻GAS底层原理解剖二 (GE)
  • NumPy 重要知识点总结
  • 【RabbitMQ】高级特性—消息确认详解
  • PYQT学习笔记:signal 和 slot(信号与槽)
  • 数学建模算法-day[15]
  • 【web自动化测试】实战
  • scikit-learn工具介绍
  • Android Framework代码屏蔽未接来电振动及声音通知
  • 【Linux系统编程】线程概念与控制
  • 【力扣 Hot100】 刷题日记
  • 微服务架构及常见微服务技术栈
  • 【motion】HumanML3D 的安装2:psbody-mesh安装成功
  • ubuntu24中部署k8s 1.30.x-底层用docker
  • 海信IP810N/海信IP811N_海思MV320-安卓9.0主板-TTL烧录包-可救砖