├── LICENSE ├── README.md └── optimizingSSServer.sh /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 azadrahorg 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Optimizing Shadowsocks,V2ray,Xray,Sing-box Server (Ubuntu 22.04 and 20.04) and BBR. Install. 2 | 3 | Optimizing Server For V2ray, Xray, Sing-Box and other core 4 | Enable BBR on Ubuntu 22.04 and 20.04 5 | 6 | ### Install 7 | ```bash 8 | bash -c "$(curl -L https://raw.githubusercontent.com/azadrahorg/optimizingSSServer/main/optimizingSSServer.sh)" 9 | ``` 10 | -------------------------------------------------------------------------------- /optimizingSSServer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | 4 | echo 5 | echo "=== azadrah.org ===" 6 | echo "=== https://github.com/azadrahorg ===" 7 | echo "=== Optimizing Shadowsocks Server (Ubuntu 22.04 and 20.04) ===" 8 | echo 9 | sleep 3 10 | 11 | function exit_badly { 12 | echo "$1" 13 | exit 1 14 | } 15 | 16 | if [[ dist1=$(lsb_release -rs) == "18.04" ]] ; then exit_badly "This script is for Ubuntu 22.04 only: aborting (if you know what you're doing, try deleting this check)" 17 | else 18 | [[ $(id -u) -eq 0 ]] || exit_badly "Please re-run as root (e.g. sudo ./path/to/this/script)" 19 | fi 20 | 21 | DEBIAN_FRONTEND=noninteractive 22 | 23 | 24 | 25 | echo 26 | echo "=== Update System ===" 27 | echo 28 | sleep 1 29 | 30 | apt-get -o Acquire::ForceIPv4=true update 31 | apt-get -o Acquire::ForceIPv4=true install -y software-properties-common 32 | add-apt-repository --yes universe 33 | add-apt-repository --yes restricted 34 | add-apt-repository --yes multiverse 35 | apt-get -o Acquire::ForceIPv4=true install -y moreutils dnsutils tmux screen nano wget curl socat 36 | 37 | echo 38 | echo "=== Optimizing ===" 39 | echo 40 | sleep 1 41 | 42 | grep -Fq 'azadrahorg' /etc/sysctl.conf || echo " 43 | # https://github.com/azadrahorg 44 | net.ipv4.ip_forward = 1 45 | net.ipv4.ip_no_pmtu_disc = 1 46 | fs.file-max = 51200 47 | net.core.rmem_max = 67108864 48 | net.core.wmem_max = 67108864 49 | net.core.netdev_max_backlog = 250000 50 | net.core.somaxconn = 4096 51 | net.ipv4.tcp_syncookies = 1 52 | net.ipv4.tcp_tw_reuse = 1 53 | net.ipv4.tcp_tw_recycle = 0 54 | net.ipv4.tcp_fin_timeout = 30 55 | net.ipv4.tcp_keepalive_time = 1200 56 | net.ipv4.tcp_max_syn_backlog = 8192 57 | net.ipv4.tcp_max_tw_buckets = 5000 58 | net.ipv4.tcp_fastopen = 3 59 | net.ipv4.tcp_mem = 25600 51200 102400 60 | net.ipv4.tcp_rmem = 4096 87380 67108864 61 | net.ipv4.tcp_wmem = 4096 65536 67108864 62 | net.ipv4.tcp_mtu_probing = 1 63 | net.core.default_qdisc=fq 64 | net.ipv4.tcp_congestion_control=bbr 65 | net.ipv4.tcp_fastopen = 3 66 | net.ipv4.ip_default_ttl=129 67 | net.ipv4.tcp_timestamps=1 68 | " >> /etc/sysctl.conf 69 | 70 | grep -Fq 'azadrahorg' /etc/security/limits.conf || echo ' 71 | # https://github.com/azadrahorg 72 | root soft nofile 51200 73 | root hard nofile 51200 74 | ' >> /etc/security/limits.conf 75 | ulimit -n 51200 76 | 77 | sysctl -p >/dev/null 2>&1 78 | 79 | echo 80 | echo "=== Finished ===" 81 | echo 82 | sleep 1 83 | --------------------------------------------------------------------------------