思科浮动静态路由与BFD联动实验

实验拓扑

在这里插入图片描述

一、配置IP地址

R1

Router#configure terminal 
Router(config)#hostname R1
R1(config)#interface g0/0
R1(config-if)#ip address 10.10.10.1 255.255.255.0
R1(config-if)#no shutdown 
R1(config-if)#exit 
R1(config)#interface g0/1
R1(config-if)#ip address 10.10.20.1 255.255.255.0
R1(config-if)#no shutdown 
R1(config-if)#exit 
R1(config)#interface loopback 1
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#no shutdown

R2

Router#configure terminal 
Router(config)#hostname R2
R2(config)#interface g0/0
R2(config-if)#ip address 10.10.10.2 255.255.255.0
R2(config-if)#no shutdown 
R2(config-if)#exit 
R2(config)#interface g0/1
R2(config-if)#ip address 20.10.10.1 255.255.255.0
R2(config-if)#no shutdown 

R3

Router#configure terminal 
Router(config)#hostname R3
R3(config)#interface g0/0
R3(config-if)#ip address 20.10.10.2 255.255.255.0
R3(config-if)#no shutdown 
R3(config-if)#exit 
R3(config)#interface g0/1
R3(config-if)#ip address 30.10.10.2 255.255.255.0
R3(config-if)#no shutdown 
R3(config-if)#exit 
R3(config)#interface loopback 1
R3(config-if)#ip address 2.2.2.2 255.255.255.0
R3(config-if)#no shutdown

R4

Router#configure terminal 
Router(config)#hostname R4         
R4(config)#interface g0/0
R4(config-if)#ip address 10.10.20.2 255.255.255.0
R4(config-if)#no shutdown 
R4(config-if)#exit 
R4(config)#interface g0/1
R4(config-if)#ip address 30.10.10.1 255.255.255.0
R4(config-if)#no shutdown 

配置路由协议OSPF(R1,R2,R4)

R1

R1(config)#router ospf 10		创建一个进程为10的ospf
R1(config-router)#router-id 1.1.1.1		配置Router ID 1.1.1.1
R1(config-router)#network 10.10.10.0 0.0.0.255 area 0	宣告网络
R1(config-router)#network 10.10.20.0 0.0.0.255 area 0	宣告网络
R1(config-router)#network 1.1.1.0 0.0.0.255 area 0		宣告网络

R2

R2(config)#router ospf 10		创建一个进程为10的ospf
R2(config-router)#router-id 2.2.2.2		配置Router ID 2.2.2.2
R2(config-router)#network 10.10.10.0 0.0.0.255 area 0		宣告网络
R2(config-router)#network 20.10.10.0 255.255.255.0 area 0	宣告网络
R2(config-router)#default-information originate		传递默认路由

R4

R4(config)#router ospf 10		创建一个进程为10的ospf
R4(config-router)#router-id 3.3.3.3		配置Router ID 3.3.3.3
R4(config-router)#network 10.10.20.0 0.0.0.255 area 0		宣告网络
R4(config-router)#network 30.10.10.0 0.0.0.255 area 0		宣告网络
R4(config-router)#default-information originate		传递默认路由

三、配置BFD(R2,R3,R4)

R2

R2(config)#interface g0/1
R2(config-if)#bfd interval 50 min_rx 50 multiplier 350毫秒发送一次BFD报文,最小接收间隔50毫秒,最小容错数3(参数一样才能协商成功)
R2(config-if)#exit
R2(config)#ip route static bfd g0/1 20.10.10.2		配置接口与BFD联动
R2(config)#ip route 0.0.0.0 0.0.0.0 g0/1 20.10.10.2		配置默认路由

R3

R3(config)#interface range g0/0 - 1
R3(config-if-range)#bfd interval 50 min_rx 50 multiplier 350毫秒发送一次BFD报文,最小接收间隔50毫秒,最小容错数3(参数一样才能协商成功)
R3(config-if)#exit
R3(config)#ip route static bfd g0/0 20.10.10.1		配置接口与BFD联动
R3(config)#ip route static bfd g0/1 30.10.10.1		配置接口与BFD联动
R3(config)#ip route 0.0.0.0 0.0.0.0 g0/0 20.10.10.1 		配置默认路由
R3(config)#ip route 0.0.0.0 0.0.0.0 g0/1 30.10.10.1 5		配置AD为5的浮动默认路由

R4

R4(config)#interface g0/1
R4(config-if)#bfd interval 50 min_rx 50 multiplier 350毫秒发送一次BFD报文,最小接收间隔50毫秒,最小容错数3(参数一样才能协商成功)
R4(config-if)#exit
R4(config)#ip route static bfd g0/1 30.10.10.2		配置接口与BFD联动
R4(config)#ip route 0.0.0.0 0.0.0.0 g0/1 30.10.10.2		配置默认路由

验证

show bfd neighbors查看bfd邻居状态,都是UP的
在这里插入图片描述
show ip route显示路由表,AD为1的默认路由被添加到路由表上
在这里插入图片描述
ping R1的 1.1.1.1 可以ping 通
在这里插入图片描述
ping R1的 1.1.1.1 (10000个包),ping 的同时关闭R2的g0/1接口,仍然可以ping通,只丢失一个包
在这里插入图片描述
再次查看R3的路由表,AD为5的默认路由被添加到路由表上
在这里插入图片描述
打开R2的g0/1接口后,再次查看路由表,AD为0的默认路由又被添加到路由表中
在这里插入图片描述
红色路线为正常情况下的路线,红色路线出现故障过后,会快速切换到黄色的路线
在这里插入图片描述

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
静态路由BFD(Bidirectional Forwarding Detection)都是用来提高网络路由的可靠性和快速性的技术。BFD是一种网络协议,用于快速检测网络中的故障,静态路由是一种手动配置的路由方式。 在实际应用中,可以通过将静态路由BFD联动来实现更快速的路由切换和故障检测。具体步骤如下: 1. 配置静态路由:使用静态路由配置路由表,将需要访问的网络地址与对应的出口接口配置到路由表中。 2. 配置BFD:在需要进行故障检测的接口上,配置BFD参数,包括检测间隔时间、检测次数等参数。 3. 将BFD绑定到静态路由上:将静态路由BFD进行绑定,当BFD检测到故障时,静态路由将立即切换到备用路由。 下面是一个简单的配置示例: ``` interface GigabitEthernet0/0/1 ip address 192.168.1.1 255.255.255.0 bfd interval 100 min_rx 100 multiplier 3 ! interface GigabitEthernet0/0/2 ip address 192.168.2.1 255.255.255.0 bfd interval 100 min_rx 100 multiplier 3 ! ip route 192.168.3.0 255.255.255.0 192.168.1.2 track 1 ip route 192.168.3.0 255.255.255.0 192.168.2.2 track 2 ! track 1 interface GigabitEthernet0/0/1 line-protocol track 2 interface GigabitEthernet0/0/2 line-protocol ``` 在这个例子中,我们配置了两个接口,分别对应两个不同的网络。同时,我们在每个接口上配置了BFD参数,并将BFD静态路由进行了绑定。 在路由表中,我们配置了两条路由到同一个目的网络,但是使用了不同的出口接口和跟踪对象。这样,当其中一个出口接口发生故障时,跟踪对象将变为DOWN状态,静态路由将自动切换到备用路由,从而实现了快速路由切换和故障检测。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

网工小王

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值