Skip to content

Instantly share code, notes, and snippets.

@AasSuhendar
Last active September 29, 2021 12:48
Show Gist options
  • Save AasSuhendar/72c3f6bcc121b0fe413c5d1ef315a282 to your computer and use it in GitHub Desktop.
Save AasSuhendar/72c3f6bcc121b0fe413c5d1ef315a282 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Check Privileges
if [[ $UID -ne 0 ]]; then
echo "Administrator Privilege Needed. Please run as An Administrator/Root User!"
exit 1
fi
# Enable Sysctl Tweaks
cat << EOF >> /etc/sysctl.conf
vm.max_map_count=262144
net.core.somaxconn=4096
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.core.netdev_max_backlog=2500
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
net.ipv6.conf.eth0.disable_ipv6=1
net.ipv4.tcp_mem=116730 155640 233460
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
net.ipv4.tcp_max_orphans=24576
net.ipv4.ip_no_pmtu_disc=0
net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.all.log_martians=1
net.ipv4.conf.all.accept_source_route=0
net.ipv4.conf.all.send_redirects=0
net.ipv4.conf.default.send_redirects=0
net.ipv4.icmp_echo_ignore_broadcasts=1
EOF
# Reload Sysctl
sysctl -p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment