162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci=========== 462306a36Sopenharmony_ciIPvs-sysctl 562306a36Sopenharmony_ci=========== 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci/proc/sys/net/ipv4/vs/* Variables: 862306a36Sopenharmony_ci================================== 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciam_droprate - INTEGER 1162306a36Sopenharmony_ci default 10 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci It sets the always mode drop rate, which is used in the mode 3 1462306a36Sopenharmony_ci of the drop_rate defense. 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ciamemthresh - INTEGER 1762306a36Sopenharmony_ci default 1024 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci It sets the available memory threshold (in pages), which is 2062306a36Sopenharmony_ci used in the automatic modes of defense. When there is no 2162306a36Sopenharmony_ci enough available memory, the respective strategy will be 2262306a36Sopenharmony_ci enabled and the variable is automatically set to 2, otherwise 2362306a36Sopenharmony_ci the strategy is disabled and the variable is set to 1. 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_cibackup_only - BOOLEAN 2662306a36Sopenharmony_ci - 0 - disabled (default) 2762306a36Sopenharmony_ci - not 0 - enabled 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci If set, disable the director function while the server is 3062306a36Sopenharmony_ci in backup mode to avoid packet loops for DR/TUN methods. 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ciconn_reuse_mode - INTEGER 3362306a36Sopenharmony_ci 1 - default 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci Controls how ipvs will deal with connections that are detected 3662306a36Sopenharmony_ci port reuse. It is a bitmap, with the values being: 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci 0: disable any special handling on port reuse. The new 3962306a36Sopenharmony_ci connection will be delivered to the same real server that was 4062306a36Sopenharmony_ci servicing the previous connection. 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci bit 1: enable rescheduling of new connections when it is safe. 4362306a36Sopenharmony_ci That is, whenever expire_nodest_conn and for TCP sockets, when 4462306a36Sopenharmony_ci the connection is in TIME_WAIT state (which is only possible if 4562306a36Sopenharmony_ci you use NAT mode). 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci bit 2: it is bit 1 plus, for TCP connections, when connections 4862306a36Sopenharmony_ci are in FIN_WAIT state, as this is the last state seen by load 4962306a36Sopenharmony_ci balancer in Direct Routing mode. This bit helps on adding new 5062306a36Sopenharmony_ci real servers to a very busy cluster. 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ciconntrack - BOOLEAN 5362306a36Sopenharmony_ci - 0 - disabled (default) 5462306a36Sopenharmony_ci - not 0 - enabled 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci If set, maintain connection tracking entries for 5762306a36Sopenharmony_ci connections handled by IPVS. 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci This should be enabled if connections handled by IPVS are to be 6062306a36Sopenharmony_ci also handled by stateful firewall rules. That is, iptables rules 6162306a36Sopenharmony_ci that make use of connection tracking. It is a performance 6262306a36Sopenharmony_ci optimisation to disable this setting otherwise. 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci Connections handled by the IPVS FTP application module 6562306a36Sopenharmony_ci will have connection tracking entries regardless of this setting. 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci Only available when IPVS is compiled with CONFIG_IP_VS_NFCT enabled. 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_cicache_bypass - BOOLEAN 7062306a36Sopenharmony_ci - 0 - disabled (default) 7162306a36Sopenharmony_ci - not 0 - enabled 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci If it is enabled, forward packets to the original destination 7462306a36Sopenharmony_ci directly when no cache server is available and destination 7562306a36Sopenharmony_ci address is not local (iph->daddr is RTN_UNICAST). It is mostly 7662306a36Sopenharmony_ci used in transparent web cache cluster. 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_cidebug_level - INTEGER 7962306a36Sopenharmony_ci - 0 - transmission error messages (default) 8062306a36Sopenharmony_ci - 1 - non-fatal error messages 8162306a36Sopenharmony_ci - 2 - configuration 8262306a36Sopenharmony_ci - 3 - destination trash 8362306a36Sopenharmony_ci - 4 - drop entry 8462306a36Sopenharmony_ci - 5 - service lookup 8562306a36Sopenharmony_ci - 6 - scheduling 8662306a36Sopenharmony_ci - 7 - connection new/expire, lookup and synchronization 8762306a36Sopenharmony_ci - 8 - state transition 8862306a36Sopenharmony_ci - 9 - binding destination, template checks and applications 8962306a36Sopenharmony_ci - 10 - IPVS packet transmission 9062306a36Sopenharmony_ci - 11 - IPVS packet handling (ip_vs_in/ip_vs_out) 9162306a36Sopenharmony_ci - 12 or more - packet traversal 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci Only available when IPVS is compiled with CONFIG_IP_VS_DEBUG enabled. 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci Higher debugging levels include the messages for lower debugging 9662306a36Sopenharmony_ci levels, so setting debug level 2, includes level 0, 1 and 2 9762306a36Sopenharmony_ci messages. Thus, logging becomes more and more verbose the higher 9862306a36Sopenharmony_ci the level. 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_cidrop_entry - INTEGER 10162306a36Sopenharmony_ci - 0 - disabled (default) 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ci The drop_entry defense is to randomly drop entries in the 10462306a36Sopenharmony_ci connection hash table, just in order to collect back some 10562306a36Sopenharmony_ci memory for new connections. In the current code, the 10662306a36Sopenharmony_ci drop_entry procedure can be activated every second, then it 10762306a36Sopenharmony_ci randomly scans 1/32 of the whole and drops entries that are in 10862306a36Sopenharmony_ci the SYN-RECV/SYNACK state, which should be effective against 10962306a36Sopenharmony_ci syn-flooding attack. 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci The valid values of drop_entry are from 0 to 3, where 0 means 11262306a36Sopenharmony_ci that this strategy is always disabled, 1 and 2 mean automatic 11362306a36Sopenharmony_ci modes (when there is no enough available memory, the strategy 11462306a36Sopenharmony_ci is enabled and the variable is automatically set to 2, 11562306a36Sopenharmony_ci otherwise the strategy is disabled and the variable is set to 11662306a36Sopenharmony_ci 1), and 3 means that the strategy is always enabled. 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_cidrop_packet - INTEGER 11962306a36Sopenharmony_ci - 0 - disabled (default) 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci The drop_packet defense is designed to drop 1/rate packets 12262306a36Sopenharmony_ci before forwarding them to real servers. If the rate is 1, then 12362306a36Sopenharmony_ci drop all the incoming packets. 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci The value definition is the same as that of the drop_entry. In 12662306a36Sopenharmony_ci the automatic mode, the rate is determined by the follow 12762306a36Sopenharmony_ci formula: rate = amemthresh / (amemthresh - available_memory) 12862306a36Sopenharmony_ci when available memory is less than the available memory 12962306a36Sopenharmony_ci threshold. When the mode 3 is set, the always mode drop rate 13062306a36Sopenharmony_ci is controlled by the /proc/sys/net/ipv4/vs/am_droprate. 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ciest_cpulist - CPULIST 13362306a36Sopenharmony_ci Allowed CPUs for estimation kthreads 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci Syntax: standard cpulist format 13662306a36Sopenharmony_ci empty list - stop kthread tasks and estimation 13762306a36Sopenharmony_ci default - the system's housekeeping CPUs for kthreads 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ci Example: 14062306a36Sopenharmony_ci "all": all possible CPUs 14162306a36Sopenharmony_ci "0-N": all possible CPUs, N denotes last CPU number 14262306a36Sopenharmony_ci "0,1-N:1/2": first and all CPUs with odd number 14362306a36Sopenharmony_ci "": empty list 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_ciest_nice - INTEGER 14662306a36Sopenharmony_ci default 0 14762306a36Sopenharmony_ci Valid range: -20 (more favorable) .. 19 (less favorable) 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ci Niceness value to use for the estimation kthreads (scheduling 15062306a36Sopenharmony_ci priority) 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ciexpire_nodest_conn - BOOLEAN 15362306a36Sopenharmony_ci - 0 - disabled (default) 15462306a36Sopenharmony_ci - not 0 - enabled 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci The default value is 0, the load balancer will silently drop 15762306a36Sopenharmony_ci packets when its destination server is not available. It may 15862306a36Sopenharmony_ci be useful, when user-space monitoring program deletes the 15962306a36Sopenharmony_ci destination server (because of server overload or wrong 16062306a36Sopenharmony_ci detection) and add back the server later, and the connections 16162306a36Sopenharmony_ci to the server can continue. 16262306a36Sopenharmony_ci 16362306a36Sopenharmony_ci If this feature is enabled, the load balancer will expire the 16462306a36Sopenharmony_ci connection immediately when a packet arrives and its 16562306a36Sopenharmony_ci destination server is not available, then the client program 16662306a36Sopenharmony_ci will be notified that the connection is closed. This is 16762306a36Sopenharmony_ci equivalent to the feature some people requires to flush 16862306a36Sopenharmony_ci connections when its destination is not available. 16962306a36Sopenharmony_ci 17062306a36Sopenharmony_ciexpire_quiescent_template - BOOLEAN 17162306a36Sopenharmony_ci - 0 - disabled (default) 17262306a36Sopenharmony_ci - not 0 - enabled 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci When set to a non-zero value, the load balancer will expire 17562306a36Sopenharmony_ci persistent templates when the destination server is quiescent. 17662306a36Sopenharmony_ci This may be useful, when a user makes a destination server 17762306a36Sopenharmony_ci quiescent by setting its weight to 0 and it is desired that 17862306a36Sopenharmony_ci subsequent otherwise persistent connections are sent to a 17962306a36Sopenharmony_ci different destination server. By default new persistent 18062306a36Sopenharmony_ci connections are allowed to quiescent destination servers. 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci If this feature is enabled, the load balancer will expire the 18362306a36Sopenharmony_ci persistence template if it is to be used to schedule a new 18462306a36Sopenharmony_ci connection and the destination server is quiescent. 18562306a36Sopenharmony_ci 18662306a36Sopenharmony_ciignore_tunneled - BOOLEAN 18762306a36Sopenharmony_ci - 0 - disabled (default) 18862306a36Sopenharmony_ci - not 0 - enabled 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ci If set, ipvs will set the ipvs_property on all packets which are of 19162306a36Sopenharmony_ci unrecognized protocols. This prevents us from routing tunneled 19262306a36Sopenharmony_ci protocols like ipip, which is useful to prevent rescheduling 19362306a36Sopenharmony_ci packets that have been tunneled to the ipvs host (i.e. to prevent 19462306a36Sopenharmony_ci ipvs routing loops when ipvs is also acting as a real server). 19562306a36Sopenharmony_ci 19662306a36Sopenharmony_cinat_icmp_send - BOOLEAN 19762306a36Sopenharmony_ci - 0 - disabled (default) 19862306a36Sopenharmony_ci - not 0 - enabled 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci It controls sending icmp error messages (ICMP_DEST_UNREACH) 20162306a36Sopenharmony_ci for VS/NAT when the load balancer receives packets from real 20262306a36Sopenharmony_ci servers but the connection entries don't exist. 20362306a36Sopenharmony_ci 20462306a36Sopenharmony_cipmtu_disc - BOOLEAN 20562306a36Sopenharmony_ci - 0 - disabled 20662306a36Sopenharmony_ci - not 0 - enabled (default) 20762306a36Sopenharmony_ci 20862306a36Sopenharmony_ci By default, reject with FRAG_NEEDED all DF packets that exceed 20962306a36Sopenharmony_ci the PMTU, irrespective of the forwarding method. For TUN method 21062306a36Sopenharmony_ci the flag can be disabled to fragment such packets. 21162306a36Sopenharmony_ci 21262306a36Sopenharmony_cisecure_tcp - INTEGER 21362306a36Sopenharmony_ci - 0 - disabled (default) 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_ci The secure_tcp defense is to use a more complicated TCP state 21662306a36Sopenharmony_ci transition table. For VS/NAT, it also delays entering the 21762306a36Sopenharmony_ci TCP ESTABLISHED state until the three way handshake is completed. 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_ci The value definition is the same as that of drop_entry and 22062306a36Sopenharmony_ci drop_packet. 22162306a36Sopenharmony_ci 22262306a36Sopenharmony_cisync_threshold - vector of 2 INTEGERs: sync_threshold, sync_period 22362306a36Sopenharmony_ci default 3 50 22462306a36Sopenharmony_ci 22562306a36Sopenharmony_ci It sets synchronization threshold, which is the minimum number 22662306a36Sopenharmony_ci of incoming packets that a connection needs to receive before 22762306a36Sopenharmony_ci the connection will be synchronized. A connection will be 22862306a36Sopenharmony_ci synchronized, every time the number of its incoming packets 22962306a36Sopenharmony_ci modulus sync_period equals the threshold. The range of the 23062306a36Sopenharmony_ci threshold is from 0 to sync_period. 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ci When sync_period and sync_refresh_period are 0, send sync only 23362306a36Sopenharmony_ci for state changes or only once when pkts matches sync_threshold 23462306a36Sopenharmony_ci 23562306a36Sopenharmony_cisync_refresh_period - UNSIGNED INTEGER 23662306a36Sopenharmony_ci default 0 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci In seconds, difference in reported connection timer that triggers 23962306a36Sopenharmony_ci new sync message. It can be used to avoid sync messages for the 24062306a36Sopenharmony_ci specified period (or half of the connection timeout if it is lower) 24162306a36Sopenharmony_ci if connection state is not changed since last sync. 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_ci This is useful for normal connections with high traffic to reduce 24462306a36Sopenharmony_ci sync rate. Additionally, retry sync_retries times with period of 24562306a36Sopenharmony_ci sync_refresh_period/8. 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_cisync_retries - INTEGER 24862306a36Sopenharmony_ci default 0 24962306a36Sopenharmony_ci 25062306a36Sopenharmony_ci Defines sync retries with period of sync_refresh_period/8. Useful 25162306a36Sopenharmony_ci to protect against loss of sync messages. The range of the 25262306a36Sopenharmony_ci sync_retries is from 0 to 3. 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_cisync_qlen_max - UNSIGNED LONG 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_ci Hard limit for queued sync messages that are not sent yet. It 25762306a36Sopenharmony_ci defaults to 1/32 of the memory pages but actually represents 25862306a36Sopenharmony_ci number of messages. It will protect us from allocating large 25962306a36Sopenharmony_ci parts of memory when the sending rate is lower than the queuing 26062306a36Sopenharmony_ci rate. 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_cisync_sock_size - INTEGER 26362306a36Sopenharmony_ci default 0 26462306a36Sopenharmony_ci 26562306a36Sopenharmony_ci Configuration of SNDBUF (master) or RCVBUF (slave) socket limit. 26662306a36Sopenharmony_ci Default value is 0 (preserve system defaults). 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_cisync_ports - INTEGER 26962306a36Sopenharmony_ci default 1 27062306a36Sopenharmony_ci 27162306a36Sopenharmony_ci The number of threads that master and backup servers can use for 27262306a36Sopenharmony_ci sync traffic. Every thread will use single UDP port, thread 0 will 27362306a36Sopenharmony_ci use the default port 8848 while last thread will use port 27462306a36Sopenharmony_ci 8848+sync_ports-1. 27562306a36Sopenharmony_ci 27662306a36Sopenharmony_cisnat_reroute - BOOLEAN 27762306a36Sopenharmony_ci - 0 - disabled 27862306a36Sopenharmony_ci - not 0 - enabled (default) 27962306a36Sopenharmony_ci 28062306a36Sopenharmony_ci If enabled, recalculate the route of SNATed packets from 28162306a36Sopenharmony_ci realservers so that they are routed as if they originate from the 28262306a36Sopenharmony_ci director. Otherwise they are routed as if they are forwarded by the 28362306a36Sopenharmony_ci director. 28462306a36Sopenharmony_ci 28562306a36Sopenharmony_ci If policy routing is in effect then it is possible that the route 28662306a36Sopenharmony_ci of a packet originating from a director is routed differently to a 28762306a36Sopenharmony_ci packet being forwarded by the director. 28862306a36Sopenharmony_ci 28962306a36Sopenharmony_ci If policy routing is not in effect then the recalculated route will 29062306a36Sopenharmony_ci always be the same as the original route so it is an optimisation 29162306a36Sopenharmony_ci to disable snat_reroute and avoid the recalculation. 29262306a36Sopenharmony_ci 29362306a36Sopenharmony_cisync_persist_mode - INTEGER 29462306a36Sopenharmony_ci default 0 29562306a36Sopenharmony_ci 29662306a36Sopenharmony_ci Controls the synchronisation of connections when using persistence 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_ci 0: All types of connections are synchronised 29962306a36Sopenharmony_ci 30062306a36Sopenharmony_ci 1: Attempt to reduce the synchronisation traffic depending on 30162306a36Sopenharmony_ci the connection type. For persistent services avoid synchronisation 30262306a36Sopenharmony_ci for normal connections, do it only for persistence templates. 30362306a36Sopenharmony_ci In such case, for TCP and SCTP it may need enabling sloppy_tcp and 30462306a36Sopenharmony_ci sloppy_sctp flags on backup servers. For non-persistent services 30562306a36Sopenharmony_ci such optimization is not applied, mode 0 is assumed. 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_cisync_version - INTEGER 30862306a36Sopenharmony_ci default 1 30962306a36Sopenharmony_ci 31062306a36Sopenharmony_ci The version of the synchronisation protocol used when sending 31162306a36Sopenharmony_ci synchronisation messages. 31262306a36Sopenharmony_ci 31362306a36Sopenharmony_ci 0 selects the original synchronisation protocol (version 0). This 31462306a36Sopenharmony_ci should be used when sending synchronisation messages to a legacy 31562306a36Sopenharmony_ci system that only understands the original synchronisation protocol. 31662306a36Sopenharmony_ci 31762306a36Sopenharmony_ci 1 selects the current synchronisation protocol (version 1). This 31862306a36Sopenharmony_ci should be used where possible. 31962306a36Sopenharmony_ci 32062306a36Sopenharmony_ci Kernels with this sync_version entry are able to receive messages 32162306a36Sopenharmony_ci of both version 1 and version 2 of the synchronisation protocol. 32262306a36Sopenharmony_ci 32362306a36Sopenharmony_cirun_estimation - BOOLEAN 32462306a36Sopenharmony_ci 0 - disabled 32562306a36Sopenharmony_ci not 0 - enabled (default) 32662306a36Sopenharmony_ci 32762306a36Sopenharmony_ci If disabled, the estimation will be suspended and kthread tasks 32862306a36Sopenharmony_ci stopped. 32962306a36Sopenharmony_ci 33062306a36Sopenharmony_ci You can always re-enable estimation by setting this value to 1. 33162306a36Sopenharmony_ci But be careful, the first estimation after re-enable is not 33262306a36Sopenharmony_ci accurate. 333