Skip to content

Instantly share code, notes, and snippets.

@pitachx
Forked from rooty/sysctl.conf
Created January 30, 2018 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pitachx/c3f8bf16333f9c5284693b34e6b3f86a to your computer and use it in GitHub Desktop.
Save pitachx/c3f8bf16333f9c5284693b34e6b3f86a to your computer and use it in GitHub Desktop.
api-php-sysctl
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
#
#kernel.domainname = example.com
# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3
##############################################################3
# Functions previously found in netbase
#
# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
net.ipv4.conf.default.rp_filter=1
net.ipv4.conf.all.rp_filter=1
# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
#net.ipv4.tcp_syncookies=1
# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6
# Enabling this option disables Stateless Address Autoconfiguration
# based on Router Advertisements for this host
#net.ipv6.conf.all.forwarding=1
###################################################################
# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# or
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)
#net.ipv4.conf.all.send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
#net.ipv4.conf.all.accept_source_route = 0
#net.ipv6.conf.all.accept_source_route = 0
#
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
#
# Disable IPv6 autoconf
net.ipv6.conf.all.autoconf = 0
net.ipv6.conf.default.autoconf = 0
net.ipv6.conf.eth1.autoconf = 0
net.ipv6.conf.all.accept_ra = 0
net.ipv6.conf.default.accept_ra = 0
net.ipv6.conf.eth1.accept_ra = 0
#Do not swap too intensively
vm.swappiness = 10
#For REDIS
vm.overcommit_memory = 1
#For PostgreSQL
kernel.shmmax = 4294967296
kernel.shmall = 2097152
net.ipv4.ip_local_port_range=1024 65000
fs.inotify.max_user_watches=524288
# Fast port recycling (TIME_WAIT)
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
# Local port range maximized
net.ipv4.ip_local_port_range = 1024 65535
# Dont allow LB send icmp redirects on local route
net.ipv4.conf.eth1.send_redirects = 0
net.ipv4.conf.eth0.send_redirects = 0
net.ipv4.conf.lo.send_redirects = 0
# Dont allow LB to accept icmp redirects on local route
net.ipv4.conf.eth1.accept_redirects = 0
net.ipv4.conf.eth0.accept_redirects = 0
net.ipv4.conf.lo.accept_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.accept_redirects = 0
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Ignore ARP
net.ipv4.conf.eth0.arp_ignore = 1
net.ipv4.conf.eth1.arp_ignore = 1
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.default.arp_ignore = 1
net.ipv4.netfilter.ip_conntrack_max=1048576
# For expirator
fs.file-max=5000000
net.ipv4.tcp_max_orphans=131072
net.ipv4.tcp_max_syn_backlog=131072
net.core.somaxconn=20000
net.netfilter.nf_conntrack_max=1048576
net.ipv4.tcp_fin_timeout=60
net.ipv4.tcp_max_tw_buckets=524288
net.ipv4.tcp_rfc1337=1
net.ipv4.ip_local_reserved_ports=4369,8080,8000,9089,8098,5672,25672,15672,6379,5432,22222
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment