From c42d055602174026a3320b116d6f8e76973de9ce Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Sun, 10 Feb 2019 07:46:29 +0000 Subject: [PATCH] Latest changes to VPS script --- config.json | 1 + debian9-x86_64.sh | 40 +++++++++++++++++++++++++++++++++++----- glorytun-udp.network | 6 +++--- glorytun.network | 6 +++--- mlvpn.network | 2 +- openvpn.network | 2 +- shadowsocks.conf | 19 ++++++++++--------- 7 files changed, 54 insertions(+), 22 deletions(-) diff --git a/config.json b/config.json index bc43c1e..562fee3 100644 --- a/config.json +++ b/config.json @@ -11,5 +11,6 @@ "fast_open": true, "no_delay": true, "reuse_port": true, + "ipv6_first": true, "mptcp": true } \ No newline at end of file diff --git a/debian9-x86_64.sh b/debian9-x86_64.sh index 9188dd4..4da18aa 100644 --- a/debian9-x86_64.sh +++ b/debian9-x86_64.sh @@ -4,20 +4,22 @@ GLORYTUN_PASS=${GLORYTUN_PASS:-$(od -vN "32" -An -tx1 /dev/urandom | tr '[:lowe #NBCPU=${NBCPU:-$(nproc --all | tr -d "\n")} NBCPU=${NBCPU:-$(grep -c '^processor' /proc/cpuinfo | tr -d "\n")} OBFS=${OBFS:-yes} +V2RAY=${V2RAY:-yes} OMR_ADMIN=${OMR_ADMIN:-yes} OMR_ADMIN_PASS=${OMR_ADMIN_PASS:-$(od -vN "32" -An -tx1 /dev/urandom | tr '[:lower:]' '[:upper:]' | tr -d " \n")} MLVPN=${MLVPN:-yes} MLVPN_PASS=${MLVPN_PASS:-$(head -c 32 /dev/urandom | base64 -w0)} OPENVPN=${OPENVPN:-yes} INTERFACE=${INTERFACE:-$(ip -o -4 route show to default | grep -Po '(?<=dev )(\S+)' | tr -d "\n")} -KERNEL_VERSION="4.14.91" -KERNEL_RELEASE="${KERNEL_VERSION}-mptcp-c828f09" +KERNEL_VERSION="4.14.94" +KERNEL_RELEASE="${KERNEL_VERSION}-mptcp-a284ba1" GLORYTUN_UDP_VERSION="067ddd4aa04dbb628463666a90b7dcf3cd6963c9" MLVPN_VERSION="8f9720978b28c1954f9f229525333547283316d2" OBFS_VERSION="5cbfdcc28cdc912852cc3c99e3c7f5603d337805" -OMR_ADMIN_VERSION="175ed4455959527c251d97c4cb5da62b1f83ea76" +OMR_ADMIN_VERSION="7add708f0c60a6a6d9a0b19f7174b35e5fdc88e5" +V2RAY_VERSION="8cea1a3" SHADOWSOCKS_VERSION="3.2.3" -OMR_VERSION="0.89" +OMR_VERSION="0.93" set -e umask 0022 @@ -226,7 +228,35 @@ if [ "$OBFS" = "yes" ]; then cd /tmp rm -rf /tmp/simple-obfs #sed -i 's%"mptcp": true%"mptcp": true,\n"plugin": "/usr/local/bin/obfs-server",\n"plugin_opts": "obfs=http;mptcp;fast-open;t=400"%' /etc/shadowsocks-libev/config.json -else +fi + +# Install v2ray-plugin +if [ "$V2RAY" = "yes" ]; then + echo "Install v2ray plugin" + rm -rf /tmp/v2ray-plugin-linux-amd64-${V2RAY_VERSION}.tar.gz + wget -O /tmp/v2ray-plugin-linux-amd64-${V2RAY_VERSION}.tar.gz https://github.com/shadowsocks/v2ray-plugin/releases/download/v1.0/v2ray-plugin-linux-amd64-${V2RAY_VERSION}.tar.gz + cd /tmp + tar xzvf v2ray-plugin-linux-amd64-${V2RAY_VERSION}.tar.gz + cp v2ray-plugin_linux_amd64 /usr/local/bin/v2ray-plugin + cd /tmp + rm -rf /tmp/v2ray-plugin_linux_amd64 + rm -rf /tmp/v2ray-plugin-linux-amd64-${V2RAY_VERSION}.tar.gz + + #rm -rf /tmp/v2ray-plugin + #cd /tmp + #rm -f /var/lib/dpkg/lock + #apt-get install -y --no-install-recommends git ca-certificates golang-go + #git clone https://github.com/shadowsocks/v2ray-plugin.git /tmp/v2ray-plugin + #cd /tmp/v2ray-plugin + #git checkout ${V2RAY_VERSION} + #git submodule update --init --recursive + #CGO_ENABLED=0 go build -o v2ray-plugin + #cp v2ray-plugin /usr/local/bin/v2ray-plugin + #cd /tmp + #rm -rf /tmp/simple-obfs +fi + +if [ "$OBFS" = "no" ] && [ "$V2RAYPLUGIN" = "no" ]; then sed -i -e '/plugin/d' -e 's/,,//' /etc/shadowsocks-libev/config.json fi diff --git a/glorytun-udp.network b/glorytun-udp.network index b75f9c5..db29038 100644 --- a/glorytun-udp.network +++ b/glorytun-udp.network @@ -9,9 +9,9 @@ IPMasquerade=yes [DHCPServer] PoolOffset=2 -PoolSize=2 +PoolSize=50 EmitDNS=no EmitNTP=no DNS=9.9.9.9 -DefaultLeaseTimeSec=12h -MaxLeaseTimeSec=24h \ No newline at end of file +DefaultLeaseTimeSec=2h +MaxLeaseTimeSec=4h \ No newline at end of file diff --git a/glorytun.network b/glorytun.network index c1fa921..85ba096 100644 --- a/glorytun.network +++ b/glorytun.network @@ -12,9 +12,9 @@ IPMasquerade=yes [DHCPServer] PoolOffset=1 -PoolSize=2 +PoolSize=50 EmitDNS=no EmitNTP=no DNS=9.9.9.9 -DefaultLeaseTimeSec=12h -MaxLeaseTimeSec=24h \ No newline at end of file +DefaultLeaseTimeSec=2h +MaxLeaseTimeSec=4h \ No newline at end of file diff --git a/mlvpn.network b/mlvpn.network index de1e503..5d42bb6 100644 --- a/mlvpn.network +++ b/mlvpn.network @@ -9,7 +9,7 @@ IPMasquerade=yes [DHCPServer] PoolOffset=2 -PoolSize=10 +PoolSize=50 EmitDNS=no EmitNTP=no DNS=9.9.9.9 diff --git a/openvpn.network b/openvpn.network index 268744c..2d85ed5 100644 --- a/openvpn.network +++ b/openvpn.network @@ -9,7 +9,7 @@ IPMasquerade=yes [DHCPServer] PoolOffset=2 -PoolSize=10 +PoolSize=50 EmitDNS=no EmitNTP=no DNS=9.9.9.9 diff --git a/shadowsocks.conf b/shadowsocks.conf index 47f1a0a..33e0c41 100644 --- a/shadowsocks.conf +++ b/shadowsocks.conf @@ -2,9 +2,10 @@ # max open files fs.file-max = 512000 # max read buffer -net.core.rmem_max = 134217728 +net.core.rmem_max = 524287 # max write buffer -net.core.wmem_max = 134217728 +net.core.wmem_max = 524287 +net.core.optmem_max = 524287 # default read buffer net.core.rmem_default = 32768 # default write buffer @@ -21,9 +22,9 @@ net.ipv4.tcp_tw_reuse = 1 # turn off fast timewait sockets recycling net.ipv4.tcp_tw_recycle = 0 # short FIN timeout -net.ipv4.tcp_fin_timeout = 20 +net.ipv4.tcp_fin_timeout = 40 # short keepalive time -net.ipv4.tcp_keepalive_time = 1200 +net.ipv4.tcp_keepalive_time = 7200 # outbound port range net.ipv4.ip_local_port_range = 10000 65000 # max SYN backlog @@ -33,13 +34,13 @@ net.ipv4.tcp_max_tw_buckets = 10000 # turn on TCP Fast Open on both client and server side net.ipv4.tcp_fastopen = 3 # TCP buffer -net.ipv4.tcp_mem = 134217728 134277728 134217728 +net.ipv4.tcp_mem = 768174 10242330 15363480 # UDP buffer -net.ipv4.udp_mem = 134217728 134277728 134217728 +net.ipv4.udp_mem = 768174 10242330 15363480 # TCP receive buffer -net.ipv4.tcp_rmem = 4096 87380 134217728 +net.ipv4.tcp_rmem = 4096 524288 204217728 # TCP write buffer -net.ipv4.tcp_wmem = 4096 87380 134217728 +net.ipv4.tcp_wmem = 4096 524288 204217728 # turn on path MTU discovery net.ipv4.tcp_mtu_probing = 0 @@ -51,4 +52,4 @@ net.netfilter.nf_conntrack_max = 131072 # MPTCP settings net.mptcp.mptcp_checksum = 0 -net.mptcp.mptcp_syn_retries = 20 +net.mptcp.mptcp_syn_retries = 5