mirror of
https://github.com/Ysurac/openmptcprouter-vps.git
synced 2025-02-12 11:21:56 +00:00
Latest changes to VPS script
This commit is contained in:
parent
65209b07c3
commit
c42d055602
7 changed files with 54 additions and 22 deletions
|
@ -11,5 +11,6 @@
|
||||||
"fast_open": true,
|
"fast_open": true,
|
||||||
"no_delay": true,
|
"no_delay": true,
|
||||||
"reuse_port": true,
|
"reuse_port": true,
|
||||||
|
"ipv6_first": true,
|
||||||
"mptcp": true
|
"mptcp": true
|
||||||
}
|
}
|
|
@ -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:-$(nproc --all | tr -d "\n")}
|
||||||
NBCPU=${NBCPU:-$(grep -c '^processor' /proc/cpuinfo | tr -d "\n")}
|
NBCPU=${NBCPU:-$(grep -c '^processor' /proc/cpuinfo | tr -d "\n")}
|
||||||
OBFS=${OBFS:-yes}
|
OBFS=${OBFS:-yes}
|
||||||
|
V2RAY=${V2RAY:-yes}
|
||||||
OMR_ADMIN=${OMR_ADMIN:-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")}
|
OMR_ADMIN_PASS=${OMR_ADMIN_PASS:-$(od -vN "32" -An -tx1 /dev/urandom | tr '[:lower:]' '[:upper:]' | tr -d " \n")}
|
||||||
MLVPN=${MLVPN:-yes}
|
MLVPN=${MLVPN:-yes}
|
||||||
MLVPN_PASS=${MLVPN_PASS:-$(head -c 32 /dev/urandom | base64 -w0)}
|
MLVPN_PASS=${MLVPN_PASS:-$(head -c 32 /dev/urandom | base64 -w0)}
|
||||||
OPENVPN=${OPENVPN:-yes}
|
OPENVPN=${OPENVPN:-yes}
|
||||||
INTERFACE=${INTERFACE:-$(ip -o -4 route show to default | grep -Po '(?<=dev )(\S+)' | tr -d "\n")}
|
INTERFACE=${INTERFACE:-$(ip -o -4 route show to default | grep -Po '(?<=dev )(\S+)' | tr -d "\n")}
|
||||||
KERNEL_VERSION="4.14.91"
|
KERNEL_VERSION="4.14.94"
|
||||||
KERNEL_RELEASE="${KERNEL_VERSION}-mptcp-c828f09"
|
KERNEL_RELEASE="${KERNEL_VERSION}-mptcp-a284ba1"
|
||||||
GLORYTUN_UDP_VERSION="067ddd4aa04dbb628463666a90b7dcf3cd6963c9"
|
GLORYTUN_UDP_VERSION="067ddd4aa04dbb628463666a90b7dcf3cd6963c9"
|
||||||
MLVPN_VERSION="8f9720978b28c1954f9f229525333547283316d2"
|
MLVPN_VERSION="8f9720978b28c1954f9f229525333547283316d2"
|
||||||
OBFS_VERSION="5cbfdcc28cdc912852cc3c99e3c7f5603d337805"
|
OBFS_VERSION="5cbfdcc28cdc912852cc3c99e3c7f5603d337805"
|
||||||
OMR_ADMIN_VERSION="175ed4455959527c251d97c4cb5da62b1f83ea76"
|
OMR_ADMIN_VERSION="7add708f0c60a6a6d9a0b19f7174b35e5fdc88e5"
|
||||||
|
V2RAY_VERSION="8cea1a3"
|
||||||
SHADOWSOCKS_VERSION="3.2.3"
|
SHADOWSOCKS_VERSION="3.2.3"
|
||||||
OMR_VERSION="0.89"
|
OMR_VERSION="0.93"
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
umask 0022
|
umask 0022
|
||||||
|
@ -226,7 +228,35 @@ if [ "$OBFS" = "yes" ]; then
|
||||||
cd /tmp
|
cd /tmp
|
||||||
rm -rf /tmp/simple-obfs
|
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
|
#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
|
sed -i -e '/plugin/d' -e 's/,,//' /etc/shadowsocks-libev/config.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,9 @@ IPMasquerade=yes
|
||||||
|
|
||||||
[DHCPServer]
|
[DHCPServer]
|
||||||
PoolOffset=2
|
PoolOffset=2
|
||||||
PoolSize=2
|
PoolSize=50
|
||||||
EmitDNS=no
|
EmitDNS=no
|
||||||
EmitNTP=no
|
EmitNTP=no
|
||||||
DNS=9.9.9.9
|
DNS=9.9.9.9
|
||||||
DefaultLeaseTimeSec=12h
|
DefaultLeaseTimeSec=2h
|
||||||
MaxLeaseTimeSec=24h
|
MaxLeaseTimeSec=4h
|
|
@ -12,9 +12,9 @@ IPMasquerade=yes
|
||||||
|
|
||||||
[DHCPServer]
|
[DHCPServer]
|
||||||
PoolOffset=1
|
PoolOffset=1
|
||||||
PoolSize=2
|
PoolSize=50
|
||||||
EmitDNS=no
|
EmitDNS=no
|
||||||
EmitNTP=no
|
EmitNTP=no
|
||||||
DNS=9.9.9.9
|
DNS=9.9.9.9
|
||||||
DefaultLeaseTimeSec=12h
|
DefaultLeaseTimeSec=2h
|
||||||
MaxLeaseTimeSec=24h
|
MaxLeaseTimeSec=4h
|
|
@ -9,7 +9,7 @@ IPMasquerade=yes
|
||||||
|
|
||||||
[DHCPServer]
|
[DHCPServer]
|
||||||
PoolOffset=2
|
PoolOffset=2
|
||||||
PoolSize=10
|
PoolSize=50
|
||||||
EmitDNS=no
|
EmitDNS=no
|
||||||
EmitNTP=no
|
EmitNTP=no
|
||||||
DNS=9.9.9.9
|
DNS=9.9.9.9
|
||||||
|
|
|
@ -9,7 +9,7 @@ IPMasquerade=yes
|
||||||
|
|
||||||
[DHCPServer]
|
[DHCPServer]
|
||||||
PoolOffset=2
|
PoolOffset=2
|
||||||
PoolSize=10
|
PoolSize=50
|
||||||
EmitDNS=no
|
EmitDNS=no
|
||||||
EmitNTP=no
|
EmitNTP=no
|
||||||
DNS=9.9.9.9
|
DNS=9.9.9.9
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
# max open files
|
# max open files
|
||||||
fs.file-max = 512000
|
fs.file-max = 512000
|
||||||
# max read buffer
|
# max read buffer
|
||||||
net.core.rmem_max = 134217728
|
net.core.rmem_max = 524287
|
||||||
# max write buffer
|
# max write buffer
|
||||||
net.core.wmem_max = 134217728
|
net.core.wmem_max = 524287
|
||||||
|
net.core.optmem_max = 524287
|
||||||
# default read buffer
|
# default read buffer
|
||||||
net.core.rmem_default = 32768
|
net.core.rmem_default = 32768
|
||||||
# default write buffer
|
# default write buffer
|
||||||
|
@ -21,9 +22,9 @@ net.ipv4.tcp_tw_reuse = 1
|
||||||
# turn off fast timewait sockets recycling
|
# turn off fast timewait sockets recycling
|
||||||
net.ipv4.tcp_tw_recycle = 0
|
net.ipv4.tcp_tw_recycle = 0
|
||||||
# short FIN timeout
|
# short FIN timeout
|
||||||
net.ipv4.tcp_fin_timeout = 20
|
net.ipv4.tcp_fin_timeout = 40
|
||||||
# short keepalive time
|
# short keepalive time
|
||||||
net.ipv4.tcp_keepalive_time = 1200
|
net.ipv4.tcp_keepalive_time = 7200
|
||||||
# outbound port range
|
# outbound port range
|
||||||
net.ipv4.ip_local_port_range = 10000 65000
|
net.ipv4.ip_local_port_range = 10000 65000
|
||||||
# max SYN backlog
|
# 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
|
# turn on TCP Fast Open on both client and server side
|
||||||
net.ipv4.tcp_fastopen = 3
|
net.ipv4.tcp_fastopen = 3
|
||||||
# TCP buffer
|
# TCP buffer
|
||||||
net.ipv4.tcp_mem = 134217728 134277728 134217728
|
net.ipv4.tcp_mem = 768174 10242330 15363480
|
||||||
# UDP buffer
|
# UDP buffer
|
||||||
net.ipv4.udp_mem = 134217728 134277728 134217728
|
net.ipv4.udp_mem = 768174 10242330 15363480
|
||||||
# TCP receive buffer
|
# TCP receive buffer
|
||||||
net.ipv4.tcp_rmem = 4096 87380 134217728
|
net.ipv4.tcp_rmem = 4096 524288 204217728
|
||||||
# TCP write buffer
|
# TCP write buffer
|
||||||
net.ipv4.tcp_wmem = 4096 87380 134217728
|
net.ipv4.tcp_wmem = 4096 524288 204217728
|
||||||
# turn on path MTU discovery
|
# turn on path MTU discovery
|
||||||
net.ipv4.tcp_mtu_probing = 0
|
net.ipv4.tcp_mtu_probing = 0
|
||||||
|
|
||||||
|
@ -51,4 +52,4 @@ net.netfilter.nf_conntrack_max = 131072
|
||||||
|
|
||||||
# MPTCP settings
|
# MPTCP settings
|
||||||
net.mptcp.mptcp_checksum = 0
|
net.mptcp.mptcp_checksum = 0
|
||||||
net.mptcp.mptcp_syn_retries = 20
|
net.mptcp.mptcp_syn_retries = 5
|
||||||
|
|
Loading…
Reference in a new issue