RSS

Troubleshooting sysctl: cannot stat /proc/sys/net/ipv4/tcp_tw_recycle: No such file or directory

Troubleshooting setting net.ipv4.tcp_tw_recycle = 0 in /etc/sysctl.conf caused error: sysctl: cannot stat /proc/sys/net/ipv4/tcp_tw_recycle: No such file or directory

What is net.ipv4.tcp_tw_recycle

Per Linux kernel document networking/ip-sysctl.txt:

tcp_tw_recycle - BOOLEAN

Enable fast recycling TIME-WAIT sockets. Default value is 0. It should not be changed without advice/request of technical experts.

This documentation is not clear what is mechanism and what is the side effect.

Symptom - sysctl: cannot stat /proc/sys/net/ipv4/tcp_tw_recycle: No such file or directory

When I tried to put following line into /etc/sysctl.conf:

net.ipv4.tcp_tw_recycle = 0

Then use sysctl -p to reload it, I got following error:

$ sudo sysctl -p
sysctl: cannot stat /proc/sys/net/ipv4/tcp_tw_recycle: No such file or directory

Analysis

The net.ipv4.tcp_tw_recycle has been removed from Linux 4.12 on 2017.

Check kernel version:

$ uname -a
Linux pi3 4.19.97-v7+ #1294 SMP

My kernel version is 4.19 which is newer than 4.12, net.ipv4.tcp_tw_recycle is not available anymore. This error can be safely ignored.

Should not set this option anymore.

Reason to remove

Per kernel git commit history, tcp_tw_recycle is not functional and cause problem.

The tcp_tw_recycle was already broken for connections behind NAT, since the per-destination timestamp is not monotonically increasing for multiple machines behind a single destination address.

After the randomization of TCP timestamp offsets in commit 8a5bd45f6616 (tcp: randomize tcp timestamp offsets for each connection), the tcp_tw_recycle is broken for all types of connections for the same reason: the timestamps received from a single machine is not monotonically increasing, anymore.

Remove tcp_tw_recycle, since it is not functional. Also, remove the PAWSPassive SNMP counter since it is only used for tcp_tw_recycle, and simplify tcp_v4_route_req and tcp_v6_route_req since the strict argument is only set when tcp_tw_recycle is enabled.

Linux kernel commit 4396e4618: tcp: remove tcp_tw_recycle .

Suggestion

Consider to use tcp_tw_reuse by set to 1 to improve network server performance:

net.ipv4.tcp_tw_reuse = 1

tcp_tw_reuse - INTEGER

Enable reuse of TIME-WAIT sockets for new connections when it is safe from protocol viewpoint.

  • 0 - disable
  • 1 - global enable
  • 2 - enable for loopback traffic only

It should not be changed without advice/request of technical experts.

Default: 2

Read more:

References

OmniLock - Block / Hide App on iOS

Block distractive apps from appearing on the Home Screen and App Library, enhance your focus and reduce screen time.

DNS Firewall for iOS and Mac OS

Encrypted your DNS to protect your privacy and firewall to block phishing, malicious domains, block ads in all browsers and apps

Ad