2020-04-30 09:04:07 -07:00
|
|
|
.. SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
|
|
|
===================================
|
|
|
|
Netfilter Conntrack Sysfs variables
|
|
|
|
===================================
|
|
|
|
|
2013-01-17 16:05:08 -07:00
|
|
|
/proc/sys/net/netfilter/nf_conntrack_* Variables:
|
2020-04-30 09:04:07 -07:00
|
|
|
=================================================
|
2013-01-17 16:05:08 -07:00
|
|
|
|
|
|
|
nf_conntrack_acct - BOOLEAN
|
2020-04-30 09:04:07 -07:00
|
|
|
- 0 - disabled (default)
|
|
|
|
- not 0 - enabled
|
2013-01-17 16:05:08 -07:00
|
|
|
|
|
|
|
Enable connection tracking flow accounting. 64-bit byte and packet
|
|
|
|
counters per flow are added.
|
|
|
|
|
2016-06-22 04:26:10 -07:00
|
|
|
nf_conntrack_buckets - INTEGER
|
2013-01-17 16:05:08 -07:00
|
|
|
Size of hash table. If not specified as parameter during module
|
|
|
|
loading, the default size is calculated by dividing total memory
|
2021-08-26 06:54:19 -07:00
|
|
|
by 16384 to determine the number of buckets. The hash table will
|
|
|
|
never have fewer than 1024 and never more than 262144 buckets.
|
2016-06-22 04:26:10 -07:00
|
|
|
This sysctl is only writeable in the initial net namespace.
|
2013-01-17 16:05:08 -07:00
|
|
|
|
|
|
|
nf_conntrack_checksum - BOOLEAN
|
2020-04-30 09:04:07 -07:00
|
|
|
- 0 - disabled
|
|
|
|
- not 0 - enabled (default)
|
2013-01-17 16:05:08 -07:00
|
|
|
|
|
|
|
Verify checksum of incoming packets. Packets with bad checksums are
|
|
|
|
in INVALID state. If this is enabled, such packets will not be
|
|
|
|
considered for connection tracking.
|
|
|
|
|
|
|
|
nf_conntrack_count - INTEGER (read-only)
|
|
|
|
Number of currently allocated flow entries.
|
|
|
|
|
|
|
|
nf_conntrack_events - BOOLEAN
|
2020-04-30 09:04:07 -07:00
|
|
|
- 0 - disabled
|
2022-04-25 06:15:43 -07:00
|
|
|
- 1 - enabled
|
|
|
|
- 2 - auto (default)
|
2013-01-17 16:05:08 -07:00
|
|
|
|
|
|
|
If this option is enabled, the connection tracking code will
|
|
|
|
provide userspace with connection tracking events via ctnetlink.
|
2022-04-25 06:15:43 -07:00
|
|
|
The default allocates the extension if a userspace program is
|
|
|
|
listening to ctnetlink events.
|
2013-01-17 16:05:08 -07:00
|
|
|
|
|
|
|
nf_conntrack_expect_max - INTEGER
|
|
|
|
Maximum size of expectation table. Default value is
|
|
|
|
nf_conntrack_buckets / 256. Minimum is 1.
|
|
|
|
|
|
|
|
nf_conntrack_frag6_high_thresh - INTEGER
|
|
|
|
default 262144
|
|
|
|
|
|
|
|
Maximum memory used to reassemble IPv6 fragments. When
|
|
|
|
nf_conntrack_frag6_high_thresh bytes of memory is allocated for this
|
|
|
|
purpose, the fragment handler will toss packets until
|
|
|
|
nf_conntrack_frag6_low_thresh is reached.
|
|
|
|
|
|
|
|
nf_conntrack_frag6_low_thresh - INTEGER
|
|
|
|
default 196608
|
|
|
|
|
|
|
|
See nf_conntrack_frag6_low_thresh
|
|
|
|
|
|
|
|
nf_conntrack_frag6_timeout - INTEGER (seconds)
|
|
|
|
default 60
|
|
|
|
|
|
|
|
Time to keep an IPv6 fragment in memory.
|
|
|
|
|
|
|
|
nf_conntrack_generic_timeout - INTEGER (seconds)
|
|
|
|
default 600
|
|
|
|
|
|
|
|
Default for generic timeout. This refers to layer 4 unknown/unsupported
|
|
|
|
protocols.
|
|
|
|
|
|
|
|
nf_conntrack_icmp_timeout - INTEGER (seconds)
|
|
|
|
default 30
|
|
|
|
|
|
|
|
Default for ICMP timeout.
|
|
|
|
|
|
|
|
nf_conntrack_icmpv6_timeout - INTEGER (seconds)
|
|
|
|
default 30
|
|
|
|
|
|
|
|
Default for ICMP6 timeout.
|
|
|
|
|
|
|
|
nf_conntrack_log_invalid - INTEGER
|
2020-04-30 09:04:07 -07:00
|
|
|
- 0 - disable (default)
|
|
|
|
- 1 - log ICMP packets
|
|
|
|
- 6 - log TCP packets
|
|
|
|
- 17 - log UDP packets
|
|
|
|
- 33 - log DCCP packets
|
|
|
|
- 41 - log ICMPv6 packets
|
|
|
|
- 136 - log UDPLITE packets
|
|
|
|
- 255 - log packets of any protocol
|
2013-01-17 16:05:08 -07:00
|
|
|
|
|
|
|
Log invalid packets of a type specified by value.
|
|
|
|
|
|
|
|
nf_conntrack_max - INTEGER
|
2021-08-26 06:54:19 -07:00
|
|
|
Maximum number of allowed connection tracking entries. This value is set
|
|
|
|
to nf_conntrack_buckets by default.
|
|
|
|
Note that connection tracking entries are added to the table twice -- once
|
|
|
|
for the original direction and once for the reply direction (i.e., with
|
|
|
|
the reversed address). This means that with default settings a maxed-out
|
|
|
|
table will have a average hash chain length of 2, not 1.
|
2013-01-17 16:05:08 -07:00
|
|
|
|
|
|
|
nf_conntrack_tcp_be_liberal - BOOLEAN
|
2020-04-30 09:04:07 -07:00
|
|
|
- 0 - disabled (default)
|
|
|
|
- not 0 - enabled
|
2013-01-17 16:05:08 -07:00
|
|
|
|
|
|
|
Be conservative in what you do, be liberal in what you accept from others.
|
|
|
|
If it's non-zero, we mark only out of window RST segments as INVALID.
|
|
|
|
|
2021-05-27 00:19:06 -07:00
|
|
|
nf_conntrack_tcp_ignore_invalid_rst - BOOLEAN
|
|
|
|
- 0 - disabled (default)
|
|
|
|
- 1 - enabled
|
|
|
|
|
|
|
|
If it's 1, we don't mark out of window RST segments as INVALID.
|
|
|
|
|
2013-01-17 16:05:08 -07:00
|
|
|
nf_conntrack_tcp_loose - BOOLEAN
|
2020-04-30 09:04:07 -07:00
|
|
|
- 0 - disabled
|
|
|
|
- not 0 - enabled (default)
|
2013-01-17 16:05:08 -07:00
|
|
|
|
|
|
|
If it is set to zero, we disable picking up already established
|
|
|
|
connections.
|
|
|
|
|
|
|
|
nf_conntrack_tcp_max_retrans - INTEGER
|
|
|
|
default 3
|
|
|
|
|
|
|
|
Maximum number of packets that can be retransmitted without
|
|
|
|
received an (acceptable) ACK from the destination. If this number
|
|
|
|
is reached, a shorter timer will be started.
|
|
|
|
|
|
|
|
nf_conntrack_tcp_timeout_close - INTEGER (seconds)
|
|
|
|
default 10
|
|
|
|
|
|
|
|
nf_conntrack_tcp_timeout_close_wait - INTEGER (seconds)
|
|
|
|
default 60
|
|
|
|
|
|
|
|
nf_conntrack_tcp_timeout_established - INTEGER (seconds)
|
|
|
|
default 432000 (5 days)
|
|
|
|
|
|
|
|
nf_conntrack_tcp_timeout_fin_wait - INTEGER (seconds)
|
|
|
|
default 120
|
|
|
|
|
|
|
|
nf_conntrack_tcp_timeout_last_ack - INTEGER (seconds)
|
|
|
|
default 30
|
|
|
|
|
|
|
|
nf_conntrack_tcp_timeout_max_retrans - INTEGER (seconds)
|
|
|
|
default 300
|
|
|
|
|
|
|
|
nf_conntrack_tcp_timeout_syn_recv - INTEGER (seconds)
|
|
|
|
default 60
|
|
|
|
|
|
|
|
nf_conntrack_tcp_timeout_syn_sent - INTEGER (seconds)
|
|
|
|
default 120
|
|
|
|
|
|
|
|
nf_conntrack_tcp_timeout_time_wait - INTEGER (seconds)
|
|
|
|
default 120
|
|
|
|
|
|
|
|
nf_conntrack_tcp_timeout_unacknowledged - INTEGER (seconds)
|
|
|
|
default 300
|
|
|
|
|
|
|
|
nf_conntrack_timestamp - BOOLEAN
|
2020-04-30 09:04:07 -07:00
|
|
|
- 0 - disabled (default)
|
|
|
|
- not 0 - enabled
|
2013-01-17 16:05:08 -07:00
|
|
|
|
|
|
|
Enable connection tracking flow timestamping.
|
|
|
|
|
2022-12-12 03:07:05 -07:00
|
|
|
nf_conntrack_sctp_timeout_closed - INTEGER (seconds)
|
|
|
|
default 10
|
|
|
|
|
|
|
|
nf_conntrack_sctp_timeout_cookie_wait - INTEGER (seconds)
|
|
|
|
default 3
|
|
|
|
|
|
|
|
nf_conntrack_sctp_timeout_cookie_echoed - INTEGER (seconds)
|
|
|
|
default 3
|
|
|
|
|
|
|
|
nf_conntrack_sctp_timeout_established - INTEGER (seconds)
|
2023-01-23 18:47:21 -07:00
|
|
|
default 210
|
|
|
|
|
|
|
|
Default is set to (hb_interval * path_max_retrans + rto_max)
|
2022-12-12 03:07:05 -07:00
|
|
|
|
|
|
|
nf_conntrack_sctp_timeout_shutdown_sent - INTEGER (seconds)
|
netfilter: set default timeout to 3 secs for sctp shutdown send and recv state
In SCTP protocol, it is using the same timer (T2 timer) for SHUTDOWN and
SHUTDOWN_ACK retransmission. However in sctp conntrack the default timeout
value for SCTP_CONNTRACK_SHUTDOWN_ACK_SENT state is 3 secs while it's 300
msecs for SCTP_CONNTRACK_SHUTDOWN_SEND/RECV state.
As Paolo Valerio noticed, this might cause unwanted expiration of the ct
entry. In my test, with 1s tc netem delay set on the NAT path, after the
SHUTDOWN is sent, the sctp ct entry enters SCTP_CONNTRACK_SHUTDOWN_SEND
state. However, due to 300ms (too short) delay, when the SHUTDOWN_ACK is
sent back from the peer, the sctp ct entry has expired and been deleted,
and then the SHUTDOWN_ACK has to be dropped.
Also, it is confusing these two sysctl options always show 0 due to all
timeout values using sec as unit:
net.netfilter.nf_conntrack_sctp_timeout_shutdown_recd = 0
net.netfilter.nf_conntrack_sctp_timeout_shutdown_sent = 0
This patch fixes it by also using 3 secs for sctp shutdown send and recv
state in sctp conntrack, which is also RTO.initial value in SCTP protocol.
Note that the very short time value for SCTP_CONNTRACK_SHUTDOWN_SEND/RECV
was probably used for a rare scenario where SHUTDOWN is sent on 1st path
but SHUTDOWN_ACK is replied on 2nd path, then a new connection started
immediately on 1st path. So this patch also moves from SHUTDOWN_SEND/RECV
to CLOSE when receiving INIT in the ORIGINAL direction.
Fixes: 9fb9cbb1082d ("[NETFILTER]: Add nf_conntrack subsystem.")
Reported-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
2023-08-15 11:08:47 -07:00
|
|
|
default 3
|
2022-12-12 03:07:05 -07:00
|
|
|
|
|
|
|
nf_conntrack_sctp_timeout_shutdown_recd - INTEGER (seconds)
|
netfilter: set default timeout to 3 secs for sctp shutdown send and recv state
In SCTP protocol, it is using the same timer (T2 timer) for SHUTDOWN and
SHUTDOWN_ACK retransmission. However in sctp conntrack the default timeout
value for SCTP_CONNTRACK_SHUTDOWN_ACK_SENT state is 3 secs while it's 300
msecs for SCTP_CONNTRACK_SHUTDOWN_SEND/RECV state.
As Paolo Valerio noticed, this might cause unwanted expiration of the ct
entry. In my test, with 1s tc netem delay set on the NAT path, after the
SHUTDOWN is sent, the sctp ct entry enters SCTP_CONNTRACK_SHUTDOWN_SEND
state. However, due to 300ms (too short) delay, when the SHUTDOWN_ACK is
sent back from the peer, the sctp ct entry has expired and been deleted,
and then the SHUTDOWN_ACK has to be dropped.
Also, it is confusing these two sysctl options always show 0 due to all
timeout values using sec as unit:
net.netfilter.nf_conntrack_sctp_timeout_shutdown_recd = 0
net.netfilter.nf_conntrack_sctp_timeout_shutdown_sent = 0
This patch fixes it by also using 3 secs for sctp shutdown send and recv
state in sctp conntrack, which is also RTO.initial value in SCTP protocol.
Note that the very short time value for SCTP_CONNTRACK_SHUTDOWN_SEND/RECV
was probably used for a rare scenario where SHUTDOWN is sent on 1st path
but SHUTDOWN_ACK is replied on 2nd path, then a new connection started
immediately on 1st path. So this patch also moves from SHUTDOWN_SEND/RECV
to CLOSE when receiving INIT in the ORIGINAL direction.
Fixes: 9fb9cbb1082d ("[NETFILTER]: Add nf_conntrack subsystem.")
Reported-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
2023-08-15 11:08:47 -07:00
|
|
|
default 3
|
2022-12-12 03:07:05 -07:00
|
|
|
|
|
|
|
nf_conntrack_sctp_timeout_shutdown_ack_sent - INTEGER (seconds)
|
|
|
|
default 3
|
|
|
|
|
|
|
|
nf_conntrack_sctp_timeout_heartbeat_sent - INTEGER (seconds)
|
|
|
|
default 30
|
|
|
|
|
|
|
|
This timeout is used to setup conntrack entry on secondary paths.
|
|
|
|
Default is set to hb_interval.
|
|
|
|
|
2013-01-17 16:05:08 -07:00
|
|
|
nf_conntrack_udp_timeout - INTEGER (seconds)
|
|
|
|
default 30
|
|
|
|
|
2018-06-04 03:07:37 -07:00
|
|
|
nf_conntrack_udp_timeout_stream - INTEGER (seconds)
|
2018-12-17 16:05:29 -07:00
|
|
|
default 120
|
2013-01-17 16:05:08 -07:00
|
|
|
|
|
|
|
This extended timeout will be used in case there is an UDP stream
|
|
|
|
detected.
|
2018-12-18 06:14:07 -07:00
|
|
|
|
|
|
|
nf_conntrack_gre_timeout - INTEGER (seconds)
|
|
|
|
default 30
|
|
|
|
|
|
|
|
nf_conntrack_gre_timeout_stream - INTEGER (seconds)
|
|
|
|
default 180
|
|
|
|
|
|
|
|
This extended timeout will be used in case there is an GRE stream
|
|
|
|
detected.
|
2021-06-16 23:50:06 -07:00
|
|
|
|
2021-08-17 01:39:37 -07:00
|
|
|
nf_hooks_lwtunnel - BOOLEAN
|
|
|
|
- 0 - disabled (default)
|
|
|
|
- not 0 - enabled
|
|
|
|
|
|
|
|
If this option is enabled, the lightweight tunnel netfilter hooks are
|
|
|
|
enabled. This option cannot be disabled once it is enabled.
|
|
|
|
|
2021-06-16 23:50:06 -07:00
|
|
|
nf_flowtable_tcp_timeout - INTEGER (seconds)
|
|
|
|
default 30
|
|
|
|
|
|
|
|
Control offload timeout for tcp connections.
|
|
|
|
TCP connections may be offloaded from nf conntrack to nf flow table.
|
2024-04-19 04:39:31 -07:00
|
|
|
Once aged, the connection is returned to nf conntrack.
|
2021-06-16 23:50:06 -07:00
|
|
|
|
|
|
|
nf_flowtable_udp_timeout - INTEGER (seconds)
|
|
|
|
default 30
|
|
|
|
|
|
|
|
Control offload timeout for udp connections.
|
|
|
|
UDP connections may be offloaded from nf conntrack to nf flow table.
|
2024-04-19 04:39:31 -07:00
|
|
|
Once aged, the connection is returned to nf conntrack.
|