idnits 2.17.1 draft-carpenter-flow-label-balancing-00.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (May 8, 2012) is 4368 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- ** Obsolete normative reference: RFC 2460 (Obsoleted by RFC 8200) ** Obsolete normative reference: RFC 6434 (Obsoleted by RFC 8504) -- Obsolete informational reference (is this intentional?): RFC 2629 (Obsoleted by RFC 7749) Summary: 2 errors (**), 0 flaws (~~), 1 warning (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group B. Carpenter 3 Internet-Draft Univ. of Auckland 4 Intended status: Informational S. Jiang 5 Expires: November 9, 2012 Huawei Technologies Co., Ltd 6 W. Tarreau 7 Exceliance 8 May 8, 2012 10 Using the IPv6 Flow Label for Server Load Balancing 11 draft-carpenter-flow-label-balancing-00 13 Abstract 15 This document describes how the IPv6 flow label as currently 16 specified can be used to enhance layer 3/4 load distribution and 17 balancing for large server farms. 19 Status of this Memo 21 This Internet-Draft is submitted in full conformance with the 22 provisions of BCP 78 and BCP 79. 24 Internet-Drafts are working documents of the Internet Engineering 25 Task Force (IETF). Note that other groups may also distribute 26 working documents as Internet-Drafts. The list of current Internet- 27 Drafts is at http://datatracker.ietf.org/drafts/current/. 29 Internet-Drafts are draft documents valid for a maximum of six months 30 and may be updated, replaced, or obsoleted by other documents at any 31 time. It is inappropriate to use Internet-Drafts as reference 32 material or to cite them other than as "work in progress." 34 This Internet-Draft will expire on November 9, 2012. 36 Copyright Notice 38 Copyright (c) 2012 IETF Trust and the persons identified as the 39 document authors. All rights reserved. 41 This document is subject to BCP 78 and the IETF Trust's Legal 42 Provisions Relating to IETF Documents 43 (http://trustee.ietf.org/license-info) in effect on the date of 44 publication of this document. Please review these documents 45 carefully, as they describe your rights and restrictions with respect 46 to this document. Code Components extracted from this document must 47 include Simplified BSD License text as described in Section 4.e of 48 the Trust Legal Provisions and are provided without warranty as 49 described in the Simplified BSD License. 51 Table of Contents 53 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 54 2. Summary of Flow Label Specification . . . . . . . . . . . . . 3 55 3. Summary of Load Balancing Techniques . . . . . . . . . . . . . 4 56 4. Applying the Flow Label to L3/L4 Load Balancing . . . . . . . 7 57 5. Security Considerations . . . . . . . . . . . . . . . . . . . 9 58 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10 59 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 10 60 8. Change log [RFC Editor: Please remove] . . . . . . . . . . . . 10 61 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 10 62 9.1. Normative References . . . . . . . . . . . . . . . . . . . 10 63 9.2. Informative References . . . . . . . . . . . . . . . . . . 11 64 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 11 66 1. Introduction 68 The IPv6 flow label has been redefined [RFC6437] and is now a 69 recommended IPv6 node requirement [RFC6434]. Its use for load 70 sharing in multipath routing has been specified [RFC6438]. Another 71 scenario in which the flow label could be used is in load 72 distribution for large server farms. Load distribution is a slightly 73 more general term than load balancing, but the latter is more 74 commonly used. This document starts with brief introductions to the 75 flow label and to load balancing techniques, and then describes how 76 the flow label can be used to enhance layer 3/4 load balancers in 77 particular. 79 The motivation for this approach is to improve the performance of 80 most types of layer 3/4 load balancers, especially for traffic 81 including multiple IPv6 extension headers and in particular for 82 fragmented packets. Fragmented packets, often the result of 83 customers reaching the load balancer via a VPN with a limited MTU, 84 are a common performance problem. 86 2. Summary of Flow Label Specification 88 The IPv6 flow label is a 20 bit field included in every IPv6 header 89 [RFC2460]. It is recommended to be supported in all IPv6 nodes by 90 [RFC6434] and it is defined in [RFC6437]. According to this 91 definition, the flow label should be set to a constant value for a 92 given traffic flow (such as an HTTP connection). 94 Any device that has access to the IPv6 header has access to the flow 95 label, and it is at a fixed position in every IPv6 packet. In 96 contrast, transport layer information, such as the port numbers, is 97 not always in a fixed position, since it follows any IPv6 extension 98 headers that may be present. Therefore, within the lifetime of a 99 given transport layer connection, the flow label can be a more 100 convenient "handle" than the port number for identifying that 101 particular connection. 103 According to RFC 6437, source hosts should set the flow label, but if 104 they do not (i.e. its value is zero), forwarding nodes (such as the 105 first-hop router) may set it instead. In both cases, the flow label 106 value must be constant for a given transport session, normally 107 identified by the IPv6 and Transport header 5-tuple. By default, the 108 flow label value should be calculated by a stateless algorithm. The 109 resulting value should form part of a statistically uniform 110 distribution. 112 A careful reading of RFC 6437 shows that for a given source accessing 113 a well-known TCP port at a given destination, the flow label is in 114 effect a substitute for the source port number, found at a fixed 115 position in the layer 3 header. 117 The flow label is defined as an end-to-end component of the IPv6 118 header, but there are three qualifications to this: 120 1. Until the RFC 6437 standard is widely implemented as recommended 121 by RFC 6434, the flow label will often be set to the default 122 value of zero. 123 2. Because of the recommendation to use a stateless algorithm to 124 calculate the label, there is a very low (but non-zero) 125 probability that two simultaneous flows from the same source to 126 the same destination have the same flow label value despite 127 having different transport protocol port numbers. 128 3. The flow label field is in an unprotected part of the IPv6 129 header, which means that intentional or unintentional changes to 130 its value cannot be trivially detected by a receiver. 132 The first two points are addressed below in Section 4 and the third 133 in Section 5. 135 3. Summary of Load Balancing Techniques 137 Load balancing for server farms is achieved by a variety of methods, 138 often used in combination [Tarreau]. The flow label is not relevant 139 to all of them, and the actual load balancing algorithm (the choice 140 of which server to use for a new client session) is irrelevant to 141 this discussion. 143 o The simplest method is simply using the DNS to return different 144 server addresses for a single name such as www.example.com to 145 different users. Typically this is done by rotating the order in 146 which different addresses are listed by the relevant authoritative 147 DNS server, assuming that the client will pick the first one. 148 Routing may be configured such that the different addresses are 149 handled by different ingress routers. The flow label can have no 150 impact on this method and it is not discussed further. 151 o Another method, for HTTP servers, is to operate a layer 7 reverse 152 proxy in front of the server farm. The reverse proxy will present 153 a single IP address to the world, communicated to clients by a 154 single AAAA record. For each new client session (an incoming TCP 155 connection and HTTP request), it will pick a particular server and 156 proxy the session to it. Hopefully the act of proxying will be 157 cheap compared to the act of serving the required content. The 158 proxy must retain TCP state and proxy state for the duration of 159 the session. This TCP state could, potentially, include the 160 incoming flow label value. 161 o A component of some load balancing systems is an SSL reverse proxy 162 farm. The individual SSL proxies handle all cryptographic aspects 163 and exchange raw HTTP with the actual servers. Thus, from the 164 load balancing point of view, this really looks just like a server 165 farm, except that it's specialised for HTTPS. Each proxy will 166 retain SSL and TCP and maybe HTTP state for the duration of the 167 session, and the TCP state could potentially include the flow 168 label. 169 o Finally the "front end" of many load balancing systems is a layer 170 3/4 load balancer. While it can sometimes be a dedicated 171 hardware, it also happens to be a standard function of some 172 network switches or routers (eg: using ECMP, [RFC2991]). In this 173 case, it is the layer 3/4 load balancer whose IP address is 174 published as the primary AAAA record for the service. All client 175 sessions will pass through this device. According to the precise 176 scenario, it will spread new sessions across the actual 177 application servers, across an SSL proxy farm, or across a set of 178 layer 7 proxies. In all cases, the layer 3/4 load balancer has to 179 recognize incoming packets as belonging to new or existing client 180 sessions, and choose the target server or proxy so as to ensure 181 persistence. 'Persistence' is defined as guaranteeing that a 182 given session will run to completion on a single server. The 183 layer 3/4 load balancer therefore needs to inspect each incoming 184 packet to identify the session. There are two common types of 185 layer 3/4 load balancers, the totally stateless ones which only 186 act on packets, generally involving a per-packet hashing of easy- 187 to-find information such as the source address and/or port into a 188 server number, and the stateful ones which take the routing 189 decision on the very first packets of a session and maintain the 190 same direction for all packets belonging to the same session. 191 Clearly, both types of layer 3/4 balancers could inspect and make 192 use of the flow label value. 194 Our focus is on how the balancer identifies a particular flow. 195 For clarity, note that two aspects of layer 3/4 load balancers 196 could not be affected by use of the flow label to identify 197 sessions: 199 1. Balancers use various techniques to redirect traffic to a 200 specific target server. 202 - All servers are configured with the same IP address, they 203 are all on the same LAN, and the load balancer sends directly 204 to their individual MAC addresses. 205 - Each server has its own IP address, and the balancer uses an 206 IP-in-IP tunnel to reach it. 207 - Each server has its own IP address, and the balancer 208 performs NAPT (network address and port translation) to 209 deliver the client's packets to that address. 211 The choice between these methods is not affected by use of the 212 flow label. 214 2. A layer 3/4 balancer must correctly handle Path MTU Discovery 215 by forwarding relevant ICMPv6 packets in both directions. 216 This too is not affected by use of the flow label. 218 The following diagram, inspired by [Tarreau], shows a maximum layout. 220 ___________________________________________ 221 ( ) 222 ( Clients in the Internet ) 223 (___________________________________________) 224 | | 225 ------------ ------------ 226 | Ingress | | Ingress | 227 | router | | router | 228 ------------ ------------ 229 ___|_______DNS-based____________|___ 230 | load splitting | 231 | | 232 | | 233 ------------ ------------ 234 | L3/4 ASIC| | L3/4 ASIC| 235 | balancer | | balancer | 236 ------------ ------------ 237 | load | 238 | spreading | 239 __________|________________________|___________ 240 | | | | 241 ------------ ------------ -------- -------- 242 |HTTP proxy|...|HTTP proxy| | SSL |...| SSL | 243 | balancer | | balancer | | proxy| | proxy| 244 ------------ ------------ -------- -------- 245 ____|_____________|_____________|_________|_____ 246 | | | | | 247 -------- -------- -------- -------- -------- 248 |HTTP | |HTTP | |HTTP | |HTTP | |HTTP | 249 |server| |server| |server| |server| |server| 250 -------- -------- -------- -------- -------- 252 From the previous paragraphs, we can identify several points in this 253 diagram where the flow label might be relevant: 255 1. Layer 3/4 load balancers. 256 2. SSL proxies. 257 3. HTTP proxies. 259 However, usage by the proxies seems unlikely to be cost-effective, so 260 in this document we focus only on layer 3/4 balancers. 262 4. Applying the Flow Label to L3/L4 Load Balancing 264 The suggested model for using the flow label in a load balancing 265 mechanism is as follows: 267 o We are only concerned with IPv6 traffic in which the flow label 268 value has been set at or near the source according to [RFC6437]. 269 If the flow label of an incoming packet is zero, load balancers 270 will continue to use the transport header in the traditional way. 271 As the use of the flow label becomes more prevalent according to 272 RFC 6434, load balancers, and therefore users, will reap a growing 273 performance benefit. 274 o If the flow label of an incoming packet is non-zero, layer 3/4 275 load balancers can use the 2-tuple {source address, flow label} as 276 the session key for whatever load distribution algorithm they 277 support. If any IPv6 extension headers, including fragment 278 headers, are present, this will be significantly quicker than 279 searching for the transport port numbers later in the packet. 280 Note that balancers usually do not need to consider the 281 destination address as it is always the same, i.e., the server 282 address. 284 A stateless layer 3/4 load balancer would simply apply a hash 285 algorithm to the 2-tuple {source address, flow label} on all 286 packets, in order to select the same target server consistently 287 for a given flow. 289 A stateful layer 3/4 load balancer would apply its usual load 290 distribution algorithm to the first packet of a session, and store 291 the {2-tuple, server} association in a table so that subsequent 292 packets belonging to the same session are forwarded to the same 293 server. Thus, for all subsequent packets of the session, it can 294 ignore all IPv6 extension headers, which should lead to a 295 performance benefit. Whether this benefit is valuable will depend 296 on engineering details of the specific load balancer. 298 Layer 3/4 balancers that redirect the incoming packets by NAPT are 299 not expected to obtain any saving of time by using the flow label, 300 because they must in any case follow the extension header chain in 301 order to locate and modify the port number and transport checksum. 303 The same would apply to balancers that perform TCP state tracking 304 for any reason. 305 o Note that correct handling of ICMPv6 for Path MTU Discovery 306 requires the layer 3/4 balancer to keep state for the client 307 source address, independently of either the port numbers or the 308 flow label. 309 o An SSL proxy should forward the flow identifier between the 310 ciphered side and the clear side. Being able to forward data used 311 for persistence is very important, as it's the only way to stack 312 multiple layers of network components without losing information. 313 o The HTTP proxies may do the same. However, since they have to 314 process the transport and application layers in any case, this 315 might not lead to any performance benefit. 317 It should be noted that the performance benefit, if any, depends 318 entirely on engineering trade-offs in the design of the L3/L4 319 balancer. An extra test is needed (is the label non-zero?), but all 320 logic for handling extension headers can be omitted except for the 321 first packet of a new flow. Since the only state to be stored is the 322 2-tuple and the server identifier, storage requirements will be 323 reduced. Additionally, the method will work for fragmented traffic 324 and for flows where the transport information is missing (unknown 325 transport protocol) or obfuscated (e.g., IPsec). Traffic reaching 326 the load balancer via a VPN is particularly prone to the 327 fragmentation issue, due to MTU size issues. For some load balancer 328 designs, these are very significant advantages. 330 In the unlikely event of two simultaneous flows from the same source 331 address having the same flow label value, the two flows would end up 332 assigned to the same server, where they would be distinguished as 333 normal by their port numbers. Since this would be a statistically 334 rare event, it would not damage the overall load balancing effect. 335 Moreover, it is very likely that there will be many more flow label 336 values than servers at most sites (1 million possible label values), 337 so it is already expected that multiple flow label values will end up 338 on the same server for a given IP address. In the case where many 339 thousands of clients are hidden behind the same large-scale NAT with 340 a single IP address, the assumption of low probability of conflicts 341 might become incorrect unless flow label values are random enough to 342 avoid following similar sequences for all clients. This is not 343 expected to be a factor for IPv6 anyway, since there is no valid 344 reason to implement NAT [RFC4864]. The statistical assumption is 345 valid for sites that implement network prefix translation [RFC6296], 346 since this technique provides a different address for each client. 348 5. Security Considerations 350 Security aspects of the flow label are discussed in [RFC6437]. As 351 noted there, a malicious source or man-in-the-middle could disturb 352 load balancing by manipulating flow labels. This risk already exists 353 today where the source address and port are used as hashing key in 354 layer 3/4 load balancers, as well as where a persistence cookie is 355 used in HTTP to designate a server. It even exists on layer 3 356 components which only rely on the source address to select a 357 destination, making them more DDoS-prone. Nevertheless, all these 358 methods are currently used because the benefits for load balancing 359 and persistence hugely outweigh the risks. 361 Specifically, [RFC6437] states that "stateless classifiers should not 362 use the flow label alone to control load distribution, and stateful 363 classifiers should include explicit methods to detect and ignore 364 suspect flow label values." The former point is answered by also 365 using the source address. The latter point is more complex. If the 366 risk is considered serious, the site ingress router or the layer 3/4 367 balancer should verify incoming flows with non-zero flow label 368 values. If a flow from a given source address and port number does 369 not have a constant flow label value, it is suspect and should be 370 dropped. This would deal with both intentional and accidental 371 changes to the flow label. 373 RFC 6437 notes in its Security Considerations that if the covert 374 channel risk is considered significant, a firewall might rewrite non- 375 zero flow labels. As long as this is done as described in RFC 6437, 376 it will not invalidate the mechanisms described above. 378 The flow label may be of use in protecting against distributed denial 379 of service (DDOS) attacks against servers. As noted in RFC 6437, a 380 source should generate flow label values that are hard to predict, 381 most likely by including a secret nonce in the hash used to generate 382 each label. The attacker does not know the nonce and therefore has 383 no way to invent flow labels which will all target the same server, 384 even with knowledge of both the hash algorithm and the load balancing 385 algorithm. Still, it is important to understand that it is always 386 trivial to force a load balancer to stick to the same server during 387 an attack, so the security of the whole solution must not rely on the 388 unpredicatability of the flow label values alone, but should include 389 defensive measures like most load balancers already have against 390 abnormal use of source address or session cookies. 392 New flows are assigned to a server according to any of the usual 393 algorithms available on the load balancer (e.g., least connections, 394 round robin, etc.). The association between the flow label value and 395 the server is stored in a table (often called stick table) so that 396 future connections using the same flow label can be sent to the same 397 server. This method is more robust against a loss of server and also 398 makes it harder for an attacker to target a specific server, because 399 the association between a flow label value and a server is not known 400 externally. 402 6. IANA Considerations 404 This document requests no action by IANA. 406 7. Acknowledgements 408 Valuable comments and contributions were made by Fred Baker, Lorenzo 409 Colitti, Joel Jaeggli, Gurudeep Kamat, Julius Volz, and others. 411 This document was produced using the xml2rfc tool [RFC2629]. 413 8. Change log [RFC Editor: Please remove] 415 draft-carpenter-flow-label-balancing-00: restructured after IETF83, 416 2012-05-08. 418 draft-carpenter-v6ops-label-balance-02: clarified after WG 419 discussions, 2012-03-06. 421 draft-carpenter-v6ops-label-balance-01: updated with community 422 comments, additional author, 2012-01-17. 424 draft-carpenter-v6ops-label-balance-00: original version, 2011-10-13. 426 9. References 428 9.1. Normative References 430 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 431 (IPv6) Specification", RFC 2460, December 1998. 433 [RFC6434] Jankiewicz, E., Loughney, J., and T. Narten, "IPv6 Node 434 Requirements", RFC 6434, December 2011. 436 [RFC6437] Amante, S., Carpenter, B., Jiang, S., and J. Rajahalme, 437 "IPv6 Flow Label Specification", RFC 6437, November 2011. 439 9.2. Informative References 441 [RFC2629] Rose, M., "Writing I-Ds and RFCs using XML", RFC 2629, 442 June 1999. 444 [RFC2991] Thaler, D. and C. Hopps, "Multipath Issues in Unicast and 445 Multicast Next-Hop Selection", RFC 2991, November 2000. 447 [RFC4864] Van de Velde, G., Hain, T., Droms, R., Carpenter, B., and 448 E. Klein, "Local Network Protection for IPv6", RFC 4864, 449 May 2007. 451 [RFC6296] Wasserman, M. and F. Baker, "IPv6-to-IPv6 Network Prefix 452 Translation", RFC 6296, June 2011. 454 [RFC6438] Carpenter, B. and S. Amante, "Using the IPv6 Flow Label 455 for Equal Cost Multipath Routing and Link Aggregation in 456 Tunnels", RFC 6438, November 2011. 458 [Tarreau] Tarreau, W., "Making applications scalable with load 459 balancing", 2006, . 461 Authors' Addresses 463 Brian Carpenter 464 Department of Computer Science 465 University of Auckland 466 PB 92019 467 Auckland, 1142 468 New Zealand 470 Email: brian.e.carpenter@gmail.com 472 Sheng Jiang 473 Huawei Technologies Co., Ltd 474 Q14, Huawei Campus 475 No.156 Beiqing Road 476 Hai-Dian District, Beijing 100095 477 P.R. China 479 Email: jiangsheng@huawei.com 480 Willy Tarreau 481 Exceliance 482 R&D Produits reseau 483 3 rue du petit Robinson 484 78350 Jouy-en-Josas 485 France 487 Email: w@1wt.eu