静态路由实现负载均衡和高可用
interface FastEthernet1/0
ip address 172.17.1.2 255.255.255.0
standby 10 ip 172.17.1.1
standby 10 preempt
standby 10 track Serial0/0 20 <--- 如果S0/0 down了,该HSRP实例的优先级会降低20,
end
interface FastEthernet1/0
ip address 172.17.1.3 255.255.255.0
standby 10 ip 172.17.1.1
standby 10 priority 90
standby 10 preempt
standby 10 track Serial0/0 20
end
interface FastEthernet1/0
ip address 172.17.1.2 255.255.255.0
standby 20 ip 172.17.1.1
standby 20 preempt
standby 20 track Serial0/0 20
end
ip address 172.17.1.3 255.255.255.0
standby 20 ip 172.17.1.1
standby 20 priority 90
standby 20 preempt
standby 20 track Serial0/0 20
end
R1#sh ip int bri
Interface IP-Address OK? Method Status Proocol
Serial0/0 10.0.0.1 YES manual up up
FastEthernet1/0 172.17.1.2 YES manual up up
Loopback0 172.17.251.1 YES manual up up
......
172.17.0.0/24 is subnetted, 3 subnets
S 172.17.252.0 [1/0] via 172.17.1.3 <-- next hop R2
[1/0] via 10.0.0.2 <-- next hop R3
C 172.17.251.0 is directly connected, Loopback0
C 172.17.1.0 is directly connected, FastEthernet1/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0/0
......
S 172.17.252.0 [1/0] via 10.0.1.2
S 172.17.251.0 [1/0] via 172.17.1.2
C 172.17.1.0 is directly connected, FastEthernet1/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.1.0 is directly connected, Serial0/0
172.17.0.0/24 is subnetted, 3 subnets
C 172.17.252.0 is directly connected, Loopback0
S 172.17.251.0 [1/0] via 172.17.1.3 <-- next hop R4
[1/0] via 10.0.0.1 <-- next hop R1
C 172.17.1.0 is directly connected, FastEthernet1/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0/0
Interface IP-Address OK? Method Status Protocol
Serial0/0 10.0.1.2 YES manual up up
FastEthernet1/0 172.17.1.3 YES manual up up
R4#sh ip route
172.17.0.0/24 is subnetted, 3 subnets
S 172.17.252.0 [1/0] via 172.17.1.2
S 172.17.251.0 [1/0] via 10.0.1.1
C 172.17.1.0 is directly connected, FastEthernet1/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.1.0 is directly connected, Serial0/0
配置好了,我们来验证一下。我们在R1上使用扩展ping,并且记录路由:
R1#ping
Protocol [ip]:
Target IP address: 172.17.252.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 172.17.251.1
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]: R
Number of hops [ 9 ]:
Loose, Strict, Record, Timestamp, Verbose[RV]:
Sweep range of sizes [n]:
Type escape sequence to abort.
......
Record route:
(172.17.1.2)
(10.0.1.1)
(172.17.1.3)
(172.17.252.1)
(172.17.1.2)
(10.0.1.2)
(172.17.1.3)
(172.17.251.1) <*>
(0.0.0.0)
End of list
Total option bytes= 40, padded length=40
Record route:
(10.0.0.1)
(172.17.252.1)
(10.0.0.2)
(172.17.251.1) <*>
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
(0.0.0.0)
End of list
Total option bytes= 40, padded length=40
Record route:
(172.17.1.2)
(10.0.1.1)
......
可以看出,两条线路都正常时,负载跑在两条线路上。
R1#sh ip int bri
Interface IP-Address OK? Method Status Protocol
Serial0/0 10.0.0.1 YES manual administratively down down
FastEthernet1/0 172.17.1.2 YES manual up up
Loopback0 172.17.251.1 YES manual up up
R1#sh ip route
172.17.0.0/24 is subnetted, 3 subnets
S 172.17.252.0 [1/0] via 172.17.1.3
C 172.17.251.0 is directly connected, Loopback0
C 172.17.1.0 is directly connected, FastEthernet1/0
172.17.0.0/24 is subnetted, 3 subnets
S 172.17.252.0 [1/0] via 10.0.1.2
S 172.17.251.0 [1/0] via 172.17.1.2
C 172.17.1.0 is directly connected, FastEthernet1/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.1.0 is directly connected, Serial0/0
Interface IP-Address OK? Method Status Protocol
Serial0/0 10.0.0.2 YES manual up down
FastEthernet1/0 172.17.1.2 YES manual up up
Loopback0 172.17.252.1 YES manual up up
R3#sh ip route
172.17.0.0/24 is subnetted, 3 subnets
C 172.17.252.0 is directly connected, Loopback0
S 172.17.251.0 [1/0] via 172.17.1.3
C 172.17.1.0 is directly connected, FastEthernet1/0
172.17.0.0/24 is subnetted, 3 subnets
S 172.17.252.0 [1/0] via 172.17.1.2
S 172.17.251.0 [1/0] via 10.0.1.1
C 172.17.1.0 is directly connected, FastEthernet1/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.1.0 is directly connected, Serial0/0
R1#ping
Protocol [ip]:
Target IP address: 172.17.252.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 172.17.251.1
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]: R
Number of hops [ 9 ]:
Loose, Strict, Record, Timestamp, Verbose[RV]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Reply to request 0 (172 ms).
Record route:
(172.17.1.2)
(10.0.1.1)
(172.17.1.3)
(172.17.252.1)
(172.17.1.2)
(10.0.1.2)
(172.17.1.3)
(172.17.251.1) <*>
(0.0.0.0)
End of list
Record route:
(172.17.1.2)
(10.0.1.1)
(172.17.1.3)
(172.17.252.1)
(172.17.1.2)
(10.0.1.2)
(172.17.1.3)
(172.17.251.1) <*>
(0.0.0.0)
End of list
Record route:
(172.17.1.2)
(10.0.1.1)
(172.17.1.3)
(172.17.252.1)
(172.17.1.2)
(10.0.1.2)
(172.17.1.3)
(172.17.251.1) <*>
(0.0.0.0)
End of list
R1#
可以看出,一条线路失败后,所有负载都跑在正常的线路上。
R1#sh run
interface Serial0/0
ip address 10.0.0.1 255.255.255.252
ip nat outside
!
interface FastEthernet1/0
ip address 172.17.1.2 255.255.255.0
ip nat inside
!
ip nat inside source static 172.17.1.100 172.17.251.100
interface Serial0/0
ip address 10.0.1.1 255.255.255.252
ip nat outside
!
interface FastEthernet1/0
ip address 172.17.1.3 255.255.255.0
ip nat inside
!
ip nat inside source static 172.17.1.100 172.17.251.100
interface Serial0/0
ip address 10.0.0.2 255.255.255.252
ip nat outside
!
interface FastEthernet1/0
ip address 172.17.1.2 255.255.255.0
ip nat inside
!
ip nat inside source static 172.17.1.100 172.17.252.100
interface Serial0/0
ip address 10.0.1.2 255.255.255.252
ip nat outside
!
interface FastEthernet1/0
ip address 172.17.1.3 255.255.255.0
ip nat inside
!
ip nat inside source static 172.17.1.100 172.17.252.100
然后,在客户A的应用服务器上(笔者在设计阶段,用的是模拟器,故用模拟的路由器代替客户A和B的应用服务器)执行扩展ping,并记录路由:
ClientA#ping
Protocol [ip]:
Target IP address: 172.17.252.100
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface:
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Number of hops [ 9 ]:
Loose, Strict, Record, Timestamp, Verbose[RV]:
Sweep range of sizes [n]:
Reply to request 0 (292 ms).
Record route:
(172.17.1.100)
(172.17.1.2)
(10.0.1.1)
(172.17.1.3)
(172.17.1.100)
(172.17.1.100)
(172.17.1.2)
(10.0.1.2)
(172.17.1.3)
<*>
End of list
Record route:
(172.17.1.100)
(10.0.0.1)
(172.17.1.2)
(172.17.1.100)
(172.17.1.100)
(10.0.0.2)
(172.17.1.2)
(172.17.1.100) <*>
(0.0.0.0)
End of list
Total option bytes= 40, padded length=40
Record route:
(172.17.1.100)
(172.17.1.2)
(10.0.1.1)
(172.17.1.3)
(172.17.1.100)
(172.17.1.100)
(172.17.1.2)
(10.0.1.2)
(172.17.1.3)
<*>
End of list
至于一条线路失效后的情况,也跟前面未配置NAT时的情况一样,跟我们预期的一致。
转载于:https://blog.51cto.com/zoukejian/57610
静态路由实现负载均衡和高可用相关推荐
- 用haproxy结合keepalived实现基于LNMP的负载均衡和高可用
今天我们讲haproxy结合keepalived实现LNMP的负载均衡和高可用,现在的公司大部分都基于haproxy实现负载均衡.下面以一个事例去给大家详细讲解如何去实现: 一.用haproxy结合k ...
- keepalived介绍和keepalived实现nginx负载均衡机高可用
1. keepalived简介 1.1 keepalived是什么? Keepalived 软件起初是专为LVS负载均衡软件设计的,用来管理并监控LVS集群系统中各个服务节点的状态,后来又加入了可以实 ...
- LVS实现负载均衡及高可用
LVS实现负载均衡及高可用 1 实验环境 1.1 虚拟机最小化封装 1.1.1 虚拟机母机安装 1.1.2 清理和压缩母机 1.1.3 创建子机 1.2 名词理解 2 lvs的工作模式 2.1 NAT ...
- TCP接入层的负载均衡、高可用、扩展性架构
转载自 TCP接入层的负载均衡.高可用.扩展性架构 一.web-server的负载均衡 互联网架构中,web-server接入一般使用nginx来做反向代理,实施负载均衡.整个架构分三层: 上游调用层 ...
- nginx负载均衡和高可用
代理和负载均衡的区别 代理负责把连接请求直接转发到后台某个web节点 负载均衡负责把请求使用某种调度算法分散发布给后台所有web节点 ----------------------------- ...
- 微服务负载均衡实现高可用_使用负载平衡实现大容量可用性
微服务负载均衡实现高可用 Written by Yona Gidalevitz 由Yona Gidalevitz撰写 Most users of the web are blissfully unaw ...
- LVS的三种负载均衡以及高可用原理(VS/NAT、VS/TUN、VS/DR)
LVS LVS(Linux Virtual Server)是一个虚拟的服务器集群(Cluster)系统,采用IP负载均衡技术和基于内容请求分发技术.调度器具有很好的吞吐率,将请求均衡地转移到不同的服务 ...
- haproxy+keepalived实现负载均衡及高可用
HAProxy是一个使用C语言编写的自由及开放源代码软件,其提供高性能性.负载均衡,以及基于TCP和HTTP的应用程序代理.相较与 Nginx,HAProxy 更专注与反向代理,因此它可以支持更多的选 ...
- keepalived_nginx实现discuz负载均衡和高可用
前言: 上回讲到,<lvs-dr模型负载均衡高可用Discuz>,但是由于lvs过于重量级,小公司使用有点不合时宜,本回咱们使用nginx实现此功能.望各位博友笑纳. 此次试验使用ngin ...
最新文章
- Page页面生命周期——微信小程序
- 【转】5个常用的深度学习框架
- c++ vector 一部分_C++逆向学习(二) vector
- 浅谈虚拟化技术下的云安全如何处置
- PhpStorm代码换行设置
- flash socket通信问题
- NHibernate 对分组聚合支持的不好
- Java编译过程、c/c++编译过程区别
- java中quickhit_关于java的QuickHit打字游戏小项目
- Lucene 和 Elastic
- android实践练习_android 练习之路 (四)
- centos7上的图形化界面svn客户端_基于windows平台的SVN教程。
- 杭电1710 (已知二叉树前中序 求后序)
- linux运维必学python吗_Python学习资源整理
- 新手指南:顶象验证码如何接入微信小程序?
- SAP License:SAP系统备料发货时的流程规范
- 关于周报的写法和原则
- 成功举办!805个团队参赛~
- 一键解决2K分辨率下ubuntu图标及文字太小问题
- 免费思维导图软件, 简单脑图工具,支持导出图片
热门文章
- python基于经纬度距离汇聚点_python实现两个经纬度点之间的距离和方位角
- springboot templates读取不到_精通 Spring Boot 系列 04
- java 定义全局变量_都说变量有七八种,到底谁是 Java 的亲儿子
- 体重 年龄 性别 身高 预测鞋码_孩子身高低于同龄人就说明发育迟缓?这个简单公式可以算出来...
- Part Five 音视频API
- 国家二级计算机vb考试题型,2015全国计算机等级考试二级VB题型分析
- 传送大文件到服务器,大文件传送服务器
- jfinal 源码中文乱码解决
- 对Redis单线程的一些看法
- VB提取字符串中的日期