1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only 21da177e4SLinus Torvalds# 31da177e4SLinus Torvalds# IP Virtual Server configuration 41da177e4SLinus Torvalds# 5a6938a1eSJan Engelhardtmenuconfig IP_VS 6f901b644SDavid S. Miller tristate "IP virtual server support" 7864e898bSMasahiro Yamada depends on INET && NETFILTER 8dba4490dSPatrick McHardy depends on (NF_CONNTRACK || NF_CONNTRACK=n) 9a7f7f624SMasahiro Yamada help 101da177e4SLinus Torvalds IP Virtual Server support will let you build a high-performance 111da177e4SLinus Torvalds virtual server based on cluster of two or more real servers. This 121da177e4SLinus Torvalds option must be enabled for at least one of the clustered computers 131da177e4SLinus Torvalds that will take care of intercepting incoming connections to a 141da177e4SLinus Torvalds single IP address and scheduling them to real servers. 151da177e4SLinus Torvalds 161da177e4SLinus Torvalds Three request dispatching techniques are implemented, they are 171da177e4SLinus Torvalds virtual server via NAT, virtual server via tunneling and virtual 181da177e4SLinus Torvalds server via direct routing. The several scheduling algorithms can 191da177e4SLinus Torvalds be used to choose which server the connection is directed to, 201da177e4SLinus Torvalds thus load balancing can be achieved among the servers. For more 211da177e4SLinus Torvalds information and its administration program, please visit the 221da177e4SLinus Torvalds following URL: <http://www.linuxvirtualserver.org/>. 231da177e4SLinus Torvalds 241da177e4SLinus Torvalds If you want to compile it in kernel, say Y. To compile it as a 251da177e4SLinus Torvalds module, choose M here. If unsure, say N. 261da177e4SLinus Torvalds 27a6938a1eSJan Engelhardtif IP_VS 28a6938a1eSJan Engelhardt 29fab0de02SJulius Volzconfig IP_VS_IPV6 300537ae6aSJulius Volz bool "IPv6 support for IPVS" 312890a157SSimon Horman depends on IPV6 = y || IP_VS = IPV6 32098e13f5SAndrea Claudi select NF_DEFRAG_IPV6 33a7f7f624SMasahiro Yamada help 342f74713dSJesper Dangaard Brouer Add IPv6 support to IPVS. 35fab0de02SJulius Volz 362f74713dSJesper Dangaard Brouer Say Y if unsure. 37fab0de02SJulius Volz 381da177e4SLinus Torvaldsconfig IP_VS_DEBUG 391da177e4SLinus Torvalds bool "IP virtual server debugging" 40a7f7f624SMasahiro Yamada help 411da177e4SLinus Torvalds Say Y here if you want to get additional messages useful in 421da177e4SLinus Torvalds debugging the IP virtual server code. You can change the debug 431da177e4SLinus Torvalds level in /proc/sys/net/ipv4/vs/debug_level 441da177e4SLinus Torvalds 451da177e4SLinus Torvaldsconfig IP_VS_TAB_BITS 461da177e4SLinus Torvalds int "IPVS connection table size (the Nth power of 2)" 47*04292c69SAbhijeet Rastogi range 8 20 if !64BIT 48*04292c69SAbhijeet Rastogi range 8 27 if 64BIT 492206a3f5SSven Wegener default 12 50a7f7f624SMasahiro Yamada help 511da177e4SLinus Torvalds The IPVS connection hash table uses the chaining scheme to handle 521da177e4SLinus Torvalds hash collisions. Using a big IPVS connection hash table will greatly 531da177e4SLinus Torvalds reduce conflicts when there are hundreds of thousands of connections 541da177e4SLinus Torvalds in the hash table. 551da177e4SLinus Torvalds 561da177e4SLinus Torvalds Note the table size must be power of 2. The table size will be the 571da177e4SLinus Torvalds value of 2 to the your input number power. The number to choose is 58*04292c69SAbhijeet Rastogi from 8 to 27 for 64BIT(20 otherwise), the default number is 12, 59*04292c69SAbhijeet Rastogi which means the table size is 4096. Don't input the number too 60*04292c69SAbhijeet Rastogi small, otherwise you will lose performance on it. You can adapt the 61*04292c69SAbhijeet Rastogi table size yourself, according to your virtual server application. 62*04292c69SAbhijeet Rastogi It is good to set the table size not far less than the number of 63*04292c69SAbhijeet Rastogi connections per second multiplying average lasting time of 64*04292c69SAbhijeet Rastogi connection in the table. For example, your virtual server gets 200 65*04292c69SAbhijeet Rastogi connections per second, the connection lasts for 200 seconds in 66*04292c69SAbhijeet Rastogi average in the connection table, the table size should be not far 67*04292c69SAbhijeet Rastogi less than 200x200, it is good to set the table size 32768 (2**15). 681da177e4SLinus Torvalds 691da177e4SLinus Torvalds Another note that each connection occupies 128 bytes effectively and 701da177e4SLinus Torvalds each hash entry uses 8 bytes, so you can estimate how much memory is 711da177e4SLinus Torvalds needed for your box. 721da177e4SLinus Torvalds 736f7edb48SCatalin(ux) M. BOIE You can overwrite this number setting conn_tab_bits module parameter 74*04292c69SAbhijeet Rastogi or by appending ip_vs.conn_tab_bits=? to the kernel command line if 75*04292c69SAbhijeet Rastogi IP VS was compiled built-in. 766f7edb48SCatalin(ux) M. BOIE 771da177e4SLinus Torvaldscomment "IPVS transport protocol load balancing support" 781da177e4SLinus Torvalds 791da177e4SLinus Torvaldsconfig IP_VS_PROTO_TCP 801da177e4SLinus Torvalds bool "TCP load balancing support" 81a7f7f624SMasahiro Yamada help 821da177e4SLinus Torvalds This option enables support for load balancing TCP transport 831da177e4SLinus Torvalds protocol. Say Y if unsure. 841da177e4SLinus Torvalds 851da177e4SLinus Torvaldsconfig IP_VS_PROTO_UDP 861da177e4SLinus Torvalds bool "UDP load balancing support" 87a7f7f624SMasahiro Yamada help 881da177e4SLinus Torvalds This option enables support for load balancing UDP transport 891da177e4SLinus Torvalds protocol. Say Y if unsure. 901da177e4SLinus Torvalds 91409a1966SJulius Volzconfig IP_VS_PROTO_AH_ESP 9272c7664fSMichal Marek def_bool IP_VS_PROTO_ESP || IP_VS_PROTO_AH 93409a1966SJulius Volz 941da177e4SLinus Torvaldsconfig IP_VS_PROTO_ESP 951da177e4SLinus Torvalds bool "ESP load balancing support" 96a7f7f624SMasahiro Yamada help 9744c09201SMatt LaPlante This option enables support for load balancing ESP (Encapsulation 981da177e4SLinus Torvalds Security Payload) transport protocol. Say Y if unsure. 991da177e4SLinus Torvalds 1001da177e4SLinus Torvaldsconfig IP_VS_PROTO_AH 1011da177e4SLinus Torvalds bool "AH load balancing support" 102a7f7f624SMasahiro Yamada help 1031da177e4SLinus Torvalds This option enables support for load balancing AH (Authentication 1041da177e4SLinus Torvalds Header) transport protocol. Say Y if unsure. 1051da177e4SLinus Torvalds 1062906f66aSVenkata Mohan Reddyconfig IP_VS_PROTO_SCTP 1072906f66aSVenkata Mohan Reddy bool "SCTP load balancing support" 1082906f66aSVenkata Mohan Reddy select NET_CRC32C 109a7f7f624SMasahiro Yamada help 1102906f66aSVenkata Mohan Reddy This option enables support for load balancing SCTP transport 1112906f66aSVenkata Mohan Reddy protocol. Say Y if unsure. 1122906f66aSVenkata Mohan Reddy 1131da177e4SLinus Torvaldscomment "IPVS scheduler" 1141da177e4SLinus Torvalds 1151da177e4SLinus Torvaldsconfig IP_VS_RR 1161da177e4SLinus Torvalds tristate "round-robin scheduling" 117a7f7f624SMasahiro Yamada help 1181da177e4SLinus Torvalds The robin-robin scheduling algorithm simply directs network 1191da177e4SLinus Torvalds connections to different real servers in a round-robin manner. 1201da177e4SLinus Torvalds 1211da177e4SLinus Torvalds If you want to compile it in kernel, say Y. To compile it as a 1221da177e4SLinus Torvalds module, choose M here. If unsure, say N. 1231da177e4SLinus Torvalds 1241da177e4SLinus Torvaldsconfig IP_VS_WRR 1251da177e4SLinus Torvalds tristate "weighted round-robin scheduling" 126a7f7f624SMasahiro Yamada help 1271da177e4SLinus Torvalds The weighted robin-robin scheduling algorithm directs network 1281da177e4SLinus Torvalds connections to different real servers based on server weights 1291da177e4SLinus Torvalds in a round-robin manner. Servers with higher weights receive 1301da177e4SLinus Torvalds new connections first than those with less weights, and servers 1311da177e4SLinus Torvalds with higher weights get more connections than those with less 1321da177e4SLinus Torvalds weights and servers with equal weights get equal connections. 1331da177e4SLinus Torvalds 1341da177e4SLinus Torvalds If you want to compile it in kernel, say Y. To compile it as a 1351da177e4SLinus Torvalds module, choose M here. If unsure, say N. 1361da177e4SLinus Torvalds 1371da177e4SLinus Torvaldsconfig IP_VS_LC 1381da177e4SLinus Torvalds tristate "least-connection scheduling" 139a7f7f624SMasahiro Yamada help 1401da177e4SLinus Torvalds The least-connection scheduling algorithm directs network 1411da177e4SLinus Torvalds connections to the server with the least number of active 1421da177e4SLinus Torvalds connections. 1431da177e4SLinus Torvalds 1441da177e4SLinus Torvalds If you want to compile it in kernel, say Y. To compile it as a 1451da177e4SLinus Torvalds module, choose M here. If unsure, say N. 1461da177e4SLinus Torvalds 1471da177e4SLinus Torvaldsconfig IP_VS_WLC 1481da177e4SLinus Torvalds tristate "weighted least-connection scheduling" 149a7f7f624SMasahiro Yamada help 1501da177e4SLinus Torvalds The weighted least-connection scheduling algorithm directs network 1511da177e4SLinus Torvalds connections to the server with the least active connections 1521da177e4SLinus Torvalds normalized by the server weight. 1531da177e4SLinus Torvalds 1541da177e4SLinus Torvalds If you want to compile it in kernel, say Y. To compile it as a 1551da177e4SLinus Torvalds module, choose M here. If unsure, say N. 1561da177e4SLinus Torvalds 157616a9be2SKenny Mathisconfig IP_VS_FO 158616a9be2SKenny Mathis tristate "weighted failover scheduling" 159a7f7f624SMasahiro Yamada help 160616a9be2SKenny Mathis The weighted failover scheduling algorithm directs network 161616a9be2SKenny Mathis connections to the server with the highest weight that is 162616a9be2SKenny Mathis currently available. 163616a9be2SKenny Mathis 164616a9be2SKenny Mathis If you want to compile it in kernel, say Y. To compile it as a 165616a9be2SKenny Mathis module, choose M here. If unsure, say N. 166616a9be2SKenny Mathis 167eefa32d3SRaducu Deaconuconfig IP_VS_OVF 168eefa32d3SRaducu Deaconu tristate "weighted overflow scheduling" 169a7f7f624SMasahiro Yamada help 170eefa32d3SRaducu Deaconu The weighted overflow scheduling algorithm directs network 171eefa32d3SRaducu Deaconu connections to the server with the highest weight that is 172eefa32d3SRaducu Deaconu currently available and overflows to the next when active 173eefa32d3SRaducu Deaconu connections exceed the node's weight. 174eefa32d3SRaducu Deaconu 175eefa32d3SRaducu Deaconu If you want to compile it in kernel, say Y. To compile it as a 176eefa32d3SRaducu Deaconu module, choose M here. If unsure, say N. 177eefa32d3SRaducu Deaconu 1781da177e4SLinus Torvaldsconfig IP_VS_LBLC 1791da177e4SLinus Torvalds tristate "locality-based least-connection scheduling" 180a7f7f624SMasahiro Yamada help 1811da177e4SLinus Torvalds The locality-based least-connection scheduling algorithm is for 1821da177e4SLinus Torvalds destination IP load balancing. It is usually used in cache cluster. 1831da177e4SLinus Torvalds This algorithm usually directs packet destined for an IP address to 1841da177e4SLinus Torvalds its server if the server is alive and under load. If the server is 1851da177e4SLinus Torvalds overloaded (its active connection numbers is larger than its weight) 1861da177e4SLinus Torvalds and there is a server in its half load, then allocate the weighted 1871da177e4SLinus Torvalds least-connection server to this IP address. 1881da177e4SLinus Torvalds 1891da177e4SLinus Torvalds If you want to compile it in kernel, say Y. To compile it as a 1901da177e4SLinus Torvalds module, choose M here. If unsure, say N. 1911da177e4SLinus Torvalds 1921da177e4SLinus Torvaldsconfig IP_VS_LBLCR 1931da177e4SLinus Torvalds tristate "locality-based least-connection with replication scheduling" 194a7f7f624SMasahiro Yamada help 1951da177e4SLinus Torvalds The locality-based least-connection with replication scheduling 1961da177e4SLinus Torvalds algorithm is also for destination IP load balancing. It is 1971da177e4SLinus Torvalds usually used in cache cluster. It differs from the LBLC scheduling 1981da177e4SLinus Torvalds as follows: the load balancer maintains mappings from a target 1991da177e4SLinus Torvalds to a set of server nodes that can serve the target. Requests for 2001da177e4SLinus Torvalds a target are assigned to the least-connection node in the target's 2011da177e4SLinus Torvalds server set. If all the node in the server set are over loaded, 2021da177e4SLinus Torvalds it picks up a least-connection node in the cluster and adds it 2031da177e4SLinus Torvalds in the sever set for the target. If the server set has not been 2041da177e4SLinus Torvalds modified for the specified time, the most loaded node is removed 2051da177e4SLinus Torvalds from the server set, in order to avoid high degree of replication. 2061da177e4SLinus Torvalds 2071da177e4SLinus Torvalds If you want to compile it in kernel, say Y. To compile it as a 2081da177e4SLinus Torvalds module, choose M here. If unsure, say N. 2091da177e4SLinus Torvalds 2101da177e4SLinus Torvaldsconfig IP_VS_DH 2111da177e4SLinus Torvalds tristate "destination hashing scheduling" 212a7f7f624SMasahiro Yamada help 2131da177e4SLinus Torvalds The destination hashing scheduling algorithm assigns network 2141da177e4SLinus Torvalds connections to the servers through looking up a statically assigned 2151da177e4SLinus Torvalds hash table by their destination IP addresses. 2161da177e4SLinus Torvalds 2171da177e4SLinus Torvalds If you want to compile it in kernel, say Y. To compile it as a 2181da177e4SLinus Torvalds module, choose M here. If unsure, say N. 2191da177e4SLinus Torvalds 2201da177e4SLinus Torvaldsconfig IP_VS_SH 2211da177e4SLinus Torvalds tristate "source hashing scheduling" 222a7f7f624SMasahiro Yamada help 2231da177e4SLinus Torvalds The source hashing scheduling algorithm assigns network 2241da177e4SLinus Torvalds connections to the servers through looking up a statically assigned 2251da177e4SLinus Torvalds hash table by their source IP addresses. 2261da177e4SLinus Torvalds 2271da177e4SLinus Torvalds If you want to compile it in kernel, say Y. To compile it as a 2281da177e4SLinus Torvalds module, choose M here. If unsure, say N. 2291da177e4SLinus Torvalds 23030edf801SInju Songconfig IP_VS_MH 23130edf801SInju Song tristate "maglev hashing scheduling" 232a7f7f624SMasahiro Yamada help 23330edf801SInju Song The maglev consistent hashing scheduling algorithm provides the 23430edf801SInju Song Google's Maglev hashing algorithm as a IPVS scheduler. It assigns 23530edf801SInju Song network connections to the servers through looking up a statically 23630edf801SInju Song assigned special hash table called the lookup table. Maglev hashing 23730edf801SInju Song is to assign a preference list of all the lookup table positions 23830edf801SInju Song to each destination. 23930edf801SInju Song 24030edf801SInju Song Through this operation, The maglev hashing gives an almost equal 24130edf801SInju Song share of the lookup table to each of the destinations and provides 24230edf801SInju Song minimal disruption by using the lookup table. When the set of 24330edf801SInju Song destinations changes, a connection will likely be sent to the same 24430edf801SInju Song destination as it was before. 24530edf801SInju Song 24630edf801SInju Song If you want to compile it in kernel, say Y. To compile it as a 24730edf801SInju Song module, choose M here. If unsure, say N. 24830edf801SInju Song 2491da177e4SLinus Torvaldsconfig IP_VS_SED 2501da177e4SLinus Torvalds tristate "shortest expected delay scheduling" 251a7f7f624SMasahiro Yamada help 2521da177e4SLinus Torvalds The shortest expected delay scheduling algorithm assigns network 2531da177e4SLinus Torvalds connections to the server with the shortest expected delay. The 2541da177e4SLinus Torvalds expected delay that the job will experience is (Ci + 1) / Ui if 2551da177e4SLinus Torvalds sent to the ith server, in which Ci is the number of connections 256cab00891SMatt LaPlante on the ith server and Ui is the fixed service rate (weight) 2571da177e4SLinus Torvalds of the ith server. 2581da177e4SLinus Torvalds 2591da177e4SLinus Torvalds If you want to compile it in kernel, say Y. To compile it as a 2601da177e4SLinus Torvalds module, choose M here. If unsure, say N. 2611da177e4SLinus Torvalds 2621da177e4SLinus Torvaldsconfig IP_VS_NQ 2631da177e4SLinus Torvalds tristate "never queue scheduling" 264a7f7f624SMasahiro Yamada help 2651da177e4SLinus Torvalds The never queue scheduling algorithm adopts a two-speed model. 2661da177e4SLinus Torvalds When there is an idle server available, the job will be sent to 2671da177e4SLinus Torvalds the idle server, instead of waiting for a fast one. When there 2681da177e4SLinus Torvalds is no idle server available, the job will be sent to the server 2691da177e4SLinus Torvalds that minimize its expected delay (The Shortest Expected Delay 2701da177e4SLinus Torvalds scheduling algorithm). 2711da177e4SLinus Torvalds 2721da177e4SLinus Torvalds If you want to compile it in kernel, say Y. To compile it as a 2731da177e4SLinus Torvalds module, choose M here. If unsure, say N. 2741da177e4SLinus Torvalds 275012da53dSDarby Payneconfig IP_VS_TWOS 276012da53dSDarby Payne tristate "weighted random twos choice least-connection scheduling" 277012da53dSDarby Payne help 278012da53dSDarby Payne The weighted random twos choice least-connection scheduling 279012da53dSDarby Payne algorithm picks two random real servers and directs network 280012da53dSDarby Payne connections to the server with the least active connections 281012da53dSDarby Payne normalized by the server weight. 282012da53dSDarby Payne 283012da53dSDarby Payne If you want to compile it in kernel, say Y. To compile it as a 284012da53dSDarby Payne module, choose M here. If unsure, say N. 285012da53dSDarby Payne 28676ad94fcSMichael Maximcomment 'IPVS SH scheduler' 28776ad94fcSMichael Maxim 28876ad94fcSMichael Maximconfig IP_VS_SH_TAB_BITS 28976ad94fcSMichael Maxim int "IPVS source hashing table size (the Nth power of 2)" 29076ad94fcSMichael Maxim range 4 20 29176ad94fcSMichael Maxim default 8 292a7f7f624SMasahiro Yamada help 29376ad94fcSMichael Maxim The source hashing scheduler maps source IPs to destinations 29476ad94fcSMichael Maxim stored in a hash table. This table is tiled by each destination 29576ad94fcSMichael Maxim until all slots in the table are filled. When using weights to 29676ad94fcSMichael Maxim allow destinations to receive more connections, the table is 29776ad94fcSMichael Maxim tiled an amount proportional to the weights specified. The table 29876ad94fcSMichael Maxim needs to be large enough to effectively fit all the destinations 29976ad94fcSMichael Maxim multiplied by their respective weights. 30076ad94fcSMichael Maxim 30130edf801SInju Songcomment 'IPVS MH scheduler' 30230edf801SInju Song 30330edf801SInju Songconfig IP_VS_MH_TAB_INDEX 30430edf801SInju Song int "IPVS maglev hashing table index of size (the prime numbers)" 30530edf801SInju Song range 8 17 30630edf801SInju Song default 12 307a7f7f624SMasahiro Yamada help 30830edf801SInju Song The maglev hashing scheduler maps source IPs to destinations 30930edf801SInju Song stored in a hash table. This table is assigned by a preference 31030edf801SInju Song list of the positions to each destination until all slots in 31130edf801SInju Song the table are filled. The index determines the prime for size of 3123723c632SArnd Bergmann the table as 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 3133723c632SArnd Bergmann 65521 or 131071. When using weights to allow destinations to 3143723c632SArnd Bergmann receive more connections, the table is assigned an amount 3153723c632SArnd Bergmann proportional to the weights specified. The table needs to be large 31630edf801SInju Song enough to effectively fit all the destinations multiplied by their 31730edf801SInju Song respective weights. 31830edf801SInju Song 3191da177e4SLinus Torvaldscomment 'IPVS application helper' 3201da177e4SLinus Torvalds 3211da177e4SLinus Torvaldsconfig IP_VS_FTP 3221da177e4SLinus Torvalds tristate "FTP protocol helper" 323aaea4ed7SJulian Anastasov depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT && \ 324aaea4ed7SJulian Anastasov NF_CONNTRACK_FTP 325f4bc17cdSJulian Anastasov select IP_VS_NFCT 326a7f7f624SMasahiro Yamada help 3271da177e4SLinus Torvalds FTP is a protocol that transfers IP address and/or port number in 3281da177e4SLinus Torvalds the payload. In the virtual server via Network Address Translation, 3291da177e4SLinus Torvalds the IP address and port number of real servers cannot be sent to 3301da177e4SLinus Torvalds clients in ftp connections directly, so FTP protocol helper is 3311da177e4SLinus Torvalds required for tracking the connection and mangling it back to that of 3321da177e4SLinus Torvalds virtual service. 3331da177e4SLinus Torvalds 3341da177e4SLinus Torvalds If you want to compile it in kernel, say Y. To compile it as a 3351da177e4SLinus Torvalds module, choose M here. If unsure, say N. 3361da177e4SLinus Torvalds 337f4bc17cdSJulian Anastasovconfig IP_VS_NFCT 338f4bc17cdSJulian Anastasov bool "Netfilter connection tracking" 339f4bc17cdSJulian Anastasov depends on NF_CONNTRACK 340a7f7f624SMasahiro Yamada help 341f4bc17cdSJulian Anastasov The Netfilter connection tracking support allows the IPVS 342f4bc17cdSJulian Anastasov connection state to be exported to the Netfilter framework 343f4bc17cdSJulian Anastasov for filtering purposes. 344f4bc17cdSJulian Anastasov 345758ff033SSimon Hormanconfig IP_VS_PE_SIP 346758ff033SSimon Horman tristate "SIP persistence engine" 347758ff033SSimon Horman depends on IP_VS_PROTO_UDP 348758ff033SSimon Horman depends on NF_CONNTRACK_SIP 349a7f7f624SMasahiro Yamada help 350758ff033SSimon Horman Allow persistence based on the SIP Call-ID 351758ff033SSimon Horman 352a6938a1eSJan Engelhardtendif # IP_VS 353