Forked from nickfox-taterli/udp2raw_kcptun_ss_for_debian9.sh
Last active
November 26, 2018 01:31
-
-
Save hongwenjun/c9475904d6e5911a87a44e140619c86e to your computer and use it in GitHub Desktop.
Debian 9 SS 一键配置脚本,使用了KCPTUN加速,支持各种OpenVZ.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PASSWORD=123 | |
# 客户端配置参考(前两个可以路由运行,但是最后一个最好不要,路由性能有限,会让你觉得网络卡炸的.) | |
# | |
# udp2raw -c -r35.231.111.220:40002 -l0.0.0.0:40003 -kxxx --raw-mode faketcp -a --cipher-mode none --auth-mode simple | |
# kcp-client -l :9527 -r 10.0.0.1:40003 -key "xxx" -crypt none -mode fast3 | |
# SS 客户端 => 混淆:aes-256-gcm,IP:127.0.0.1:9527,密码:刚才设置的密码. | |
# 安装基本软件 | |
apt update | |
apt install -y gcc g++ git gettext build-essential autoconf libtool libpcre3-dev asciidoc xmlto libev-dev libc-ares-dev automake libmbedtls-dev libsodium-dev | |
#下载代码 | |
git clone https://github.com/shadowsocks/shadowsocks-libev.git | |
cd shadowsocks-libev | |
git submodule update --init --recursive | |
#编译安装 | |
./autogen.sh | |
./configure | |
make | |
make install | |
cd .. | |
rm shadowsocks-libev -rf | |
#下载KCPTUN | |
wget https://github.com/xtaci/kcptun/releases/download/v20181114/kcptun-linux-amd64-20181114.tar.gz | |
tar xf kcptun-linux-amd64-20181114.tar.gz | |
mv server_linux_amd64 /usr/bin/kcp-server | |
rm kcptun-linux-amd64-20181002.tar.gz | |
rm client_linux_amd64 | |
rm server_linux_amd64 | |
#下载UDP2RAW | |
wget https://github.com/wangyu-/udp2raw-tunnel/releases/download/20181113.0/udp2raw_binaries.tar.gz | |
tar xf udp2raw_binaries.tar.gz | |
mv udp2raw_amd64 /usr/bin/udp2raw | |
rm udp2raw* -rf | |
rm version.txt | |
sysctl_config() { | |
sed -i '/net.core.default_qdisc/d' /etc/sysctl.conf | |
sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf | |
echo "net.core.default_qdisc = fq" >> /etc/sysctl.conf | |
echo "net.ipv4.tcp_congestion_control = bbr" >> /etc/sysctl.conf | |
sysctl -p >/dev/null 2>&1 | |
} | |
# 开启 BBR | |
sysctl_config | |
lsmod | grep bbr | |
#安装到启动项 | |
cat <<EOF >/etc/rc.local | |
#!/bin/sh -e | |
# | |
# rc.local | |
# | |
# This script is executed at the end of each multiuser runlevel. | |
# Make sure that the script will "exit 0" on success or any other | |
# value on error. | |
# | |
# In order to enable or disable this script just change the execution | |
# bits. | |
# | |
# By default this script does nothing. | |
ss-server -s 127.0.0.1 -p 40000 -k ${PASSWORD} -m aes-256-gcm -t 300 >> /var/log/ss-server.log & | |
kcp-server -t "127.0.0.1:40000" -l "127.0.0.1:40001" --mode fast3 --key "${PASSWORD}" --crypt "none" >> /var/log/kcp-server.log & | |
udp2raw -s -l0.0.0.0:40002 -r 127.0.0.1:40001 -kxxx --raw-mode faketcp -a --cipher-mode none --auth-mode simple >> /var/log/udp2raw.log & | |
exit 0 | |
# WireGuard + UDP2RAW tcp_port 8866 | |
udp2raw -s -l0.0.0.0:8866 -r 127.0.0.1:9009 -k "passwd" --raw-mode faketcp >> /var/log/wg_udp2raw.log & | |
exit 0 | |
EOF | |
chmod +x /etc/rc.local | |
systemctl restart rc-local |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment