Cisco的浮动静态路由协议配置

版权声明:转载原创文章请以超链接形式请注明原文章出处,尊重作者,尊重原创!


恰饭广告




浮动静态路由:通过配置一个比主路由的管理距离(AD值–administrative distance)更大的静态路由,保证网络中主路由失效的情况下,提供备份路由。

实验拓扑图:

思科浮动静态路由拓扑图

路由器0配置:

Router>enable
Router#configure terminal
Router(config)#int f0/0
Router(config-if)#ip add 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#int s0/1/0
Router(config-if)#ip add 192.168.2.1 255.255.255.0
Router(config-if)#clock rate 56000
Router(config-if)#no shutdown
Router(config-if)#int loopback 0
Router(config-if)#ip add 192.168.3.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#ip route 192.168.4.0 255.255.255.0 192.168.2.2 100
Router(config)#ip route 192.168.4.0 255.255.255.0 192.168.1.2
Router(config)#exit
Router#write

路由器1配置:

Router>enable
Router#configure terminal
Router(config)#int f0/0
Router(config-if)#ip add 192.168.1.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#int s0/1/0
Router(config-if)#ip add 192.168.2.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#int loopback 0
Router(config-if)#ip add 192.168.4.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.1 100
Router(config)#ip route 192.168.3.0 255.255.255.0 192.168.1.1
Router(config)#exit
Router#write 

查看路由器0的路由表:

Router(config)#do show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
Gateway of last resort is not set
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, Serial0/1/0
C    192.168.3.0/24 is directly connected, Loopback0
S    192.168.4.0/24 [1/0] via 192.168.1.2

查看路由器1的路由表:

Router(config)#do show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
Gateway of last resort is not set
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, Serial0/1/0
S    192.168.3.0/24 [1/0] via 192.168.1.1
C    192.168.4.0/24 is directly connected, Loopback0

浮动静态路由配置完成,开始测验:

关闭路由器0的f0/0端口(模拟以太链路出现故障),再去查看路由表。

Router(config)#int f0/0
Router(config-if)#shutdown
Router(config-if)#exit
Router(config)#do show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
Gateway of last resort is not set
C    192.168.2.0/24 is directly connected, Serial0/1/0
C    192.168.3.0/24 is directly connected, Loopback0
S    192.168.4.0/24 [100/0] via 192.168.2.2

注意:重复关闭或打开f0/0端口,反复查看区别。

最后:当以太链路正常时,路由器在选路的时候优先选择以太链路;当以太链路出现故障,路由器会自动选用串行链路;以太链路恢复正常后,路由器又会选择以太链路。

注解:

enable 进入特权模式

configure terminal 进入全局配置模式

int 接口名 进入某接口

ip add + IP地址 子网掩码  设置接口的IP地址及掩码

no ip add + IP地址 子网掩码  删除接口的IP地址及掩码

clock rate 56000 配置时钟速率(数据包发送频率),DCE串口必须配置这个,否则会导致路由之间ping不通

no shutdown 打开接口

shutdown 关闭接口

exit 返回上层界面

ip route +非直连网段+子网掩码+下一跳地址 AD值 配置静态/默认路由

no ip route +非直连网段+子网掩码+下一跳地址  删除静态/默认路由

show ip route  特权模式下查看路由表

do show ip route  do是把执行命令的环境转到特权模式下

int loopback 0 loopback为虚拟接口

write  保存配置

默认AD值:(0-255,值越低优先级越高)

路由协议  管理距离

直连接口    0

静态路由    1

外部BGP    20

内部EIGRP  90

IGRP       100

OSPF      110

RIP         120

外部EIGRP  170

内部BGP  200

原文链接:https://www.idaobin.com/archives/1706.html

让我恰个饭吧.ヘ( ̄ω ̄ヘ)

支付宝 ——————- 微信
图片加载中图片加载中



恰饭广告

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

80 ÷ 16 =