Quick Usage[edit | edit source]

  • sysctl -a to see all set values.
  • sysctl key to see the value for 'key'
  • sysctl -w key=value to write a value for 'key'.
  • sysctl -p /etc/sysctl.conf to apply what's in the /etc/sysctl.conf file.

Examples[edit | edit source]

TCP Forwarding[edit | edit source]

If you're making a Linux router, you need to enable IP forwarding:

net.ipv4.ip_forward = 1


TCP Tuning[edit | edit source]

# Provide adequate buffer memory.
# rmem_max and wmem_max are TCP max buffer size
# settable with setsockopt(), in bytes
# tcp_rmem and tcp_wmem are per socket in bytes.
# tcp_mem is for all TCP streams, in 4096-byte pages.
# The following are suggested on IBM's
# High Performance Computing page
# net.core.rmem_max = 524288000
# net.core.wmem_max = 524288000
net.core.rmem_default = 462144000
net.core.wmem_default = 462144000

net.ipv4.tcp_rmem = 4096 46214400 262144000
net.ipv4.tcp_wmem = 4096 46214400 262144000

# This server might have 200 clients simultaneously, so:
#   max(tcp_wmem) * 2 * 200 / 4096
net.ipv4.tcp_mem = 46214400 46214400 46214400
 
# Disable TCP SACK (TCP Selective Acknowledgement),
# DSACK (duplicate TCP SACK), and FACK (Forward Acknowledgement)
net.ipv4.tcp_sack = 0
net.ipv4.tcp_dsack = 0
net.ipv4.tcp_fack = 0
 
# Disable the gradual speed increase that's useful
# on variable-speed WANs but not for us
net.ipv4.tcp_slow_start_after_idle = 0

# recommended default congestion control is htcp
net.ipv4.tcp_congestion_control=htcp

# recommended for hosts with jumbo frames enabled
net.ipv4.tcp_mtu_probing=1

# recommended for CentOS7+/Debian8+ hosts
net.core.default_qdisc = fq

net.ipv4.tcp_low_latency=1