1249259Sdim.. SPDX-License-Identifier: GPL-2.0 2249259Sdim 3249259Sdim=========== 4249259SdimIPvs-sysctl 5249259Sdim=========== 6249259Sdim 7249259Sdim/proc/sys/net/ipv4/vs/* Variables: 8249259Sdim================================== 9249259Sdim 10249259Sdimam_droprate - INTEGER 11249259Sdim default 10 12249259Sdim 13249259Sdim It sets the always mode drop rate, which is used in the mode 3 14249259Sdim of the drop_rate defense. 15249259Sdim 16249259Sdimamemthresh - INTEGER 17249259Sdim default 1024 18249259Sdim 19249259Sdim It sets the available memory threshold (in pages), which is 20249259Sdim used in the automatic modes of defense. When there is no 21249259Sdim enough available memory, the respective strategy will be 22263508Sdim enabled and the variable is automatically set to 2, otherwise 23263508Sdim the strategy is disabled and the variable is set to 1. 24263508Sdim 25263508Sdimbackup_only - BOOLEAN 26249259Sdim - 0 - disabled (default) 27249259Sdim - not 0 - enabled 28249259Sdim 29249259Sdim If set, disable the director function while the server is 30249259Sdim in backup mode to avoid packet loops for DR/TUN methods. 31249259Sdim 32249259Sdimconn_reuse_mode - INTEGER 33263508Sdim 1 - default 34263508Sdim 35249259Sdim Controls how ipvs will deal with connections that are detected 36249259Sdim port reuse. It is a bitmap, with the values being: 37249259Sdim 38249259Sdim 0: disable any special handling on port reuse. The new 39249259Sdim connection will be delivered to the same real server that was 40249259Sdim servicing the previous connection. 41249259Sdim 42249259Sdim bit 1: enable rescheduling of new connections when it is safe. 43249259Sdim That is, whenever expire_nodest_conn and for TCP sockets, when 44249259Sdim the connection is in TIME_WAIT state (which is only possible if 45249259Sdim you use NAT mode). 46249259Sdim 47249259Sdim bit 2: it is bit 1 plus, for TCP connections, when connections 48249259Sdim are in FIN_WAIT state, as this is the last state seen by load 49249259Sdim balancer in Direct Routing mode. This bit helps on adding new 50249259Sdim real servers to a very busy cluster. 51249259Sdim 52249259Sdimconntrack - BOOLEAN 53249259Sdim - 0 - disabled (default) 54249259Sdim - not 0 - enabled 55249259Sdim 56249259Sdim If set, maintain connection tracking entries for 57249259Sdim connections handled by IPVS. 58249259Sdim 59249259Sdim This should be enabled if connections handled by IPVS are to be 60249259Sdim also handled by stateful firewall rules. That is, iptables rules 61249259Sdim that make use of connection tracking. It is a performance 62249259Sdim optimisation to disable this setting otherwise. 63249259Sdim 64249259Sdim Connections handled by the IPVS FTP application module 65249259Sdim will have connection tracking entries regardless of this setting. 66249259Sdim 67249259Sdim Only available when IPVS is compiled with CONFIG_IP_VS_NFCT enabled. 68249259Sdim 69249259Sdimcache_bypass - BOOLEAN 70249259Sdim - 0 - disabled (default) 71249259Sdim - not 0 - enabled 72249259Sdim 73249259Sdim If it is enabled, forward packets to the original destination 74249259Sdim directly when no cache server is available and destination 75249259Sdim address is not local (iph->daddr is RTN_UNICAST). It is mostly 76249259Sdim used in transparent web cache cluster. 77249259Sdim 78249259Sdimdebug_level - INTEGER 79249259Sdim - 0 - transmission error messages (default) 80249259Sdim - 1 - non-fatal error messages 81249259Sdim - 2 - configuration 82249259Sdim - 3 - destination trash 83249259Sdim - 4 - drop entry 84249259Sdim - 5 - service lookup 85249259Sdim - 6 - scheduling 86249259Sdim - 7 - connection new/expire, lookup and synchronization 87249259Sdim - 8 - state transition 88249259Sdim - 9 - binding destination, template checks and applications 89249259Sdim - 10 - IPVS packet transmission 90249259Sdim - 11 - IPVS packet handling (ip_vs_in/ip_vs_out) 91249259Sdim - 12 or more - packet traversal 92249259Sdim 93249259Sdim Only available when IPVS is compiled with CONFIG_IP_VS_DEBUG enabled. 94249259Sdim 95249259Sdim Higher debugging levels include the messages for lower debugging 96249259Sdim levels, so setting debug level 2, includes level 0, 1 and 2 97249259Sdim messages. Thus, logging becomes more and more verbose the higher 98249259Sdim the level. 99249259Sdim 100249259Sdimdrop_entry - INTEGER 101249259Sdim - 0 - disabled (default) 102249259Sdim 103249259Sdim The drop_entry defense is to randomly drop entries in the 104249259Sdim connection hash table, just in order to collect back some 105263508Sdim memory for new connections. In the current code, the 106249259Sdim drop_entry procedure can be activated every second, then it 107249259Sdim randomly scans 1/32 of the whole and drops entries that are in 108249259Sdim the SYN-RECV/SYNACK state, which should be effective against 109249259Sdim syn-flooding attack. 110263508Sdim 111263508Sdim The valid values of drop_entry are from 0 to 3, where 0 means 112263508Sdim that this strategy is always disabled, 1 and 2 mean automatic 113249259Sdim modes (when there is no enough available memory, the strategy 114249259Sdim is enabled and the variable is automatically set to 2, 115249259Sdim otherwise the strategy is disabled and the variable is set to 116249259Sdim 1), and 3 means that the strategy is always enabled. 117249259Sdim 118249259Sdimdrop_packet - INTEGER 119249259Sdim - 0 - disabled (default) 120249259Sdim 121249259Sdim The drop_packet defense is designed to drop 1/rate packets 122249259Sdim before forwarding them to real servers. If the rate is 1, then 123263508Sdim drop all the incoming packets. 124263508Sdim 125263508Sdim The value definition is the same as that of the drop_entry. In 126249259Sdim the automatic mode, the rate is determined by the follow 127249259Sdim formula: rate = amemthresh / (amemthresh - available_memory) 128249259Sdim when available memory is less than the available memory 129249259Sdim threshold. When the mode 3 is set, the always mode drop rate 130249259Sdim is controlled by the /proc/sys/net/ipv4/vs/am_droprate. 131249259Sdim 132249259Sdimest_cpulist - CPULIST 133249259Sdim Allowed CPUs for estimation kthreads 134249259Sdim 135249259Sdim Syntax: standard cpulist format 136249259Sdim empty list - stop kthread tasks and estimation 137249259Sdim default - the system's housekeeping CPUs for kthreads 138251662Sdim 139251662Sdim Example: 140251662Sdim "all": all possible CPUs 141251662Sdim "0-N": all possible CPUs, N denotes last CPU number 142251662Sdim "0,1-N:1/2": first and all CPUs with odd number 143249259Sdim "": empty list 144249259Sdim 145249259Sdimest_nice - INTEGER 146249259Sdim default 0 147249259Sdim Valid range: -20 (more favorable) .. 19 (less favorable) 148249259Sdim 149249259Sdim Niceness value to use for the estimation kthreads (scheduling 150249259Sdim priority) 151249259Sdim 152249259Sdimexpire_nodest_conn - BOOLEAN 153249259Sdim - 0 - disabled (default) 154249259Sdim - not 0 - enabled 155249259Sdim 156249259Sdim The default value is 0, the load balancer will silently drop 157249259Sdim packets when its destination server is not available. It may 158249259Sdim be useful, when user-space monitoring program deletes the 159249259Sdim destination server (because of server overload or wrong 160249259Sdim detection) and add back the server later, and the connections 161249259Sdim to the server can continue. 162249259Sdim 163249259Sdim If this feature is enabled, the load balancer will expire the 164249259Sdim connection immediately when a packet arrives and its 165249259Sdim destination server is not available, then the client program 166249259Sdim will be notified that the connection is closed. This is 167249259Sdim equivalent to the feature some people requires to flush 168249259Sdim connections when its destination is not available. 169249259Sdim 170249259Sdimexpire_quiescent_template - BOOLEAN 171249259Sdim - 0 - disabled (default) 172249259Sdim - not 0 - enabled 173249259Sdim 174249259Sdim When set to a non-zero value, the load balancer will expire 175249259Sdim persistent templates when the destination server is quiescent. 176249259Sdim This may be useful, when a user makes a destination server 177249259Sdim quiescent by setting its weight to 0 and it is desired that 178 subsequent otherwise persistent connections are sent to a 179 different destination server. By default new persistent 180 connections are allowed to quiescent destination servers. 181 182 If this feature is enabled, the load balancer will expire the 183 persistence template if it is to be used to schedule a new 184 connection and the destination server is quiescent. 185 186ignore_tunneled - BOOLEAN 187 - 0 - disabled (default) 188 - not 0 - enabled 189 190 If set, ipvs will set the ipvs_property on all packets which are of 191 unrecognized protocols. This prevents us from routing tunneled 192 protocols like ipip, which is useful to prevent rescheduling 193 packets that have been tunneled to the ipvs host (i.e. to prevent 194 ipvs routing loops when ipvs is also acting as a real server). 195 196nat_icmp_send - BOOLEAN 197 - 0 - disabled (default) 198 - not 0 - enabled 199 200 It controls sending icmp error messages (ICMP_DEST_UNREACH) 201 for VS/NAT when the load balancer receives packets from real 202 servers but the connection entries don't exist. 203 204pmtu_disc - BOOLEAN 205 - 0 - disabled 206 - not 0 - enabled (default) 207 208 By default, reject with FRAG_NEEDED all DF packets that exceed 209 the PMTU, irrespective of the forwarding method. For TUN method 210 the flag can be disabled to fragment such packets. 211 212secure_tcp - INTEGER 213 - 0 - disabled (default) 214 215 The secure_tcp defense is to use a more complicated TCP state 216 transition table. For VS/NAT, it also delays entering the 217 TCP ESTABLISHED state until the three way handshake is completed. 218 219 The value definition is the same as that of drop_entry and 220 drop_packet. 221 222sync_threshold - vector of 2 INTEGERs: sync_threshold, sync_period 223 default 3 50 224 225 It sets synchronization threshold, which is the minimum number 226 of incoming packets that a connection needs to receive before 227 the connection will be synchronized. A connection will be 228 synchronized, every time the number of its incoming packets 229 modulus sync_period equals the threshold. The range of the 230 threshold is from 0 to sync_period. 231 232 When sync_period and sync_refresh_period are 0, send sync only 233 for state changes or only once when pkts matches sync_threshold 234 235sync_refresh_period - UNSIGNED INTEGER 236 default 0 237 238 In seconds, difference in reported connection timer that triggers 239 new sync message. It can be used to avoid sync messages for the 240 specified period (or half of the connection timeout if it is lower) 241 if connection state is not changed since last sync. 242 243 This is useful for normal connections with high traffic to reduce 244 sync rate. Additionally, retry sync_retries times with period of 245 sync_refresh_period/8. 246 247sync_retries - INTEGER 248 default 0 249 250 Defines sync retries with period of sync_refresh_period/8. Useful 251 to protect against loss of sync messages. The range of the 252 sync_retries is from 0 to 3. 253 254sync_qlen_max - UNSIGNED LONG 255 256 Hard limit for queued sync messages that are not sent yet. It 257 defaults to 1/32 of the memory pages but actually represents 258 number of messages. It will protect us from allocating large 259 parts of memory when the sending rate is lower than the queuing 260 rate. 261 262sync_sock_size - INTEGER 263 default 0 264 265 Configuration of SNDBUF (master) or RCVBUF (slave) socket limit. 266 Default value is 0 (preserve system defaults). 267 268sync_ports - INTEGER 269 default 1 270 271 The number of threads that master and backup servers can use for 272 sync traffic. Every thread will use single UDP port, thread 0 will 273 use the default port 8848 while last thread will use port 274 8848+sync_ports-1. 275 276snat_reroute - BOOLEAN 277 - 0 - disabled 278 - not 0 - enabled (default) 279 280 If enabled, recalculate the route of SNATed packets from 281 realservers so that they are routed as if they originate from the 282 director. Otherwise they are routed as if they are forwarded by the 283 director. 284 285 If policy routing is in effect then it is possible that the route 286 of a packet originating from a director is routed differently to a 287 packet being forwarded by the director. 288 289 If policy routing is not in effect then the recalculated route will 290 always be the same as the original route so it is an optimisation 291 to disable snat_reroute and avoid the recalculation. 292 293sync_persist_mode - INTEGER 294 default 0 295 296 Controls the synchronisation of connections when using persistence 297 298 0: All types of connections are synchronised 299 300 1: Attempt to reduce the synchronisation traffic depending on 301 the connection type. For persistent services avoid synchronisation 302 for normal connections, do it only for persistence templates. 303 In such case, for TCP and SCTP it may need enabling sloppy_tcp and 304 sloppy_sctp flags on backup servers. For non-persistent services 305 such optimization is not applied, mode 0 is assumed. 306 307sync_version - INTEGER 308 default 1 309 310 The version of the synchronisation protocol used when sending 311 synchronisation messages. 312 313 0 selects the original synchronisation protocol (version 0). This 314 should be used when sending synchronisation messages to a legacy 315 system that only understands the original synchronisation protocol. 316 317 1 selects the current synchronisation protocol (version 1). This 318 should be used where possible. 319 320 Kernels with this sync_version entry are able to receive messages 321 of both version 1 and version 2 of the synchronisation protocol. 322 323run_estimation - BOOLEAN 324 0 - disabled 325 not 0 - enabled (default) 326 327 If disabled, the estimation will be suspended and kthread tasks 328 stopped. 329 330 You can always re-enable estimation by setting this value to 1. 331 But be careful, the first estimation after re-enable is not 332 accurate. 333