ipvs-sysctl.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. .. SPDX-License-Identifier: GPL-2.0
  2. ===========
  3. IPvs-sysctl
  4. ===========
  5. /proc/sys/net/ipv4/vs/* Variables:
  6. ==================================
  7. am_droprate - INTEGER
  8. default 10
  9. It sets the always mode drop rate, which is used in the mode 3
  10. of the drop_rate defense.
  11. amemthresh - INTEGER
  12. default 1024
  13. It sets the available memory threshold (in pages), which is
  14. used in the automatic modes of defense. When there is no
  15. enough available memory, the respective strategy will be
  16. enabled and the variable is automatically set to 2, otherwise
  17. the strategy is disabled and the variable is set to 1.
  18. backup_only - BOOLEAN
  19. - 0 - disabled (default)
  20. - not 0 - enabled
  21. If set, disable the director function while the server is
  22. in backup mode to avoid packet loops for DR/TUN methods.
  23. conn_reuse_mode - INTEGER
  24. 1 - default
  25. Controls how ipvs will deal with connections that are detected
  26. port reuse. It is a bitmap, with the values being:
  27. 0: disable any special handling on port reuse. The new
  28. connection will be delivered to the same real server that was
  29. servicing the previous connection.
  30. bit 1: enable rescheduling of new connections when it is safe.
  31. That is, whenever expire_nodest_conn and for TCP sockets, when
  32. the connection is in TIME_WAIT state (which is only possible if
  33. you use NAT mode).
  34. bit 2: it is bit 1 plus, for TCP connections, when connections
  35. are in FIN_WAIT state, as this is the last state seen by load
  36. balancer in Direct Routing mode. This bit helps on adding new
  37. real servers to a very busy cluster.
  38. conntrack - BOOLEAN
  39. - 0 - disabled (default)
  40. - not 0 - enabled
  41. If set, maintain connection tracking entries for
  42. connections handled by IPVS.
  43. This should be enabled if connections handled by IPVS are to be
  44. also handled by stateful firewall rules. That is, iptables rules
  45. that make use of connection tracking. It is a performance
  46. optimisation to disable this setting otherwise.
  47. Connections handled by the IPVS FTP application module
  48. will have connection tracking entries regardless of this setting.
  49. Only available when IPVS is compiled with CONFIG_IP_VS_NFCT enabled.
  50. cache_bypass - BOOLEAN
  51. - 0 - disabled (default)
  52. - not 0 - enabled
  53. If it is enabled, forward packets to the original destination
  54. directly when no cache server is available and destination
  55. address is not local (iph->daddr is RTN_UNICAST). It is mostly
  56. used in transparent web cache cluster.
  57. debug_level - INTEGER
  58. - 0 - transmission error messages (default)
  59. - 1 - non-fatal error messages
  60. - 2 - configuration
  61. - 3 - destination trash
  62. - 4 - drop entry
  63. - 5 - service lookup
  64. - 6 - scheduling
  65. - 7 - connection new/expire, lookup and synchronization
  66. - 8 - state transition
  67. - 9 - binding destination, template checks and applications
  68. - 10 - IPVS packet transmission
  69. - 11 - IPVS packet handling (ip_vs_in/ip_vs_out)
  70. - 12 or more - packet traversal
  71. Only available when IPVS is compiled with CONFIG_IP_VS_DEBUG enabled.
  72. Higher debugging levels include the messages for lower debugging
  73. levels, so setting debug level 2, includes level 0, 1 and 2
  74. messages. Thus, logging becomes more and more verbose the higher
  75. the level.
  76. drop_entry - INTEGER
  77. - 0 - disabled (default)
  78. The drop_entry defense is to randomly drop entries in the
  79. connection hash table, just in order to collect back some
  80. memory for new connections. In the current code, the
  81. drop_entry procedure can be activated every second, then it
  82. randomly scans 1/32 of the whole and drops entries that are in
  83. the SYN-RECV/SYNACK state, which should be effective against
  84. syn-flooding attack.
  85. The valid values of drop_entry are from 0 to 3, where 0 means
  86. that this strategy is always disabled, 1 and 2 mean automatic
  87. modes (when there is no enough available memory, the strategy
  88. is enabled and the variable is automatically set to 2,
  89. otherwise the strategy is disabled and the variable is set to
  90. 1), and 3 means that the strategy is always enabled.
  91. drop_packet - INTEGER
  92. - 0 - disabled (default)
  93. The drop_packet defense is designed to drop 1/rate packets
  94. before forwarding them to real servers. If the rate is 1, then
  95. drop all the incoming packets.
  96. The value definition is the same as that of the drop_entry. In
  97. the automatic mode, the rate is determined by the follow
  98. formula: rate = amemthresh / (amemthresh - available_memory)
  99. when available memory is less than the available memory
  100. threshold. When the mode 3 is set, the always mode drop rate
  101. is controlled by the /proc/sys/net/ipv4/vs/am_droprate.
  102. est_cpulist - CPULIST
  103. Allowed CPUs for estimation kthreads
  104. Syntax: standard cpulist format
  105. empty list - stop kthread tasks and estimation
  106. default - the system's housekeeping CPUs for kthreads
  107. Example:
  108. "all": all possible CPUs
  109. "0-N": all possible CPUs, N denotes last CPU number
  110. "0,1-N:1/2": first and all CPUs with odd number
  111. "": empty list
  112. est_nice - INTEGER
  113. default 0
  114. Valid range: -20 (more favorable) .. 19 (less favorable)
  115. Niceness value to use for the estimation kthreads (scheduling
  116. priority)
  117. expire_nodest_conn - BOOLEAN
  118. - 0 - disabled (default)
  119. - not 0 - enabled
  120. The default value is 0, the load balancer will silently drop
  121. packets when its destination server is not available. It may
  122. be useful, when user-space monitoring program deletes the
  123. destination server (because of server overload or wrong
  124. detection) and add back the server later, and the connections
  125. to the server can continue.
  126. If this feature is enabled, the load balancer will expire the
  127. connection immediately when a packet arrives and its
  128. destination server is not available, then the client program
  129. will be notified that the connection is closed. This is
  130. equivalent to the feature some people requires to flush
  131. connections when its destination is not available.
  132. expire_quiescent_template - BOOLEAN
  133. - 0 - disabled (default)
  134. - not 0 - enabled
  135. When set to a non-zero value, the load balancer will expire
  136. persistent templates when the destination server is quiescent.
  137. This may be useful, when a user makes a destination server
  138. quiescent by setting its weight to 0 and it is desired that
  139. subsequent otherwise persistent connections are sent to a
  140. different destination server. By default new persistent
  141. connections are allowed to quiescent destination servers.
  142. If this feature is enabled, the load balancer will expire the
  143. persistence template if it is to be used to schedule a new
  144. connection and the destination server is quiescent.
  145. ignore_tunneled - BOOLEAN
  146. - 0 - disabled (default)
  147. - not 0 - enabled
  148. If set, ipvs will set the ipvs_property on all packets which are of
  149. unrecognized protocols. This prevents us from routing tunneled
  150. protocols like ipip, which is useful to prevent rescheduling
  151. packets that have been tunneled to the ipvs host (i.e. to prevent
  152. ipvs routing loops when ipvs is also acting as a real server).
  153. nat_icmp_send - BOOLEAN
  154. - 0 - disabled (default)
  155. - not 0 - enabled
  156. It controls sending icmp error messages (ICMP_DEST_UNREACH)
  157. for VS/NAT when the load balancer receives packets from real
  158. servers but the connection entries don't exist.
  159. pmtu_disc - BOOLEAN
  160. - 0 - disabled
  161. - not 0 - enabled (default)
  162. By default, reject with FRAG_NEEDED all DF packets that exceed
  163. the PMTU, irrespective of the forwarding method. For TUN method
  164. the flag can be disabled to fragment such packets.
  165. secure_tcp - INTEGER
  166. - 0 - disabled (default)
  167. The secure_tcp defense is to use a more complicated TCP state
  168. transition table. For VS/NAT, it also delays entering the
  169. TCP ESTABLISHED state until the three way handshake is completed.
  170. The value definition is the same as that of drop_entry and
  171. drop_packet.
  172. sync_threshold - vector of 2 INTEGERs: sync_threshold, sync_period
  173. default 3 50
  174. It sets synchronization threshold, which is the minimum number
  175. of incoming packets that a connection needs to receive before
  176. the connection will be synchronized. A connection will be
  177. synchronized, every time the number of its incoming packets
  178. modulus sync_period equals the threshold. The range of the
  179. threshold is from 0 to sync_period.
  180. When sync_period and sync_refresh_period are 0, send sync only
  181. for state changes or only once when pkts matches sync_threshold
  182. sync_refresh_period - UNSIGNED INTEGER
  183. default 0
  184. In seconds, difference in reported connection timer that triggers
  185. new sync message. It can be used to avoid sync messages for the
  186. specified period (or half of the connection timeout if it is lower)
  187. if connection state is not changed since last sync.
  188. This is useful for normal connections with high traffic to reduce
  189. sync rate. Additionally, retry sync_retries times with period of
  190. sync_refresh_period/8.
  191. sync_retries - INTEGER
  192. default 0
  193. Defines sync retries with period of sync_refresh_period/8. Useful
  194. to protect against loss of sync messages. The range of the
  195. sync_retries is from 0 to 3.
  196. sync_qlen_max - UNSIGNED LONG
  197. Hard limit for queued sync messages that are not sent yet. It
  198. defaults to 1/32 of the memory pages but actually represents
  199. number of messages. It will protect us from allocating large
  200. parts of memory when the sending rate is lower than the queuing
  201. rate.
  202. sync_sock_size - INTEGER
  203. default 0
  204. Configuration of SNDBUF (master) or RCVBUF (slave) socket limit.
  205. Default value is 0 (preserve system defaults).
  206. sync_ports - INTEGER
  207. default 1
  208. The number of threads that master and backup servers can use for
  209. sync traffic. Every thread will use single UDP port, thread 0 will
  210. use the default port 8848 while last thread will use port
  211. 8848+sync_ports-1.
  212. snat_reroute - BOOLEAN
  213. - 0 - disabled
  214. - not 0 - enabled (default)
  215. If enabled, recalculate the route of SNATed packets from
  216. realservers so that they are routed as if they originate from the
  217. director. Otherwise they are routed as if they are forwarded by the
  218. director.
  219. If policy routing is in effect then it is possible that the route
  220. of a packet originating from a director is routed differently to a
  221. packet being forwarded by the director.
  222. If policy routing is not in effect then the recalculated route will
  223. always be the same as the original route so it is an optimisation
  224. to disable snat_reroute and avoid the recalculation.
  225. sync_persist_mode - INTEGER
  226. default 0
  227. Controls the synchronisation of connections when using persistence
  228. 0: All types of connections are synchronised
  229. 1: Attempt to reduce the synchronisation traffic depending on
  230. the connection type. For persistent services avoid synchronisation
  231. for normal connections, do it only for persistence templates.
  232. In such case, for TCP and SCTP it may need enabling sloppy_tcp and
  233. sloppy_sctp flags on backup servers. For non-persistent services
  234. such optimization is not applied, mode 0 is assumed.
  235. sync_version - INTEGER
  236. default 1
  237. The version of the synchronisation protocol used when sending
  238. synchronisation messages.
  239. 0 selects the original synchronisation protocol (version 0). This
  240. should be used when sending synchronisation messages to a legacy
  241. system that only understands the original synchronisation protocol.
  242. 1 selects the current synchronisation protocol (version 1). This
  243. should be used where possible.
  244. Kernels with this sync_version entry are able to receive messages
  245. of both version 1 and version 2 of the synchronisation protocol.
  246. run_estimation - BOOLEAN
  247. 0 - disabled
  248. not 0 - enabled (default)
  249. If disabled, the estimation will be suspended and kthread tasks
  250. stopped.
  251. You can always re-enable estimation by setting this value to 1.
  252. But be careful, the first estimation after re-enable is not
  253. accurate.