Centos 7 下搭建SS

本文在 vutlr 的 centos7 64bit 上完全测试通过,包括后面的开启 bbr tcp算法。1.安装 pip1.1 安装epel扩展源sudo yum install epel-release 1.2 安装 python-pip sudo yum -y...

本文在 vutlr 的 centos7 64bit 上完全测试通过,包括后面的开启 bbr tcp算法。


1.安装 pip

1.1 安装epel扩展源

sudo yum install epel-release 

1.2 安装 python-pip

sudo yum -y install python-pip 

1.3 升级 python-pip

sudo pip install --upgrade pip 

1.4 清理  yum cache

sudo yum clean all 

2 安装 ss

pip install shadowsocks  

2.1 创建 ss 服务端配置文件

sudo vi /etc/shadowsocks.json  

加入下面的配置文件,

{   

   "server":"server_ip",   //这里填写你自己的 vpn 服务外网地址

   "server_port":25,   

   "local_address": "127.0.0.1",   

   "local_port":1080,   

   "password":"password",  //这里一定要更换为自己的密码

    "timeout":300,   

   "method":"aes-256-cfb",   

   "fast_open": false   

}   

2.1 多用户支持

{  

    "server":"server_ip",  //这里的含义同上

    "port_password":{  

        "port_1":"pwd1",  

        "port_2":"pwd2",  

        "port_3":"pwd3"  

    },  

    "local_address":"127.0.0.1",  

    "local_port":1080,  

    "timeout":300,  

    "method":"aes-256-cfb"  

}  

2.2 启动 shadowsocks 服务

sudo vi /etc/systemd/system/shadowsocks.service  

加入下面的内容:

[Unit]  

Description=Shadowsocks  

  [Service]  

TimeoutStartSec=0  

ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json  

 [Install]  

WantedBy=multi-user.target

然后,启用服务:

systemctl enable shadowsocks  

接着,马上启动服务:

systemctl start shadowsocks 

查看服务器启动状态:

systemctl status shadowsocks -l

当然,你也可以停止 ss 服务:

systemctl stop shadowsocks  

2.3 开启防火墙端口

firewall-cmd --zone=public --add-port=25/tcp --permanent #这里的 25 端口一定要跟配置文件的 25 端口保持一致。

2.4 一定要记得重启 firewalld

firewall-cmd --reload

或者

systemctl restart  firewalld

2.5 ss 客户端下载

windows:https://github.com/shadowsocks/shadowsocks-windows/releases

Android:https://github.com/shadowsocks/shadowsocks-android/releases

Mac:https://github.com/shadowsocks/ShadowsocksX-NG/releases

3 加速

开启 google 的 tcp 加速算法:https://teddysun.com/489.html,

内容备份如下:

使用root用户登录,运行以下命令:

wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh

安装完成后,脚本会提示需要重启 VPS,输入 y 并回车后重启。
重启完成后,进入 VPS,验证一下是否成功安装最新内核并开启 TCP BBR,输入以下命令:

uname -r

查看内核版本,显示为最新版就表示 OK 了

sysctl net.ipv4.tcp_available_congestion_control

返回值一般为:
net.ipv4.tcp_available_congestion_control = bbr cubic reno

sysctl net.ipv4.tcp_congestion_control

返回值一般为:
net.ipv4.tcp_congestion_control = bbr

sysctl net.core.default_qdisc

返回值一般为:
net.core.default_qdisc = fq

lsmod | grep bbr

返回值有 tcp_bbr 模块即说明 bbr 已启动。注意:并不是所有的 VPS 都会有此返回值,若没有也属正常。



  • 发表于 2018-03-22 19:38
  • 阅读 ( 1711 )
  • 分类:后端技术

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
不写代码的码农
Kemin

架构工程师

45 篇文章

作家榜 »

  1. Kemin 45 文章
  2. golanglover 5 文章
  3. D.Chen 4 文章
  4. salamander 1 文章
  5. 深圳-伟 1 文章
  6. 广训 1 文章
  7. PHP小菜 1 文章
  8. Undefined 0 文章