From 7e934cc461e07e8f013f430f684ca25fcacb9c21 Mon Sep 17 00:00:00 2001 From: Yuk1n0 <39364985+Yuk1n0@users.noreply.github.com> Date: Mon, 4 Nov 2019 22:54:04 +0800 Subject: [PATCH] Update README --- README.md | 142 ++++++++++---------------------------------------- tcp_bbrplus.c | 9 ++-- 2 files changed, 31 insertions(+), 120 deletions(-) diff --git a/README.md b/README.md index 0423f54..1bbd987 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,56 @@ -# 一键安装脚本(四合一) +# Auto Install Server Shell Script -- 脚本说明: Shadowsocks 一键安装脚本(四合一) -- 系统支持: CentOS 6+,Debian 7+,Ubuntu 12+ +- Intro: Auto Install Proxy Server +- System Requirement: CentOS 6+,Debian 7+,Ubuntu 12+ -## 下载安装: +## How to install server: ``` bash wget --no-check-certificate -O shadowsocks-all.sh https://raw.githubusercontent.com/Yuk1n0/Shadowsocks-Install/master/shadowsocks-all.sh chmod +x shadowsocks-all.sh ./shadowsocks-all.sh 2>&1 | tee shadowsocks-all.log ``` -卸载方法 +**How to uninstall server** ``` bash ./shadowsocks-all.sh uninstall ``` +**How to upgrade server (only support libev version now)** +```bash +./shadowsocks-all.sh upgrade +``` +**** -各版本启动|停止|重启|状态命令 +**How to start | stop | restart your server** -Shadowsocks-Python 版: +Shadowsocks-Python: /etc/init.d/shadowsocks-python start | stop | restart | status -ShadowsocksR 版: +ShadowsocksR: /etc/init.d/shadowsocks-r start | stop | restart | status -Shadowsocks-Go 版: +Shadowsocks-Go: /etc/init.d/shadowsocks-go start | stop | restart | status -Shadowsocks-libev 版: +Shadowsocks-libev: /etc/init.d/shadowsocks-libev start | stop | restart | status -各版本默认配置文件 +**** +**Configuration Files** -Shadowsocks-Python 版: +Shadowsocks-Python : /etc/shadowsocks-python/config.json -ShadowsocksR 版: +ShadowsocksR : /etc/shadowsocks-r/config.json -Shadowsocks-Go 版: +Shadowsocks-Go : /etc/shadowsocks-go/config.json -Shadowsocks-libev 版: +Shadowsocks-libev : /etc/shadowsocks-libev/config.json -可选 14 种加密方式的其中之一(Python 和 libev 版) +**** + +**Ciphers(Python and libev):** aes-256-gcm aes-192-gcm aes-128-gcm @@ -58,7 +66,7 @@ camellia-256-cfb chacha20-ietf-poly1305 chacha20-ietf -可选 7 种加密方式的其中之一(Go 版) +**Ciphers(Go):** aes-256-cfb aes-192-cfb aes-128-cfb @@ -67,7 +75,7 @@ aes-192-ctr aes-128-ctr chacha20-ietf -可选 10 种加密方式的其中之一(none 是不加密,ShadowsocksR 版) +**ciphers(none means unencrypted,ShadowsocksR):** none aes-256-cfb aes-192-cfb @@ -80,7 +88,7 @@ aes-192-ctr aes-128-ctr chacha20-ietf -可选 7 种协议(protocol)的其中之一(仅限 ShadowsocksR 版) +**Protocols(Only ShadowsocksR):** origin verify_deflate auth_sha1_v4 @@ -90,7 +98,7 @@ auth_aes128_sha1 auth_chain_a auth_chain_b -可选 9 种混淆(obfs)的其中之一(仅限 ShadowsocksR 版) +**Obfs(Only ShadowsocksR ):** plain http_simple http_simple_compatible @@ -100,97 +108,3 @@ tls1.2_ticket_auth tls1.2_ticket_auth_compatible tls1.2_ticket_fastauth tls1.2_ticket_fastauth_compatible - -# BBRplus - -## 脚本安装方法: - -一键脚本(全系统): -参见https://github.com/chiakge/Linux-NetSpeed - -一键脚本(仅CentOS): -```bash -wget --no-check-certificate https://raw.githubusercontent.com/Yuk1n0/Shadowsocks-Install/master/bbrplus_centos.sh && chmod +x bbrplus_centos.sh && ./bbrplus_centos.sh -``` -安装后,执行uname -r,显示4.14.129-bbrplus则切换内核成功 -执行lsmod | grep bbr,显示有bbrplus则开启成功 - -## 手动安装方法: -1. 卸载本机的锐速(如果有) - -2. 下载内核 -wget --no-check-certificate https://github.com/Yuk1n0/Shadowsocks-Install/raw/master/Centos7/x86_64/kernel-4.14.129-bbrplus.rpm - -3. 安装内核 -yum install -y kernel-4.14.129-bbrplus.rpm - -4. 切换启动内核 -grub2-set-default 'CentOS Linux (4.14.129-bbrplus) 7 (Core)' - -5. 设置fq -echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf -设置bbrplus -echo "net.ipv4.tcp_congestion_control=bbrplus" >> /etc/sysctl.conf - -6. 重启 -reboot - -7. 检查内核版本 uname -r -显示4.14.129-bbrplus则成功 - -8. 检查bbrplus是否已经启动 -lsmod | grep bbrplus 显示有tcp_bbrplus则成功 - -## 卸载方法: -安装别的内核bbrplus自动失效,卸载内核自行谷歌即可 - -## 内核编译: - -只能用于4.14.x内核,更高版本的tcp部分源码有改动,要移植到高版本内核得自己研究 - -下载4.14内核源码 -wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.91.tar.xz - -解压 -tar -Jxvf linux-4.14.91.tar.xz -C /root/ - -修改linux-4.14.91/include/net/inet_connection_sock.h,139行 -u64 icsk_ca_priv[112 / sizeof(u64)]; -#define ICSK_CA_PRIV_SIZE (14 * sizeof(u64)) -这两段数值改为112和14,如上 - -修改/net/ipv4/tcp_output.c#L,1823行 -tcp_snd_wnd_test函数大括号后} -换行添加EXPORT_SYMBOL(tcp_snd_wnd_test); - -添加tcp_bbrplus.c,删除/net/ipv4/tcp_bbr.c -修改linux-4.14.91/net/ipv4/Makefile, -obj-$(CONFIG_TCP_CONG_BBR) += tcp_bbrplus.o,bbr改为bbrplus - -安装依赖 -**Centos** -yum -y groupinstall Development tools -yum -y install ncurses-devel bc gcc gcc-c++ ncurses ncurses-devel cmake elfutils-libelf-devel openssl-devel rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed xmlto audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel newt-devel python-devel zlib-devel - -**Debian** -wget -qO- git.io/superupdate.sh | bash -apt-get install build-essential libncurses5-dev -apt-get build-dep linux - -切换到目录 -cd /root/linux-4.14.91 - -配置 -make oldconfig -或者 -make menuconfig - -确保CONFIG_TCP_CONG_BBR=m - -禁用签名调试 -scripts/config --disable MODULE_SIG -scripts/config --disable DEBUG_INFO - -开始编译 -centos:make rpm-pkg -debian:make deb-pkg diff --git a/tcp_bbrplus.c b/tcp_bbrplus.c index f772a4d..2495a33 100644 --- a/tcp_bbrplus.c +++ b/tcp_bbrplus.c @@ -158,7 +158,6 @@ enum bbr_pacing_gain_phase { BBR_BW_PROBE_CRUISE = 2, }; - /* The pacing_gain values for the PROBE_BW gain cycle, to discover/share bw: */ static const int bbr_pacing_gain[] = { BBR_UNIT * 5 / 4, /* probe for more available bw */ @@ -281,7 +280,6 @@ static void bbr_drain_to_target_cycling(struct sock *sk, } } - /* Return maximum extra acked in past k-2k round trips, * where k = bbr_extra_acked_win_rtts. */ @@ -291,7 +289,6 @@ static u16 bbr_extra_acked(const struct sock *sk) return max(bbr->extra_acked[0], bbr->extra_acked[1]); } - /* Return the windowed max recent bandwidth sample, in pkts/uS << BW_SCALE. */ u32 bbr_max_bw(const struct sock *sk) { @@ -494,7 +491,6 @@ static u32 bbr_ack_aggregation_cwnd(struct sock *sk) return aggr_cwnd; } - /* An optimization in BBR to reduce losses: On the first round of recovery, we * follow the packet conservation principle: send P packets per P packets acked. * After that, we slow-start and send at most 2*P packets per P packets acked. @@ -503,6 +499,7 @@ static u32 bbr_ack_aggregation_cwnd(struct sock *sk) * * TODO(ycheng/ncardwell): implement a rate-based approach. */ + static bool bbr_set_cwnd_to_recover_or_restore( struct sock *sk, const struct rate_sample *rs, u32 acked, u32 *new_cwnd) { @@ -729,6 +726,7 @@ static void bbr_lt_bw_interval_done(struct sock *sk, u32 bw) * consistent throughput and high packet loss. If we think we're being policed, * set lt_bw to the "long-term" average delivery rate from those 2 intervals. */ + static void bbr_lt_bw_sampling(struct sock *sk, const struct rate_sample *rs) { struct tcp_sock *tp = tcp_sk(sk); @@ -887,7 +885,6 @@ static void bbr_check_drain(struct sock *sk, const struct rate_sample *rs) bbr_reset_probe_bw_mode(sk); /* we estimate queue is drained */ } - /* Estimates the windowed max degree of ack aggregation. * This is used to provision extra in-flight data to keep sending during * inter-ACK silences. @@ -1168,4 +1165,4 @@ MODULE_AUTHOR("Neal Cardwell "); MODULE_AUTHOR("Yuchung Cheng "); MODULE_AUTHOR("Soheil Hassas Yeganeh "); MODULE_LICENSE("Dual BSD/GPL"); -MODULE_DESCRIPTION("TCP BBR (Bottleneck Bandwidth and RTT)"); \ No newline at end of file +MODULE_DESCRIPTION("TCP BBR (Bottleneck Bandwidth and RTT)");