当前位置:文档之家› 多链路负载均衡标准结构及阐述

多链路负载均衡标准结构及阐述

多链路负载均衡标准结构及阐述F5 Networks Inc.Owen Yu2004-12-1目录一、F5多链路负载均衡标准结构 (3)1.1 标准结构拓扑图 (3)1.2 技术阐述 (3)二、域名解析方式 (10)2.1 Root DNS Server直接与F5多链路负载均衡器配合 (10)2.1.1 CNAME方式 (10)2.1.2 NS委派方式 (11)2.2 Root DNS Server通过第三方DNS Server与F5多链路负载均衡器配合 (12)2.2.1 CNAME方式 (12)2.2.2 NS方式 (13)三、F5多链路负载均衡其它结构及阐述 (14)3.1冗余结构 (14)3.2与防火墙配合的结构 (15)3.2.1后置防火墙 (15)3.2.2前置防火墙 (16)一、F5多链路负载均衡标准结构1.1 标准结构拓扑图下图是F5多出口链路负载均衡解决方案的标准结构(单台设备)。

1.2 技术阐述网络环境描述上图中F5 多链路负载均衡设备通过ISP1和ISP2接入Internet。

每个ISP 都分配给该网络一个IP地址网段,假设ISP1分配的地址段为100.1.1.0/24,ISP2分配的地址段为200.1.1.0/24(此处的200.1.1.0/24表示网络IP地址段为:200.1.1.0,子网掩码为24位,即255.255.255.0)。

同样,Internet知道通过ISP1访问100.1.1.0/24,通过ISP2访问200.1.1.0/24。

网络中的主机和服务器都属于私有网段192.168.1.0/24。

F5多链路负载均衡设备解决方案就是在内部交换机和连接ISP的路由器之间,跨接一台多链路负载均衡设备应用交换机,所有的地址翻译和Internet链路优化全部由多链路负载均衡设备来完成。

Outbound技术实现¾Default Gateway PoolFor Example: pool default_gateway_pool {lb_method dynamic_ratiomember 100.1.1.1:0member 200.1.1.1:0}Default Gateway Pool中的Nodes为若干个下一跳路由器(Next Hop Router)的地址,用作Outbound负载均衡,可以通过三种方式生成。

1、 SetupUtility中配置多个Gateway IP,用空格分开;2、在Configuration Utility中Link Configuration下增加多个links;3、在Pool中定义一个Default Gateway Pool。

For Example:default_gateway use pool default_gateway_pool将Default Gateway Pool中的Nodes配置为F5多链路负载均衡器的Default Gateway,可以通过netstat –rn命令查看路由表。

Destination Gateway Flags MTU If default 100.1.1.1 UGS 1500 vlan2 default 200.1.1.1 UGS 1500 vlan3 ¾ MonitorFor example: node 100.1.1.1 200.1.1.1 monitor use icmpF5多链路负载均衡器可以通过相应的配置,检查NHR或更上层Router 的连通状态来决定链路的可用性,并且可以使用ICMP /TCP等多种测试方法¾Load Balancing MethodFor example: lb_method dynamic_ratio服务器负载均衡的各种静态和动态算法都可以被使用。

dynamic_ratio是Default Gateway Pool的默认算法,除了能够按照Ratio来分配流量外,还能够集成SNMP Agent环境。

¾ PersistenceFor example: persist simplesimple_timeout 1800在Outbound负载均衡中,经常使用到Simple Persistence来保证特殊的应用,例如:MSN,QQ,流媒体等即时应用,能够保持在同一条链路上,一般计时器配置为900秒或1800秒超时。

¾Wildcart Virtual ServerFor example:virtual internal:* unit 1 {use pool default_gateway_pool}上面配置中的*代表0.0.0.0:0这个特殊的Virtual Server,称为Wildcart Virtual Server,用来表示访问外网任意地址和服务端口,也可以配置为0.0.0.0:80等等,这样Outbound流量会先命中0.0.0.0:80这个Virtual Server,然后再命中0.0.0.0:0这个Virtual Serve。

¾Virtual Service PropertyFor example:service 80 timeout udp 30service 80 timeout tcp 600service 80 21 3389 5631 25 110 9981 1433 tcp enable 默认状态下,F5链路负载均衡设备只开放TCP端口访问,需要手动打开UDP端口以及Any IP(ICMP,Traceroute等)的访问允许。

由于TCP/UDP Timeout时间直接影响到F5链路负载均衡设备内存的开销,因此在Outbound流量非常大的时候,尤其是攻击有时发生的情况下,可以适当调整TCP/UDP Timeout值。

¾ SNATFor example:snat map { 192.168.1.34 to 100.1.1.34 unit 1 }snat map { 192.168.1.35 to 200.1.1.35 unit 1 }snat map { internal to auto unit 1 }SNAT(Secure NAT)通过将源地址翻译成可路由的地址,来访问外网。

SNAT IP能够等于Virtual Server IP,可以用来解决特殊应用(例如:Email转发)的地址反向解析问题;SNAT Automap将源地址翻译成F5多链路负载均衡的Vlan SelfIP,由于Vlan SelfIP可以是多个地址,因此能够实现SNAT一个地址池的目的。

¾ IrulesFor example: if (server_addr ==one of ISP1_Class) {Use pool ISP1_Pool}else if (server_addr ==one of ISP2_Class) {Use pool ISP2_Pool}else {Use pool Default_Gateway_Pool}在Outbound负载均衡中,iRules经常被配置用来进行复杂的链路选择,这里的ISP1_Class和ISP2_Class可能包含许多地址或地址段,使用one of命令就不需要在iRules中写许多Class涵盖的具体内容。

Inbound技术实现¾ Wild IPFor example: wideip {address X.X.X.Xport 0 // 0name ""ttl 30qos_coeff {rtt 0hops 0completion_rate 0packet_rate 0vs_capacity 0kbps 0topology 0lcs 1000}pool {name "Pool"dynamic_ratio yespreferred rttalternate gafallback rraddress 100.1.1.100:80address 200.1.1.100:80}}由于F5多链路负载均衡器中涵盖了部分DNS功能,可以进行域名的A记录和*记录解析。

Wide IP就是一个主机名的A记录或者*记录。

¾ TTLFor example:ttl 30为防止客户的Local DNS (就是客户的TCP/IP中配置的DNS地址)Cache住DNS的解析内容而发生ISP链路中断,而客户的访问请求仍然没有修正的情况,可以将F5多链路负载均衡器的DNS解析的TTL时间根据容错切换时间要求相应改小,就可以保证客户可以及时更新访问的目标地址了。

¾Load Balancing MethodFor example: preferred rttalternate gafallback rrF5多链路负载均衡器支持多种Inbound负载均衡算法: Completion Rate,Global Availability,hops,kilobytes/second,leastconnections,Packet Rate,Quality of Service,Random,Ratio,RoundRobin,Round Trip Time,Static Persist,VS Capacity。

在链路备份应用中,推荐Global Availability算法;在链路负载均衡应用中,推荐Round Trip Time算法或者Quality of Service算法。

¾ Virtual ServerFor example: address 100.1.1.100:80address 200.1.1.100:80virtual 100.1.1.100:http unit 1 {use pool pool_122}virtual 200.1.1.100:ftp unit 1 {use pool pool_122}F5多链路负载均衡器不但具备多链路负载均衡功能,而且具备服务器负载均衡功能,所以,Wide IP可以指向到一个或多个Virtual Server,进行服务器负载均衡。

¾ Forwarding PoolFor example: pool forwarding_pool {forward}有的情况下,既不需要地址翻译,有不需要服务器负载均衡,但是又需要pool的一些特性时(例如:Auto Lasthop),必须配置Forwarding Pool。

¾Auto Lasthop / Lasthop poolF5的Lasthop功能,称为基于连接的路由,用在F5处理数据包回应时,会根据上一跳路由设备的MAC地址,确定返回路径,以便正确返回给最初发起访问数据包的网络设备。

相关主题