tcptweaker.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/bash
  2. clear
  3. echo -e "\033[1;37m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m"
  4. echo -e "\E[44;1;37m TCP TWEAKER \E[0m"
  5. echo -e "\033[1;37m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m"
  6. if [[ `grep -c "^#PH56" /etc/sysctl.conf` -eq 1 ]]
  7. then
  8. echo ""
  9. echo "As configurações de rede TCP Tweaker já foram adicionadas no sistema!"
  10. echo ""
  11. read -p "Deseja remover as configurações do TCP Tweaker? [s/n]: " -e -i n resposta0
  12. if [[ "$resposta0" = 's' ]]; then
  13. grep -v "^#PH56
  14. net.ipv4.tcp_window_scaling = 1
  15. net.core.rmem_max = 16777216
  16. net.core.wmem_max = 16777216
  17. net.ipv4.tcp_rmem = 4096 87380 16777216
  18. net.ipv4.tcp_wmem = 4096 16384 16777216
  19. net.ipv4.tcp_low_latency = 1
  20. net.ipv4.tcp_slow_start_after_idle = 0" /etc/sysctl.conf > /tmp/syscl && mv /tmp/syscl /etc/sysctl.conf
  21. sysctl -p /etc/sysctl.conf > /dev/null
  22. echo ""
  23. echo "As configurações de rede do TCP Tweaker foram removidas com sucesso."
  24. echo ""
  25. exit
  26. else
  27. echo ""
  28. exit
  29. fi
  30. else
  31. echo ""
  32. echo "ESTE SCRIPT IRÁ ALTERAR AS CONFIGURAÇÕES DE REDE DO"
  33. echo "SISTEMA PARA REDUZIR A LATÊNCIA E MELHORAR A VELOCIDADE"
  34. echo ""
  35. read -p "Continuar com a instalação? [s/n]: " -e -i n resposta
  36. if [[ "$resposta" = 's' ]]; then
  37. echo ""
  38. echo "Modificando as seguintes configurações:"
  39. echo " " >> /etc/sysctl.conf
  40. echo "#PH56" >> /etc/sysctl.conf
  41. echo "net.ipv4.tcp_window_scaling = 1
  42. net.core.rmem_max = 16777216
  43. net.core.wmem_max = 16777216
  44. net.ipv4.tcp_rmem = 4096 87380 16777216
  45. net.ipv4.tcp_wmem = 4096 16384 16777216
  46. net.ipv4.tcp_low_latency = 1
  47. net.ipv4.tcp_slow_start_after_idle = 0" >> /etc/sysctl.conf
  48. sleep 2
  49. echo ""
  50. sysctl -p /etc/sysctl.conf
  51. echo ""
  52. echo "As configurações de rede do TCP Tweaker foram adicionadas com sucesso."
  53. echo ""
  54. else
  55. echo ""
  56. echo "A instalação foi cancelada pelo usuário!"
  57. echo ""
  58. fi
  59. fi
  60. exit