关于局域网的高可用性的基础知识请参阅
http://donghao123.blog.51cto.com/4879169/986366 此处不再过多解释
设备简介:
本人使用 两台华为路由器 quidway 2600 serices
测试环境:
两台 pc 配置为
pc1
pc2
网络拓扑图
案例一:浮动路由配置
R4 的配置文件如下:
interface Ethernet0
ip address 192.168.1.254 255.255.255.0
ospf enable area 0.0.0.0
interface Serial0
ip address 192.168.2.1 255.255.255.0
ospf enable area 0.0.0.0
interface Serial1
ip address 192.168.4.1 255.255.255.0
ospf enable
ip route-static 192.168.3.0 255.255.255.0 192.168.4.2 preference 60
R14的配置文件如下:
interface Ethernet0
ip address 192.168.3.254 255.255.255.0
ospf enable area 0.0.0.0 //在 ethernet 0 口 启用ospf
interface Serial0
link-protocol ppp
ip address 192.168.2.2 255.255.255.0
ospf enable area 0.0.0.0 //在serial 0 口启用ospf
interface Serial1
link-protocol ppp
ip address 192.168.4.2 255.255.255.0
ospf enable //全局性启用ospf协议
ip route-static 192.168.1.0 255.255.255.0 192.168.4.1 preference 60
//添加的默认路由
在 R14上对serial 线路进行重置
[R14-Serial0]shut
[R14-Serial0]undo shut
% Interface Serial0 is reset
%01:17:09: Interface Serial0 is UP
%01:17:10: Line protocol ip on the interface Serial0 is UP
[R14-Serial0]int ser 1
[R14-Serial1]shut
% Interface Serial1 is shut down
%01:17:37: Interface Serial1 is DOWN
[R14-Serial1]undo shut
% Interface Serial1 is reset
R4 的路由表
[R4]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Direct 0 0 192.168.1.254 Ethernet0
192.168.1.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.2.0/24 Direct 0 0 192.168.2.2 Serial0
192.168.2.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.2.2/32 Direct 0 0 192.168.2.2 Serial0
192.168.3.0/24 OSPF 10 1572 192.168.2.2 Serial0
192.168.4.0/24 Direct 0 0 192.168.4.2 Serial1
192.168.4.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.2/32 Direct 0 0 192.168.4.2 Serial1
R14 的路由表
[R14]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 OSPF 10 1572 192.168.2.1 Serial0
192.168.2.0/24 Direct 0 0 192.168.2.1 Serial0
192.168.2.1/32 Direct 0 0 192.168.2.1 Serial0
192.168.2.2/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.3.0/24 Direct 0 0 192.168.3.254 Ethernet0
192.168.3.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.0/24 Direct 0 0 192.168.4.1 Serial1
192.168.4.1/32 Direct 0 0 192.168.4.1 Serial1
192.168.4.2/32 Direct 0 0 127.0.0.1 LoopBack0
网络追踪测试
pc2---》pc1
网络追踪测试
pc1---》pc2
模拟关闭ospf链路
[R14-Serial0]shut
% Interface Serial0 is shut down
[R14-Serial0]
%01:21:24: Interface Serial0 is DOWN
%01:21:24: Line protocol ip on the interface Serial0 is DOWN
静态的备份路由已经启动
[R14]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Static 60 0 192.168.4.1 Serial1
192.168.3.0/24 Direct 0 0 192.168.3.254 Ethernet0
192.168.3.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.0/24 Direct 0 0 192.168.4.1 Serial1
192.168.4.1/32 Direct 0 0 192.168.4.1 Serial1
192.168.4.2/32 Direct 0 0 127.0.0.1 LoopBack0
[R4]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Direct 0 0 192.168.1.254 Ethernet0
192.168.1.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.3.0/24 Static 60 0 192.168.4.2 Serial1
192.168.4.0/24 Direct 0 0 192.168.4.2 Serial1
192.168.4.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.2/32 Direct 0 0 192.168.4.2 Serial1
[R4]
网络追踪测试
pc2---》pc1
网络追踪测试
pc1---》pc2
重新开启serial 0 网卡
[R14]int ser 0
[R14-Serial0]undo shut
% Interface Serial0 is reset
%01:24:24: Interface Serial0 is UP
%01:24:25: Line protocol ip on the interface Serial0 is UP
此时的ospf主链路成功启用
案例二:主备模式
由于ospf是动态的路由协议。我们再此使用静态代替ospf进行测试。不修改也可以。
在全局模式下执行“undo ospf enable”
R4的配置
[R4]ip rou 192.168.3.0 255.255.255.0 192.168.2.2
此时的路由表为:
[R4]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Direct 0 0 192.168.1.254 Ethernet0
192.168.1.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.2.0/24 Direct 0 0 192.168.2.2 Serial0
192.168.2.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.2.2/32 Direct 0 0 192.168.2.2 Serial0
192.168.3.0/24 Static 60 0 192.168.2.2 Serial0
192.168.4.2 Serial1
192.168.4.0/24 Direct 0 0 192.168.4.2 Serial1
192.168.4.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.2/32 Direct 0 0 192.168.4.2 Serial1
配置备份的相关参数
[R4-Serial0]stan int ser 1
%01:31:40: 接口Serial1当前状态变为DOWN
%01:31:40: ip协议在Serial1上状态变为DOWN!
[R4-Serial0]sta time enable 2
[R4-Serial0]sta time disable 2
R14的配置
[R14]undo ospf enable
Terminate OSPF task...
OSPF disabled
添加默认路由
[R14]ip rou 192.168.1.0 255.255.255.0 192.168.2.1
R14的路由表
[R14]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Static 60 0 192.168.2.1 Serial0
192.168.4.1 Serial1
192.168.2.0/24 Direct 0 0 192.168.2.1 Serial0
192.168.2.1/32 Direct 0 0 192.168.2.1 Serial0
192.168.2.2/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.3.0/24 Direct 0 0 192.168.3.254 Ethernet0
192.168.3.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.0/24 Direct 0 0 192.168.4.1 Serial1
192.168.4.1/32 Direct 0 0 192.168.4.1 Serial1
192.168.4.2/32 Direct 0 0 127.0.0.1 LoopBack0
[R14]
配置备份
[R14-Serial0]stan int ser 1
%01:33:40: 接口Serial1当前状态变为DOWN
%01:33:40: ip协议在Serial1上状态变为DOWN!
[R14-Serial0]sta time enable 2
[R14-Serial0]sta time disable 2
R14的路由表如下
[R14]dis ip rou
路由表:
目的地址/掩码 协议 优先级 度量 下一跳 接口
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Static 60 0 192.168.2.1 Serial0
192.168.2.0/24 Direct 0 0 192.168.2.1 Serial0
192.168.2.1/32 Direct 0 0 192.168.2.1 Serial0
192.168.2.2/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.3.0/24 Direct 0 0 192.168.3.254 Ethernet0
192.168.3.254/32 Direct 0 0 127.0.0.1 LoopBack0
[R14]
测试:
pc2---》pc1
pc1---》pc2
关闭链路并查看路由表
[R4-Serial0]shutdown
%01:42:07: Interface Serial0 is DOWN
%01:42:07: Line protocol ip on the interface Serial0 is DOWN
%01:42:14: Interface Serial1 is UP
%01:42:14: Line protocol ip on the interface Serial1 is UP
[R4]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Direct 0 0 192.168.1.254 Ethernet0
192.168.1.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.3.0/24 Static 60 0 192.168.4.2 Serial1
192.168.4.0/24 Direct 0 0 192.168.4.2 Serial1
192.168.4.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.2/32 Direct 0 0 192.168.4.2 Serial1
[R14]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Static 60 0 192.168.4.1 Serial1
192.168.3.0/24 Direct 0 0 192.168.3.254 Ethernet0
192.168.3.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.0/24 Direct 0 0 192.168.4.1 Serial1
192.168.4.1/32 Direct 0 0 192.168.4.1 Serial1
192.168.4.2/32 Direct 0 0 127.0.0.1 LoopBack0
[R14]
测试:
pc2---》pc1
pc1---》pc2
案例三:链路捆绑
针对standby链路进行修改。
删除不必要的配置
R14的配置
[R14-Serial0]undo standby interface Serial 1
[R14]undo ip route-static 192.168.1.0 255.255.255.0 192.168.4.1
[R14]Undo ip route-static 192.168.1.0 255.255.255.0 192.168.2.1
[R14]int ser 1
[R14-Serial1]undo ip address
[R14]int ser 1
[R14-Serial1]undo ip address
[R14-Serial0]int vi 1
[R14-Virtual-Template1]ip add 192.168.6.2 24
[R14-Serial0]int vi 1
[R14-Virtual-Template1]ppp mp
[R14]ip rou 192.168.1.0 255.255.255.0 192.168.6.1
[R14] Serial0
[R14-Serial0]ppp mp
[R4-Serial0]int ser 1
[R14-Serial1]ppp mp
[R14-Serial1]
%02:15:00: Line protocol ip on the interface Virtual-Template1(Virtual-Template1:0) is UP
路由表:
[R14]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Static 60 0 192.168.6.1 Virtual-Template1
192.168.3.0/24 Direct 0 0 192.168.3.254 Ethernet0
192.168.3.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.6.0/24 Direct 0 0 192.168.6.2 Virtual-Template1
192.168.6.2/32 Direct 0 0 127.0.0.1 LoopBack0
R4的配置
[R4-Serial0]undo standby interface Serial 1
[R4]undo ip route-static 192.168.3.0 255.255.255.0 192.168.4.2
[R4]undo ip route-static 192.168.3.0 255.255.255.0 192.168.2.2
[R4]int ser 0
[R4-Serial0]undo ip add
%02:01:57: Line protocol ip on the interface Serial0 is DOWN
[R4-Serial1]ppp mp
[R4-Serial0]int ser 1
[R4-Serial1]undo ip add
[R4-Serial1]ppp mp
[R4]int vi 1
[R4-Virtual-Template1]ip add 192.168.6.1 24
[R4-Virtual-Template1]ppp mp
添加默认路由
[R4]ip rou 192.168.3.0 255.255.255.0 192.168.6.2
R4的路由表
[R4]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Direct 0 0 192.168.1.254 Ethernet0
192.168.1.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.3.0/24 Static 60 0 192.168.6.2 Virtual-Template1
192.168.6.0/24 Direct 0 0 192.168.6.1 Virtual-Template1
192.168.6.1/32 Direct 0 0 127.0.0.1 LoopBack0
[R4]
路由追踪 pc2--->pc1
路由追踪 pc1--->pc2
[R14-Serial0]shu
% Interface Serial0 is shut down
%02:17:44: Interface Serial0 is DOWN
网络依旧
[R14-Serial0]und shu
% Interface Serial0 is reset
%02:18:09: Interface Serial0 is UP
网络追踪 pc2--->pc1
网络追踪 pc1--->pc2
这是比较好的!!!方案 费用较高!!
嗯,韩语说得对!!!