diff --git a/2017/10/07/hello-world/index.html b/2017/10/07/hello-world/index.html index 2a77e79..b236c40 100644 --- a/2017/10/07/hello-world/index.html +++ b/2017/10/07/hello-world/index.html @@ -89,10 +89,10 @@ - + - + @@ -650,7 +650,7 @@ - 5 + 6 日志 @@ -762,7 +762,7 @@ Site words total count: - 3.2k + 5.6k @@ -782,7 +782,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/2017/10/07/my-first-blog/index.html b/2017/10/07/my-first-blog/index.html index 7e02fc0..39f1c4b 100644 --- a/2017/10/07/my-first-blog/index.html +++ b/2017/10/07/my-first-blog/index.html @@ -89,10 +89,10 @@ - + - + @@ -693,7 +693,7 @@ player?type=2&id=28138493&auto=0&height=66"> - 5 + 6 日志 @@ -805,7 +805,7 @@ player?type=2&id=28138493&auto=0&height=66"> Site words total count: - 3.2k + 5.6k @@ -825,7 +825,7 @@ player?type=2&id=28138493&auto=0&height=66">
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/2017/10/15/github-hexo-搭建博客/index.html b/2017/10/15/github-hexo-搭建博客/index.html index e313441..179d214 100644 --- a/2017/10/15/github-hexo-搭建博客/index.html +++ b/2017/10/15/github-hexo-搭建博客/index.html @@ -89,10 +89,10 @@ - + - + @@ -795,7 +795,7 @@ - 5 + 6 日志 @@ -907,7 +907,7 @@ Site words total count: - 3.2k + 5.6k @@ -927,7 +927,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/2017/10/29/ubuntu配置/index.html b/2017/10/29/ubuntu配置/index.html index 6ace2c9..fb0ced2 100644 --- a/2017/10/29/ubuntu配置/index.html +++ b/2017/10/29/ubuntu配置/index.html @@ -89,10 +89,10 @@ - + - + @@ -763,7 +763,7 @@ - 5 + 6 日志 @@ -875,7 +875,7 @@ Site words total count: - 3.2k + 5.6k @@ -895,7 +895,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/2017/11/22/ubuntu强制清除垃圾回收站/index.html b/2017/11/22/ubuntu强制清除垃圾回收站/index.html index 0e81b84..e0b1fa7 100644 --- a/2017/11/22/ubuntu强制清除垃圾回收站/index.html +++ b/2017/11/22/ubuntu强制清除垃圾回收站/index.html @@ -89,10 +89,10 @@ - + - + @@ -619,6 +619,10 @@
+ +
@@ -702,7 +706,7 @@ - 5 + 6 日志 @@ -814,7 +818,7 @@ Site words total count: - 3.2k + 5.6k @@ -834,7 +838,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/2017/12/03/使用DigitalOcean搭建ShadowSocks及其优化/index.html b/2017/12/03/使用DigitalOcean搭建ShadowSocks及其优化/index.html new file mode 100644 index 0000000..6bfd6d4 --- /dev/null +++ b/2017/12/03/使用DigitalOcean搭建ShadowSocks及其优化/index.html @@ -0,0 +1,1590 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 使用DigitalOcean搭建ShadowSocks及其优化 | Warlock Fish + + + + + + + + + + + + + + + + + + +
+
+ + + +
+
+
+
+ + +
+ + + + + + + + +
+ + + +
+ + + + + + + +
+ + + +

使用DigitalOcean搭建ShadowSocks及其优化

+ + + +
+ + + + + +
+ + + + + +

前言

+

在github的教育资助下买了DigitalOcean的服务器,送了50刀,不错啊,其实用别人的邀请码可以再多10刀的。

+

一直看朋友自己塔梯子,挺好用的,刚好买了vps,就琢磨着干脆自己来搭个梯子。

+

本文将包括一下内容:

+
    +
  1. DigitalOcean注册与配置
  2. +
  3. 服务器端ss配置
  4. +
  5. bbr加速
  6. +
+ +

一. 概念介绍

DigitalOcean(以下简称DO)是美国的一家云主机提供商,其目前拥有包括美国(纽约、旧金山)、荷兰阿姆斯特丹、新加坡、英国伦敦、德国法兰克福、加拿大多伦多和印度班加罗尔共8个城市12个可选机房节点。其采用KVM虚拟机,配置高性能的SSD做储存,拥有IPv6可选项,加上服务器配备的是1000M端口,以512M内存为起点,再加上DO较低的价格$5起/月(而且还有其他方式可以获得优惠,下面会讲到),受到很多的追捧。选用这么一个主机不仅可以用来搭建ss,有一定网页制作基础的同学也可以搭建自己的个人网站,甚至可以选择DO提供的高级套餐来进行机器学习等大规模云计算。

+

Shadowsocks 是由大神 clowwindy(传说是妹纸)开发的一款基于SSH的通讯方式,或者理解为SSH的一个变种。简单来说,其原理就是在墙的两边分别建立起ssh-local和ssh-server两个端口,用户PC首先基于Socks5协议与ssh-local进行通讯,其信息由ssh-local进行多种可选方式的加密后通过墙与另一侧的ssh-server通讯,该信息由ssh-server解密后再对真正的目标地址进行请求。因为ssh-local与ssh-server之间的加密理论无法解密且不含特征信息,就是普通的TCP包,因此无法被捕获或拦截。由于该程序实在太过优秀,因此作者本人被请去喝了茶后就把github上的项目删去了,只留下一句:

+
Removed according to regulations.
+

ps:以上是cope的。

+

二. DigitalOcean注册与购买

DigitalOcean的官网目前在中国大陆可以正常访问,欢迎通过我的邀请链接进行注册.即获得10美元的优惠。现在最低价为5美元/月,因此可以说得到了免费两个月的额度。之后如果您付款超过$25美元,我也会得到网站一定的奖励,是个互惠互利的事儿:)

+

1.首先在主页即可注册:DigitalOcean官网 我的邀请链接可以得到10美金

+

注测后添加付款方式:需要绑定“VISA信用卡”或“PayPal账户”用于付款。采用绑定“VISA信用卡”的方式,会先从账户中扣除1刀,10分钟左右返还,确定账户的可以付款,不需要提前付费;采用绑定“PayPal账户”的方式,必须首先至少充值5刀。

+

2.创建“Droplet”虚拟机

    +
  • 推荐的配置如下:
  • +
+

1.镜像和大小的选择

+

注:DigitalOcean是Shadowsocks Wiki上推荐的VPS之一,
同时Ubuntu是推荐的系统,
详情参见 Shadowsocks 使用说明中的“服务器搭建”。

+

2.选择服务器所在地区

服务器地址可从DigitalOcean测速网址进行测速。

+

3.其他

+

+
    +
  • 勾选IPv6。IPv6可用于连接教育网的PT站等。
  • +
  • 添加SSH公钥,用于SSH远程连接主机。生成密钥的命令为ssh-keygen -t rsa -C “yourmail”。
  • +
+

4.最后

可以取个名字

+

二、服务器端ss配置

如果没有配置ssh 你会发现自己的邮箱收到如下的一封邮件告诉了你IP地址(IP Address)、用户名(Username)和初始密码(Password)
如果配置了ssh,就可以直接登陆。

+
ssh root@IP
+

1.服务器端安装SS

1
2
3
4
5
apt-get update // 更新源中包列表
apt-get install python-pip // 安装pip
pip install --upgrade pip // 更新pip
apt-get install git
pip install git+https://github.com/shadowsocks/shadowsocks.git@master // 安装SS
+

2.安装chacha20加密

虽然shadowsocks的作者推荐使用aes-256-cfb的加密算法,但是这个算法对手机或者openwrt路由器的压力还是不小的,于是后来Google推出的chacha20算法因为其安全性和惊人的速度被现在更多人使用。

1
2
3
4
5
6
apt-get install build-essential
wget https://github.com/jedisct1/libsodium/releases/download/1.0.8/libsodium-1.0.8.tar.gz
tar xf libsodium-1.0.8.tar.gz && cd libsodium-1.0.8
./configure && make -j2
make install
ldconfig

+

3.服务器端配置

    +
  • 配置shadowsocks文件
    1
    vim /etc/shadowsocks.json
    +
  • +
+

这是shadowsocks.json的详情:

1
2
3
4
5
6
7
8
9
10
11
{
"server": "服务器的ip",
"server_port": 8388,
"local_address": "127.0.0.1",
"local_port": 1080,
"password": "你的密码",
"timeout": 300,
"method": "chacha20",
"fast_open": false
}

+
    +
  • 服务器端启动与停止(一直启动即可)
    1
    2
    ssserver -c /etc/shadowsocks.json -d start
    ssserver -c /etc/shadowsocks.json -d stop
    +
  • +
+

三、BBR加速

TCP-BBR:Linux的内核必须是4.9.0-rc8 内核及以后的版本 才能开启,而锐速并不支持这个最新的内核版本,所以TCP-BBR和锐速是不能共存的。

+

1.查看系统

uname -m
+

使用这个命令会返回你的系统位数,如果是 x86_64 那就是64位,如果是 i386 或 386 或 i686 或 686 那就是32位。

+

2.下载内核文件

    +
  • 64位系统
  • +
+
1
wget -O linux-image-4.10.1-amd64.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-image-4.10.1-041001-generic_4.10.1-041001.201702260735_amd64.deb
+
    +
  • 32位系统
  • +
+
1
wget -O linux-image-4.10.1-i386.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-image-4.10.1-041001-generic_4.10.1-041001.201702260735_i386.deb
+

下载完是这样的:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# VPS提示(64位)
root@bbr1:~# wget -O linux-image-4.10.1-amd64.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-image-4.10.1-041001-generic_4.10.1-041001.201702260735_amd64.deb
converted 'http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-image-4.10.1-041001-generic_4.10.1-041001.201702260735_amd64.deb' (ANSI_X3.4-1968) -> 'http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9-rc8/linux-image-4.10.1-040900rc8-generic_4.10.1-040900rc8.201612051443_amd64.deb' (UTF-8)
--2016-12-08 15:31:16-- http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-image-4.10.1-040900-generic_4.10.1-040900.201612111631_amd64.deb
Resolving kernel.ubuntu.com (kernel.ubuntu.com)... 91.189.94.216
Connecting to kernel.ubuntu.com (kernel.ubuntu.com)|91.189.94.216|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 60489324 (58M) [application/x-debian-package]
Saving to: 'linux-image-4.10.1-amd64.deb'
linux-image-4.10.1-040900 100%[=====================================>] 57.69M 3.02MB/s in 14s
2016-12-08 15:31:31 (4.05 MB/s) - 'linux-image-4.10.1-amd64.deb' saved [60489324/60489324]

+

3.安装内核

    +
  • 64位系统

    +

    dpkg -i linux-image-4.10.1-amd64.deb

    +
  • +
  • 32位系统

    +

    dpkg -i linux-image-4.10.1-i386.deb

    +
  • +
+

安装成功:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# VPS提示
root@bbr1:~# dpkg -i linux-image-4.10.1-amd64.deb
Selecting previously unselected package linux-image-4.10.1-040900rc8-generic.
(Reading database ... 25141 files and directories currently installed.)
Preparing to unpack linux-image-4.10.1-040900rc8-generic_4.10.1-040900rc8.201612051443_amd64.deb ...
Done.
Unpacking linux-image-4.10.1-040900rc8-generic (4.10.1-040900rc8.201612051443) ...
Setting up linux-image-4.10.1-040900rc8-generic (4.10.1-040900rc8.201612051443) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.1-040900rc8-generic /boot/vmlinuz-4.10.1-040900rc8-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.1-040900rc8-generic /boot/vmlinuz-4.10.1-040900rc8-generic
update-initramfs: Generating /boot/initrd.img-4.10.1-040900rc8-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.10.1-040900rc8-generic /boot/vmlinuz-4.10.1-040900rc8-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.10.1-040900rc8-generic
Found initrd image: /boot/initrd.img-4.10.1-040900rc8-generic
Found linux image: /boot/vmlinuz-3.16.0-4-amd64
Found initrd image: /boot/initrd.img-3.16.0-4-amd64
done

+

4.列出并删除旧内核

列出VPS 除了刚才安装的内核以外的 所有内核名称:
ps:这个代码是排除了刚才安装的内核,所以不会显示刚才安装的那个内核。删除了多余的内核后,就会什么都不显示!

+
dpkg -l|grep linux-image | awk '{print $2}' | grep -v 'linux-image-[4-9].[0-9]*.'
+
1
2
3
root@bbr1:~# dpkg -l|grep linux-image | awk '{print $2}' | grep -v 'linux-image-[4-9].[0-9]*.'
linux-image-3.16.0-4-amd64
linux-image-amd64
+

删除旧内核:

+
apt-get purge 旧内核名称
+
1
2
3
4
5
# !!!!示例!!!!
# 比如我是有这两个内核,所以我把这两个删掉,不要照着我的这个步骤做,自己换成你VPS的内核名称!!!
apt-get purge linux-image-3.16.0-4-amd64
apt-get purge linux-image-amd64
# !!!!示例!!!!
+

5.更新 grub 系统引导文件并重启VPS

1
2
3
4
# 更新系统引导文件
update-grub
# 重启VPS,执行后SSH链接会断开,等十几秒再重新连接继续执行下面的启动命令。
reboot
+
1
2
3
4
5
6
7
# VPS提示
root@bbr1:~# update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.10.1-040900rc8-generic
Found initrd image: /boot/initrd.img-4.10.1-040900rc8-generic
done
+

6.开启bbr

1
2
3
4
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
# 执行这个保存生效更改。
sysctl -p
+
1
2
3
4
5
6
# VPS提示
root@bbr1:~# sysctl -p
net.ipv6.conf.all.accept_ra = 2
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
+

7.关闭bbr

1
2
3
4
5
sed -i '/net\.core\.default_qdisc=fq/d' /etc/sysctl.conf && sed -i '/net\.ipv4\.tcp_congestion_control=bbr/d' /etc/sysctl.conf
sysctl -p
#执行完上面的代码,就使用reboot重启VPS后才能关闭bbr,重启后再用下面的查看bbr状态代码,查看是否关闭了。
reboot
+

8.查看bbr是否开启

    +
  • 执行下面命令,如果结果中有bbr,即证明你的内核已开启bbr。

    +

    sysctl net.ipv4.tcp_available_congestion_control

    +
  • +
  • 执行下面命令,看到有 tcp_bbr 模块,即说明bbr已启动

    +

    lsmod | grep bbr

    +
  • +
+
1
2
3
4
5
6
7
8
# VPS提示
root@bbr1:~# sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = bbr cubic reno
# ================================================
root@bbr1:~# lsmod | grep bbr
tcp_bbr 20480 0
+

这样就可以快乐的翻墙出去观看世界了 ^_^

+ + +
+ + + + + + +
+ + +
+ + + + + + +

本文标题:使用DigitalOcean搭建ShadowSocks及其优化

+

文章作者:Warlock Fish

+

发布时间:2017年12月03日 - 10:12

+

最后更新:2017年12月03日 - 12:12

+

原始链接:http://warlockfish.xyz/2017/12/03/使用DigitalOcean搭建ShadowSocks及其优化/ + +

+

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。

+
+ + + + +
+ + +
+
+
生活如此多娇
+ + +
+ +
+ + + + +
+ +
+ +
-------------本文结束感谢您的阅读-------------
+ +
+ + +
+ + +
+ + + +
+ + + +
+ +
+
+ + +
+ + + + + + +
+
+
+ + + + +
+ + + + + + + + + +
+
+ + + + +
+ + + 0% + +
+ + + +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CNAME b/CNAME deleted file mode 100644 index e820e93..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -warlockfish.xyz diff --git a/about/index.html b/about/index.html index ad07abb..f009b5a 100644 --- a/about/index.html +++ b/about/index.html @@ -89,10 +89,10 @@ - + - + @@ -106,6 +106,8 @@ + + @@ -423,7 +425,7 @@ - 5 + 6 日志 @@ -535,7 +537,7 @@ Site words total count: - 3.2k + 5.6k @@ -555,7 +557,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/archives/2017/10/index.html b/archives/2017/10/index.html index 67fe123..e7e14fe 100644 --- a/archives/2017/10/index.html +++ b/archives/2017/10/index.html @@ -89,10 +89,10 @@ - + - + @@ -339,7 +339,7 @@ - 嗯..! 目前共计 5 篇日志。 继续努力。 + 嗯..! 目前共计 6 篇日志。 继续努力。 @@ -552,7 +552,7 @@ - 5 + 6 日志 @@ -648,7 +648,7 @@ Site words total count: - 3.2k + 5.6k @@ -668,7 +668,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/archives/2017/11/index.html b/archives/2017/11/index.html index 9c35b49..7327435 100644 --- a/archives/2017/11/index.html +++ b/archives/2017/11/index.html @@ -89,10 +89,10 @@ - + - + @@ -339,7 +339,7 @@ - 嗯..! 目前共计 5 篇日志。 继续努力。 + 嗯..! 目前共计 6 篇日志。 继续努力。 @@ -441,7 +441,7 @@ - 5 + 6 日志 @@ -537,7 +537,7 @@ Site words total count: - 3.2k + 5.6k @@ -557,7 +557,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/archives/2017/12/index.html b/archives/2017/12/index.html new file mode 100644 index 0000000..93286fe --- /dev/null +++ b/archives/2017/12/index.html @@ -0,0 +1,1239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 归档 | Warlock Fish + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/archives/2017/index.html b/archives/2017/index.html index abfd7d8..737b184 100644 --- a/archives/2017/index.html +++ b/archives/2017/index.html @@ -89,10 +89,10 @@ - + - + @@ -339,7 +339,7 @@ - 嗯..! 目前共计 5 篇日志。 继续努力。 + 嗯..! 目前共计 6 篇日志。 继续努力。 @@ -358,6 +358,43 @@ +
+
+ +

+ + + +

+ + + +
+
+ + + + + + + + + + + + + +
@@ -589,7 +626,7 @@ - 5 + 6 日志 @@ -685,7 +722,7 @@ - 3.2k + 5.6k @@ -705,7 +742,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/archives/index.html b/archives/index.html index d261482..959e3f9 100644 --- a/archives/index.html +++ b/archives/index.html @@ -89,10 +89,10 @@ - + - + @@ -339,7 +339,7 @@ - 嗯..! 目前共计 5 篇日志。 继续努力。 + 嗯..! 目前共计 6 篇日志。 继续努力。 @@ -358,6 +358,43 @@ + + + + + + + + + + + + + + +
@@ -589,7 +626,7 @@ - 5 + 6 日志 @@ -685,7 +722,7 @@ - 3.2k + 5.6k @@ -705,7 +742,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/atom.xml b/atom.xml index 3d894ab..87bc32d 100644 --- a/atom.xml +++ b/atom.xml @@ -6,7 +6,7 @@ - 2017-11-22T12:52:47.812Z + 2017-12-03T04:00:29.350Z http://warlockfish.xyz/ @@ -16,6 +16,29 @@ Hexo + + 使用DigitalOcean搭建ShadowSocks及其优化 + + http://warlockfish.xyz/2017/12/03/使用DigitalOcean搭建ShadowSocks及其优化/ + 2017-12-03T02:47:13.000Z + 2017-12-03T04:00:29.350Z + + 前言

在github的教育资助下买了DigitalOcean的服务器,送了50刀,不错啊,其实用别人的邀请码可以再多10刀的。

一直看朋友自己塔梯子,挺好用的,刚好买了vps,就琢磨着干脆自己来搭个梯子。

本文将包括一下内容:

  1. DigitalOcean注册与配置
  2. 服务器端ss配置
  3. bbr加速

一. 概念介绍

DigitalOcean(以下简称DO)是美国的一家云主机提供商,其目前拥有包括美国(纽约、旧金山)、荷兰阿姆斯特丹、新加坡、英国伦敦、德国法兰克福、加拿大多伦多和印度班加罗尔共8个城市12个可选机房节点。其采用KVM虚拟机,配置高性能的SSD做储存,拥有IPv6可选项,加上服务器配备的是1000M端口,以512M内存为起点,再加上DO较低的价格$5起/月(而且还有其他方式可以获得优惠,下面会讲到),受到很多的追捧。选用这么一个主机不仅可以用来搭建ss,有一定网页制作基础的同学也可以搭建自己的个人网站,甚至可以选择DO提供的高级套餐来进行机器学习等大规模云计算。

Shadowsocks 是由大神 clowwindy(传说是妹纸)开发的一款基于SSH的通讯方式,或者理解为SSH的一个变种。简单来说,其原理就是在墙的两边分别建立起ssh-local和ssh-server两个端口,用户PC首先基于Socks5协议与ssh-local进行通讯,其信息由ssh-local进行多种可选方式的加密后通过墙与另一侧的ssh-server通讯,该信息由ssh-server解密后再对真正的目标地址进行请求。因为ssh-local与ssh-server之间的加密理论无法解密且不含特征信息,就是普通的TCP包,因此无法被捕获或拦截。由于该程序实在太过优秀,因此作者本人被请去喝了茶后就把github上的项目删去了,只留下一句:

Removed according to regulations.

ps:以上是cope的。

二. DigitalOcean注册与购买

DigitalOcean的官网目前在中国大陆可以正常访问,欢迎通过我的邀请链接进行注册.即获得10美元的优惠。现在最低价为5美元/月,因此可以说得到了免费两个月的额度。之后如果您付款超过$25美元,我也会得到网站一定的奖励,是个互惠互利的事儿:)

1.首先在主页即可注册:DigitalOcean官网 我的邀请链接可以得到10美金

注测后添加付款方式:需要绑定“VISA信用卡”或“PayPal账户”用于付款。采用绑定“VISA信用卡”的方式,会先从账户中扣除1刀,10分钟左右返还,确定账户的可以付款,不需要提前付费;采用绑定“PayPal账户”的方式,必须首先至少充值5刀。

2.创建“Droplet”虚拟机

  • 推荐的配置如下:

1.镜像和大小的选择

注:DigitalOcean是Shadowsocks Wiki上推荐的VPS之一,
同时Ubuntu是推荐的系统,
详情参见 Shadowsocks 使用说明中的“服务器搭建”。

2.选择服务器所在地区

服务器地址可从DigitalOcean测速网址进行测速。

3.其他

  • 勾选IPv6。IPv6可用于连接教育网的PT站等。
  • 添加SSH公钥,用于SSH远程连接主机。生成密钥的命令为ssh-keygen -t rsa -C “yourmail”。

4.最后

可以取个名字

二、服务器端ss配置

如果没有配置ssh 你会发现自己的邮箱收到如下的一封邮件告诉了你IP地址(IP Address)、用户名(Username)和初始密码(Password)
如果配置了ssh,就可以直接登陆。

ssh root@IP

1.服务器端安装SS

1
2
3
4
5
apt-get update // 更新源中包列表
apt-get install python-pip // 安装pip
pip install --upgrade pip // 更新pip
apt-get install git
pip install git+https://github.com/shadowsocks/shadowsocks.git@master // 安装SS

2.安装chacha20加密

虽然shadowsocks的作者推荐使用aes-256-cfb的加密算法,但是这个算法对手机或者openwrt路由器的压力还是不小的,于是后来Google推出的chacha20算法因为其安全性和惊人的速度被现在更多人使用。

1
2
3
4
5
6
apt-get install build-essential
wget https://github.com/jedisct1/libsodium/releases/download/1.0.8/libsodium-1.0.8.tar.gz
tar xf libsodium-1.0.8.tar.gz && cd libsodium-1.0.8
./configure && make -j2
make install
ldconfig

3.服务器端配置

  • 配置shadowsocks文件
    1
    vim /etc/shadowsocks.json

这是shadowsocks.json的详情:

1
2
3
4
5
6
7
8
9
10
11
{
"server": "服务器的ip",
"server_port": 8388,
"local_address": "127.0.0.1",
"local_port": 1080,
"password": "你的密码",
"timeout": 300,
"method": "chacha20",
"fast_open": false
}

  • 服务器端启动与停止(一直启动即可)
    1
    2
    ssserver -c /etc/shadowsocks.json -d start
    ssserver -c /etc/shadowsocks.json -d stop

三、BBR加速

TCP-BBR:Linux的内核必须是4.9.0-rc8 内核及以后的版本 才能开启,而锐速并不支持这个最新的内核版本,所以TCP-BBR和锐速是不能共存的。

1.查看系统

uname -m

使用这个命令会返回你的系统位数,如果是 x86_64 那就是64位,如果是 i386 或 386 或 i686 或 686 那就是32位。

2.下载内核文件

  • 64位系统
1
wget -O linux-image-4.10.1-amd64.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-image-4.10.1-041001-generic_4.10.1-041001.201702260735_amd64.deb
  • 32位系统
1
wget -O linux-image-4.10.1-i386.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-image-4.10.1-041001-generic_4.10.1-041001.201702260735_i386.deb

下载完是这样的:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# VPS提示(64位)
root@bbr1:~# wget -O linux-image-4.10.1-amd64.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-image-4.10.1-041001-generic_4.10.1-041001.201702260735_amd64.deb
converted 'http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-image-4.10.1-041001-generic_4.10.1-041001.201702260735_amd64.deb' (ANSI_X3.4-1968) -> 'http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9-rc8/linux-image-4.10.1-040900rc8-generic_4.10.1-040900rc8.201612051443_amd64.deb' (UTF-8)
--2016-12-08 15:31:16-- http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-image-4.10.1-040900-generic_4.10.1-040900.201612111631_amd64.deb
Resolving kernel.ubuntu.com (kernel.ubuntu.com)... 91.189.94.216
Connecting to kernel.ubuntu.com (kernel.ubuntu.com)|91.189.94.216|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 60489324 (58M) [application/x-debian-package]
Saving to: 'linux-image-4.10.1-amd64.deb'
linux-image-4.10.1-040900 100%[=====================================>] 57.69M 3.02MB/s in 14s
2016-12-08 15:31:31 (4.05 MB/s) - 'linux-image-4.10.1-amd64.deb' saved [60489324/60489324]

3.安装内核

  • 64位系统

    dpkg -i linux-image-4.10.1-amd64.deb

  • 32位系统

    dpkg -i linux-image-4.10.1-i386.deb

安装成功:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# VPS提示
root@bbr1:~# dpkg -i linux-image-4.10.1-amd64.deb
Selecting previously unselected package linux-image-4.10.1-040900rc8-generic.
(Reading database ... 25141 files and directories currently installed.)
Preparing to unpack linux-image-4.10.1-040900rc8-generic_4.10.1-040900rc8.201612051443_amd64.deb ...
Done.
Unpacking linux-image-4.10.1-040900rc8-generic (4.10.1-040900rc8.201612051443) ...
Setting up linux-image-4.10.1-040900rc8-generic (4.10.1-040900rc8.201612051443) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.1-040900rc8-generic /boot/vmlinuz-4.10.1-040900rc8-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.1-040900rc8-generic /boot/vmlinuz-4.10.1-040900rc8-generic
update-initramfs: Generating /boot/initrd.img-4.10.1-040900rc8-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.10.1-040900rc8-generic /boot/vmlinuz-4.10.1-040900rc8-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.10.1-040900rc8-generic
Found initrd image: /boot/initrd.img-4.10.1-040900rc8-generic
Found linux image: /boot/vmlinuz-3.16.0-4-amd64
Found initrd image: /boot/initrd.img-3.16.0-4-amd64
done

4.列出并删除旧内核

列出VPS 除了刚才安装的内核以外的 所有内核名称:
ps:这个代码是排除了刚才安装的内核,所以不会显示刚才安装的那个内核。删除了多余的内核后,就会什么都不显示!

dpkg -l|grep linux-image | awk '{print $2}' | grep -v 'linux-image-[4-9].[0-9]*.'
1
2
3
root@bbr1:~# dpkg -l|grep linux-image | awk '{print $2}' | grep -v 'linux-image-[4-9].[0-9]*.'
linux-image-3.16.0-4-amd64
linux-image-amd64

删除旧内核:

apt-get purge 旧内核名称
1
2
3
4
5
# !!!!示例!!!!
# 比如我是有这两个内核,所以我把这两个删掉,不要照着我的这个步骤做,自己换成你VPS的内核名称!!!
apt-get purge linux-image-3.16.0-4-amd64
apt-get purge linux-image-amd64
# !!!!示例!!!!

5.更新 grub 系统引导文件并重启VPS

1
2
3
4
# 更新系统引导文件
update-grub
# 重启VPS,执行后SSH链接会断开,等十几秒再重新连接继续执行下面的启动命令。
reboot
1
2
3
4
5
6
7
# VPS提示
root@bbr1:~# update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.10.1-040900rc8-generic
Found initrd image: /boot/initrd.img-4.10.1-040900rc8-generic
done

6.开启bbr

1
2
3
4
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
# 执行这个保存生效更改。
sysctl -p
1
2
3
4
5
6
# VPS提示
root@bbr1:~# sysctl -p
net.ipv6.conf.all.accept_ra = 2
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr

7.关闭bbr

1
2
3
4
5
sed -i '/net\.core\.default_qdisc=fq/d' /etc/sysctl.conf && sed -i '/net\.ipv4\.tcp_congestion_control=bbr/d' /etc/sysctl.conf
sysctl -p
#执行完上面的代码,就使用reboot重启VPS后才能关闭bbr,重启后再用下面的查看bbr状态代码,查看是否关闭了。
reboot

8.查看bbr是否开启

  • 执行下面命令,如果结果中有bbr,即证明你的内核已开启bbr。

    sysctl net.ipv4.tcp_available_congestion_control

  • 执行下面命令,看到有 tcp_bbr 模块,即说明bbr已启动

    lsmod | grep bbr

1
2
3
4
5
6
7
8
# VPS提示
root@bbr1:~# sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = bbr cubic reno
# ================================================
root@bbr1:~# lsmod | grep bbr
tcp_bbr 20480 0

这样就可以快乐的翻墙出去观看世界了 ^_^

]]>
+ + + + + + <p><strong><em>前言</em></strong></p> +<p>在github的教育资助下买了DigitalOcean的服务器,送了50刀,不错啊,其实用别人的邀请码可以再多10刀的。</p> +<p>一直看朋友自己塔梯子,挺好用的,刚好买了vps,就琢磨着干脆自己来 + + + + + +
+ ubuntu强制清除垃圾回收站 diff --git a/baidu_urls.txt b/baidu_urls.txt index 9abd748..30d8a4b 100644 --- a/baidu_urls.txt +++ b/baidu_urls.txt @@ -1,3 +1,4 @@ +http://warlockfish.xyz/2017/12/03/使用DigitalOcean搭建ShadowSocks及其优化/ http://warlockfish.xyz/2017/11/22/ubuntu强制清除垃圾回收站/ http://warlockfish.xyz/2017/10/29/ubuntu配置/ http://warlockfish.xyz/2017/10/15/github-hexo-搭建博客/ diff --git a/baidusitemap.xml b/baidusitemap.xml index 4a3a9e8..27983ee 100644 --- a/baidusitemap.xml +++ b/baidusitemap.xml @@ -3,6 +3,21 @@ + + http://warlockfish.xyz/2017/12/03/%E4%BD%BF%E7%94%A8DigitalOcean%E6%90%AD%E5%BB%BAShadowSocks%E5%8F%8A%E5%85%B6%E4%BC%98%E5%8C%96/ + 2017-12-03T04:00:29.350Z + + + 使用DigitalOcean搭建ShadowSocks及其优化 + 2017-12-03T02:47:13.000Z + + + + + + + + diff --git a/categories/github-hexo/index.html b/categories/github-hexo/index.html index c9702dd..a0a5b48 100644 --- a/categories/github-hexo/index.html +++ b/categories/github-hexo/index.html @@ -89,10 +89,10 @@ - + - + @@ -422,7 +422,7 @@ - 5 + 6 日志 @@ -518,7 +518,7 @@ - 3.2k + 5.6k @@ -538,7 +538,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/categories/github-pages/index.html b/categories/github-pages/index.html index a2a50c3..5a0e7cb 100644 --- a/categories/github-pages/index.html +++ b/categories/github-pages/index.html @@ -89,10 +89,10 @@ - + - + @@ -422,7 +422,7 @@ - 5 + 6 日志 @@ -518,7 +518,7 @@ - 3.2k + 5.6k @@ -538,7 +538,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/categories/index.html b/categories/index.html index 7521f81..baff604 100644 --- a/categories/index.html +++ b/categories/index.html @@ -89,10 +89,10 @@ - + - + @@ -106,8 +106,6 @@ - - @@ -413,7 +411,7 @@ - 5 + 6 日志 @@ -509,7 +507,7 @@ - 3.2k + 5.6k @@ -529,7 +527,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/categories/linux/index.html b/categories/linux/index.html index da14d59..1c485ad 100644 --- a/categories/linux/index.html +++ b/categories/linux/index.html @@ -89,10 +89,10 @@ - + - + @@ -422,7 +422,7 @@ - 5 + 6 日志 @@ -518,7 +518,7 @@ - 3.2k + 5.6k @@ -538,7 +538,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/categories/ubuntu-安装/index.html b/categories/ubuntu-安装/index.html index fbabbab..280ca9e 100644 --- a/categories/ubuntu-安装/index.html +++ b/categories/ubuntu-安装/index.html @@ -89,10 +89,10 @@ - + - + @@ -422,7 +422,7 @@ - 5 + 6 日志 @@ -518,7 +518,7 @@ - 3.2k + 5.6k @@ -538,7 +538,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/css/main.css b/css/main.css index 6404c83..125791e 100644 --- a/css/main.css +++ b/css/main.css @@ -1821,9 +1821,9 @@ pre .javascript .function { border-bottom: 1px solid #0593d3; } .post-body p a:hover { - color: #fc6423; + color: #f41111; border-bottom: none; - border-bottom: 1px solid #fc6423; + border-bottom: 1px solid #f41111; } .my_post_copyright { width: 85%; @@ -2040,7 +2040,7 @@ pre .javascript .function { width: 4px; height: 4px; border-radius: 50%; - background: #d1b94f; + background: #0f5dd9; } .links-of-blogroll { font-size: 13px; @@ -3245,7 +3245,7 @@ pre .javascript .function { -moz-box-shadow: 0 0 5px rgba(202,203,204,0.5); } code { - color: #ff7600; + color: #ef2929; background: #fbf7f8; margin: 2px; } diff --git a/guestbook/index.html b/guestbook/index.html index 94a7d80..dd0ca09 100644 --- a/guestbook/index.html +++ b/guestbook/index.html @@ -89,10 +89,10 @@ - + - + @@ -412,7 +412,7 @@ - 5 + 6 日志 @@ -508,7 +508,7 @@ - 3.2k + 5.6k @@ -528,7 +528,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/images/favicon.ico b/images/favicon.ico new file mode 100644 index 0000000..4562343 Binary files /dev/null and b/images/favicon.ico differ diff --git a/index.html b/index.html index 1049193..f911ff9 100644 --- a/index.html +++ b/index.html @@ -89,10 +89,10 @@ - + - + @@ -336,6 +336,192 @@ +
+ + + +
+ + + + + + + +
+ + + +

+ +

+ + + +
+ + + + + +
+ + + + + + + + 前言 +在github的教育资助下买了DigitalOcean的服务器,送了50刀,不错啊,其实用别人的邀请码可以再多10刀的。 +一直看朋友自己塔梯子,挺好用的,刚好买了vps,就琢磨着干脆自己来搭个梯子。 +本文将包括一下内容: + +DigitalOcean注册与配置 +服务器端ss配置 +bbr加速 + + + + ... + +
+ + 阅读全文 » + +
+ + + +
+ + + + + + +
+ +
+ + + + + +
+ +
+ +
+ + + + + + + + +
+ +
+
+ + + +
+ + + + + + + + + + +
@@ -1347,7 +1533,7 @@ player?type=2&id=28138493&auto=0&height=66"> - 5 + 6 日志 @@ -1443,7 +1629,7 @@ player?type=2&id=28138493&auto=0&height=66"> - 3.2k + 5.6k @@ -1463,7 +1649,7 @@ player?type=2&id=28138493&auto=0&height=66">
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/message/index.html b/message/index.html index 7d4b431..ade7d1d 100644 --- a/message/index.html +++ b/message/index.html @@ -89,10 +89,10 @@ - + - + @@ -412,7 +412,7 @@ - 5 + 6 日志 @@ -508,7 +508,7 @@ - 3.2k + 5.6k @@ -528,7 +528,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/photo/bVWGw1.jpeg b/photo/bVWGw1.jpeg new file mode 100644 index 0000000..96b8223 Binary files /dev/null and b/photo/bVWGw1.jpeg differ diff --git a/photo/bVWGw8.jpeg b/photo/bVWGw8.jpeg new file mode 100644 index 0000000..9b89f84 Binary files /dev/null and b/photo/bVWGw8.jpeg differ diff --git a/photo/bVWGx2.jpeg b/photo/bVWGx2.jpeg new file mode 100644 index 0000000..be5b911 Binary files /dev/null and b/photo/bVWGx2.jpeg differ diff --git a/photo/bVWGxG.jpeg b/photo/bVWGxG.jpeg new file mode 100644 index 0000000..26f0f69 Binary files /dev/null and b/photo/bVWGxG.jpeg differ diff --git a/photo/bVWGxK.jpeg b/photo/bVWGxK.jpeg new file mode 100644 index 0000000..e7ff10f Binary files /dev/null and b/photo/bVWGxK.jpeg differ diff --git a/photo/bVWGyH.jpeg b/photo/bVWGyH.jpeg new file mode 100644 index 0000000..4082022 Binary files /dev/null and b/photo/bVWGyH.jpeg differ diff --git a/photo/bVWGyO.jpeg b/photo/bVWGyO.jpeg new file mode 100644 index 0000000..868f49a Binary files /dev/null and b/photo/bVWGyO.jpeg differ diff --git a/photo/bVWGyg.jpeg b/photo/bVWGyg.jpeg new file mode 100644 index 0000000..dc52531 Binary files /dev/null and b/photo/bVWGyg.jpeg differ diff --git a/photo/镜像.png b/photo/镜像.png new file mode 100644 index 0000000..4a72f43 Binary files /dev/null and b/photo/镜像.png differ diff --git a/search.xml b/search.xml index 594e26c..a906edc 100644 --- a/search.xml +++ b/search.xml @@ -2,6 +2,99 @@ + + <![CDATA[使用DigitalOcean搭建ShadowSocks及其优化]]> + /2017/12/03/%E4%BD%BF%E7%94%A8DigitalOcean%E6%90%AD%E5%BB%BAShadowSocks%E5%8F%8A%E5%85%B6%E4%BC%98%E5%8C%96/ + 前言

+

在github的教育资助下买了DigitalOcean的服务器,送了50刀,不错啊,其实用别人的邀请码可以再多10刀的。

+

一直看朋友自己塔梯子,挺好用的,刚好买了vps,就琢磨着干脆自己来搭个梯子。

+

本文将包括一下内容:

+
    +
  1. DigitalOcean注册与配置
  2. +
  3. 服务器端ss配置
  4. +
  5. bbr加速
  6. +
+ +

一. 概念介绍

DigitalOcean(以下简称DO)是美国的一家云主机提供商,其目前拥有包括美国(纽约、旧金山)、荷兰阿姆斯特丹、新加坡、英国伦敦、德国法兰克福、加拿大多伦多和印度班加罗尔共8个城市12个可选机房节点。其采用KVM虚拟机,配置高性能的SSD做储存,拥有IPv6可选项,加上服务器配备的是1000M端口,以512M内存为起点,再加上DO较低的价格$5起/月(而且还有其他方式可以获得优惠,下面会讲到),受到很多的追捧。选用这么一个主机不仅可以用来搭建ss,有一定网页制作基础的同学也可以搭建自己的个人网站,甚至可以选择DO提供的高级套餐来进行机器学习等大规模云计算。

+

Shadowsocks 是由大神 clowwindy(传说是妹纸)开发的一款基于SSH的通讯方式,或者理解为SSH的一个变种。简单来说,其原理就是在墙的两边分别建立起ssh-local和ssh-server两个端口,用户PC首先基于Socks5协议与ssh-local进行通讯,其信息由ssh-local进行多种可选方式的加密后通过墙与另一侧的ssh-server通讯,该信息由ssh-server解密后再对真正的目标地址进行请求。因为ssh-local与ssh-server之间的加密理论无法解密且不含特征信息,就是普通的TCP包,因此无法被捕获或拦截。由于该程序实在太过优秀,因此作者本人被请去喝了茶后就把github上的项目删去了,只留下一句:

+
Removed according to regulations.
+

ps:以上是cope的。

+

二. DigitalOcean注册与购买

DigitalOcean的官网目前在中国大陆可以正常访问,欢迎通过我的邀请链接进行注册.即获得10美元的优惠。现在最低价为5美元/月,因此可以说得到了免费两个月的额度。之后如果您付款超过$25美元,我也会得到网站一定的奖励,是个互惠互利的事儿:)

+

1.首先在主页即可注册:DigitalOcean官网 我的邀请链接可以得到10美金

+

注测后添加付款方式:需要绑定“VISA信用卡”或“PayPal账户”用于付款。采用绑定“VISA信用卡”的方式,会先从账户中扣除1刀,10分钟左右返还,确定账户的可以付款,不需要提前付费;采用绑定“PayPal账户”的方式,必须首先至少充值5刀。

+

2.创建“Droplet”虚拟机

    +
  • 推荐的配置如下:
  • +
+

1.镜像和大小的选择

+

注:DigitalOcean是Shadowsocks Wiki上推荐的VPS之一,
同时Ubuntu是推荐的系统,
详情参见 Shadowsocks 使用说明中的“服务器搭建”。

+

2.选择服务器所在地区

服务器地址可从DigitalOcean测速网址进行测速。

+

3.其他

+

+
    +
  • 勾选IPv6。IPv6可用于连接教育网的PT站等。
  • +
  • 添加SSH公钥,用于SSH远程连接主机。生成密钥的命令为ssh-keygen -t rsa -C “yourmail”。
  • +
+

4.最后

可以取个名字

+

二、服务器端ss配置

如果没有配置ssh 你会发现自己的邮箱收到如下的一封邮件告诉了你IP地址(IP Address)、用户名(Username)和初始密码(Password)
如果配置了ssh,就可以直接登陆。

+
ssh root@IP
+

1.服务器端安装SS

1
2
3
4
5
apt-get update // 更新源中包列表
apt-get install python-pip // 安装pip
pip install --upgrade pip // 更新pip
apt-get install git
pip install git+https://github.com/shadowsocks/shadowsocks.git@master // 安装SS
+

2.安装chacha20加密

虽然shadowsocks的作者推荐使用aes-256-cfb的加密算法,但是这个算法对手机或者openwrt路由器的压力还是不小的,于是后来Google推出的chacha20算法因为其安全性和惊人的速度被现在更多人使用。

1
2
3
4
5
6
apt-get install build-essential
wget https://github.com/jedisct1/libsodium/releases/download/1.0.8/libsodium-1.0.8.tar.gz
tar xf libsodium-1.0.8.tar.gz && cd libsodium-1.0.8
./configure && make -j2
make install
ldconfig

+

3.服务器端配置

    +
  • 配置shadowsocks文件
    1
    vim /etc/shadowsocks.json
    +
  • +
+

这是shadowsocks.json的详情:

1
2
3
4
5
6
7
8
9
10
11
{
"server": "服务器的ip",
"server_port": 8388,
"local_address": "127.0.0.1",
"local_port": 1080,
"password": "你的密码",
"timeout": 300,
"method": "chacha20",
"fast_open": false
}

+
    +
  • 服务器端启动与停止(一直启动即可)
    1
    2
    ssserver -c /etc/shadowsocks.json -d start
    ssserver -c /etc/shadowsocks.json -d stop
    +
  • +
+

三、BBR加速

TCP-BBR:Linux的内核必须是4.9.0-rc8 内核及以后的版本 才能开启,而锐速并不支持这个最新的内核版本,所以TCP-BBR和锐速是不能共存的。

+

1.查看系统

uname -m
+

使用这个命令会返回你的系统位数,如果是 x86_64 那就是64位,如果是 i386 或 386 或 i686 或 686 那就是32位。

+

2.下载内核文件

    +
  • 64位系统
  • +
+
1
wget -O linux-image-4.10.1-amd64.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-image-4.10.1-041001-generic_4.10.1-041001.201702260735_amd64.deb
+
    +
  • 32位系统
  • +
+
1
wget -O linux-image-4.10.1-i386.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-image-4.10.1-041001-generic_4.10.1-041001.201702260735_i386.deb
+

下载完是这样的:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# VPS提示(64位)
root@bbr1:~# wget -O linux-image-4.10.1-amd64.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-image-4.10.1-041001-generic_4.10.1-041001.201702260735_amd64.deb
converted 'http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-image-4.10.1-041001-generic_4.10.1-041001.201702260735_amd64.deb' (ANSI_X3.4-1968) -> 'http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9-rc8/linux-image-4.10.1-040900rc8-generic_4.10.1-040900rc8.201612051443_amd64.deb' (UTF-8)
--2016-12-08 15:31:16-- http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9/linux-image-4.10.1-040900-generic_4.10.1-040900.201612111631_amd64.deb
Resolving kernel.ubuntu.com (kernel.ubuntu.com)... 91.189.94.216
Connecting to kernel.ubuntu.com (kernel.ubuntu.com)|91.189.94.216|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 60489324 (58M) [application/x-debian-package]
Saving to: 'linux-image-4.10.1-amd64.deb'
linux-image-4.10.1-040900 100%[=====================================>] 57.69M 3.02MB/s in 14s
2016-12-08 15:31:31 (4.05 MB/s) - 'linux-image-4.10.1-amd64.deb' saved [60489324/60489324]

+

3.安装内核

    +
  • 64位系统

    +

    dpkg -i linux-image-4.10.1-amd64.deb

    +
  • +
  • 32位系统

    +

    dpkg -i linux-image-4.10.1-i386.deb

    +
  • +
+

安装成功:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# VPS提示
root@bbr1:~# dpkg -i linux-image-4.10.1-amd64.deb
Selecting previously unselected package linux-image-4.10.1-040900rc8-generic.
(Reading database ... 25141 files and directories currently installed.)
Preparing to unpack linux-image-4.10.1-040900rc8-generic_4.10.1-040900rc8.201612051443_amd64.deb ...
Done.
Unpacking linux-image-4.10.1-040900rc8-generic (4.10.1-040900rc8.201612051443) ...
Setting up linux-image-4.10.1-040900rc8-generic (4.10.1-040900rc8.201612051443) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.1-040900rc8-generic /boot/vmlinuz-4.10.1-040900rc8-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.1-040900rc8-generic /boot/vmlinuz-4.10.1-040900rc8-generic
update-initramfs: Generating /boot/initrd.img-4.10.1-040900rc8-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.10.1-040900rc8-generic /boot/vmlinuz-4.10.1-040900rc8-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.10.1-040900rc8-generic
Found initrd image: /boot/initrd.img-4.10.1-040900rc8-generic
Found linux image: /boot/vmlinuz-3.16.0-4-amd64
Found initrd image: /boot/initrd.img-3.16.0-4-amd64
done

+

4.列出并删除旧内核

列出VPS 除了刚才安装的内核以外的 所有内核名称:
ps:这个代码是排除了刚才安装的内核,所以不会显示刚才安装的那个内核。删除了多余的内核后,就会什么都不显示!

+
dpkg -l|grep linux-image | awk '{print $2}' | grep -v 'linux-image-[4-9].[0-9]*.'
+
1
2
3
root@bbr1:~# dpkg -l|grep linux-image | awk '{print $2}' | grep -v 'linux-image-[4-9].[0-9]*.'
linux-image-3.16.0-4-amd64
linux-image-amd64
+

删除旧内核:

+
apt-get purge 旧内核名称
+
1
2
3
4
5
# !!!!示例!!!!
# 比如我是有这两个内核,所以我把这两个删掉,不要照着我的这个步骤做,自己换成你VPS的内核名称!!!
apt-get purge linux-image-3.16.0-4-amd64
apt-get purge linux-image-amd64
# !!!!示例!!!!
+

5.更新 grub 系统引导文件并重启VPS

1
2
3
4
# 更新系统引导文件
update-grub
# 重启VPS,执行后SSH链接会断开,等十几秒再重新连接继续执行下面的启动命令。
reboot
+
1
2
3
4
5
6
7
# VPS提示
root@bbr1:~# update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.10.1-040900rc8-generic
Found initrd image: /boot/initrd.img-4.10.1-040900rc8-generic
done
+

6.开启bbr

1
2
3
4
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
# 执行这个保存生效更改。
sysctl -p
+
1
2
3
4
5
6
# VPS提示
root@bbr1:~# sysctl -p
net.ipv6.conf.all.accept_ra = 2
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
+

7.关闭bbr

1
2
3
4
5
sed -i '/net\.core\.default_qdisc=fq/d' /etc/sysctl.conf && sed -i '/net\.ipv4\.tcp_congestion_control=bbr/d' /etc/sysctl.conf
sysctl -p
#执行完上面的代码,就使用reboot重启VPS后才能关闭bbr,重启后再用下面的查看bbr状态代码,查看是否关闭了。
reboot
+

8.查看bbr是否开启

    +
  • 执行下面命令,如果结果中有bbr,即证明你的内核已开启bbr。

    +

    sysctl net.ipv4.tcp_available_congestion_control

    +
  • +
  • 执行下面命令,看到有 tcp_bbr 模块,即说明bbr已启动

    +

    lsmod | grep bbr

    +
  • +
+
1
2
3
4
5
6
7
8
# VPS提示
root@bbr1:~# sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = bbr cubic reno
# ================================================
root@bbr1:~# lsmod | grep bbr
tcp_bbr 20480 0
+

这样就可以快乐的翻墙出去观看世界了 ^_^

+]]>
+ + +
+ <![CDATA[ubuntu强制清除垃圾回收站]]> /2017/11/22/ubuntu%E5%BC%BA%E5%88%B6%E6%B8%85%E9%99%A4%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6%E7%AB%99/ diff --git a/sitemap.xml b/sitemap.xml index a1fcbb6..4c17579 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -1,6 +1,13 @@ + + http://warlockfish.xyz/2017/12/03/%E4%BD%BF%E7%94%A8DigitalOcean%E6%90%AD%E5%BB%BAShadowSocks%E5%8F%8A%E5%85%B6%E4%BC%98%E5%8C%96/ + + 2017-12-03T04:00:29.350Z + + + http://warlockfish.xyz/baidu_verify_96ldzijdm2.html diff --git a/tags/github-pages/index.html b/tags/github-pages/index.html index 6684d30..86c5c33 100644 --- a/tags/github-pages/index.html +++ b/tags/github-pages/index.html @@ -89,10 +89,10 @@ - + - + @@ -449,7 +449,7 @@ - 5 + 6 日志 @@ -545,7 +545,7 @@ - 3.2k + 5.6k @@ -565,7 +565,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/tags/hello-world/index.html b/tags/hello-world/index.html index bc4ded2..10b4b49 100644 --- a/tags/hello-world/index.html +++ b/tags/hello-world/index.html @@ -89,10 +89,10 @@ - + - + @@ -421,7 +421,7 @@ - 5 + 6 日志 @@ -517,7 +517,7 @@ - 3.2k + 5.6k @@ -537,7 +537,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/tags/hexo/index.html b/tags/hexo/index.html index 265da3e..2792f80 100644 --- a/tags/hexo/index.html +++ b/tags/hexo/index.html @@ -89,10 +89,10 @@ - + - + @@ -421,7 +421,7 @@ - 5 + 6 日志 @@ -517,7 +517,7 @@ - 3.2k + 5.6k @@ -537,7 +537,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/tags/index.html b/tags/index.html index c6d5114..8ce90e1 100644 --- a/tags/index.html +++ b/tags/index.html @@ -89,10 +89,10 @@ - + - + @@ -411,7 +411,7 @@ - 5 + 6 日志 @@ -507,7 +507,7 @@ - 3.2k + 5.6k @@ -527,7 +527,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/tags/linux,垃圾站/index.html b/tags/linux,垃圾站/index.html index 3efa525..b8d8397 100644 --- a/tags/linux,垃圾站/index.html +++ b/tags/linux,垃圾站/index.html @@ -89,10 +89,10 @@ - + - + @@ -421,7 +421,7 @@ - 5 + 6 日志 @@ -517,7 +517,7 @@ - 3.2k + 5.6k @@ -537,7 +537,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/tags/new/index.html b/tags/new/index.html index 3d69a00..c2bde92 100644 --- a/tags/new/index.html +++ b/tags/new/index.html @@ -89,10 +89,10 @@ - + - + @@ -449,7 +449,7 @@ - 5 + 6 日志 @@ -545,7 +545,7 @@ - 3.2k + 5.6k @@ -565,7 +565,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/tags/ubuntu/index.html b/tags/ubuntu/index.html index 6ea4669..2bbcc82 100644 --- a/tags/ubuntu/index.html +++ b/tags/ubuntu/index.html @@ -89,10 +89,10 @@ - + - + @@ -421,7 +421,7 @@ - 5 + 6 日志 @@ -517,7 +517,7 @@ - 3.2k + 5.6k @@ -537,7 +537,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/tags/unbuntu/index.html b/tags/unbuntu/index.html index 4b72704..c5a0c8b 100644 --- a/tags/unbuntu/index.html +++ b/tags/unbuntu/index.html @@ -89,10 +89,10 @@ - + - + @@ -421,7 +421,7 @@ - 5 + 6 日志 @@ -517,7 +517,7 @@ - 3.2k + 5.6k @@ -537,7 +537,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/tags/教程/index.html b/tags/教程/index.html index 2478ca6..8ec8c06 100644 --- a/tags/教程/index.html +++ b/tags/教程/index.html @@ -89,10 +89,10 @@ - + - + @@ -449,7 +449,7 @@ - 5 + 6 日志 @@ -545,7 +545,7 @@ - 3.2k + 5.6k @@ -565,7 +565,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/tags/配置/index.html b/tags/配置/index.html index 29e2a4d..6a4110c 100644 --- a/tags/配置/index.html +++ b/tags/配置/index.html @@ -89,10 +89,10 @@ - + - + @@ -421,7 +421,7 @@ - 5 + 6 日志 @@ -517,7 +517,7 @@ - 3.2k + 5.6k @@ -537,7 +537,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字
diff --git a/tags/静态网站/index.html b/tags/静态网站/index.html index 9d817a6..2b0b04c 100644 --- a/tags/静态网站/index.html +++ b/tags/静态网站/index.html @@ -89,10 +89,10 @@ - + - + @@ -421,7 +421,7 @@ - 5 + 6 日志 @@ -517,7 +517,7 @@ - 3.2k + 5.6k @@ -537,7 +537,7 @@
- 博客全站共3.2k字 + 博客全站共5.6k字