锦方的个人网页 · 如果有一天你突然想起了我


在debian8的服务器使用v2ray的TLS

目录

昨天下午我CN2的服务器丢包就很严重就去一家偏僻一点的主机商买了台机子,整理了安装的步骤.

安装要用到的东西

apt-get update
apt-get upgrade
apt-get install vim curl

安装v2ray

wget https://toutyrater.github.io/install-release.sh
bash install-release.sh

安装ssl证书生产脚本

curl  https://get.acme.sh | sh
apt-get -y install netcat
source ~/.bashrc
apt-get install socat

生成证书 生成证书前要先去域名提供商将子域名指向服务器ip地址

~/.acme.sh/acme.sh --issue -d proxy.example.com --standalone -k ec-256
----------------------------------------------------------
~/.acme.sh/acme.sh --installcert -d proxy.example.com --fullchainpath /etc/v2ray/v2ray.crt --keypath /etc/v2ray/v2ray.key --ecc

设置配置文件

vi /etc/v2ray/config.json
{
  "inbound": {
    "port": 443,
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "xxxx-xxxxxxxx",
          "alterId": 64
        }
      ]
    },
    "streamSettings": {
      "network": "tcp",
      "security": "tls",
      "tlsSettings": {
        "certificates": [
          {
            "certificateFile": "/etc/v2ray/v2ray.crt",
            "keyFile": "/etc/v2ray/v2ray.key"
          }
        ]
      }
    }
  },
  "mux": {"enabled": true},
  "outbound": {
    "protocol": "freedom",
    "settings": {}
  }
}

使用说明

//启动V2ray
systemctl start v2ray
//查看V2ray运行状态
systemctl status v2ray
//重启V2ray
systemctl restart v2ray

安装bbr

下载最新内核,内核最新查看这里

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.17/linux-image-4.10.17-041017-generic_4.10.17-041017.201705201051_amd64.deb

安装内核

dpkg -i linux-image-4.*.deb

删除旧内核(可选)

dpkg -l | grep linux-image 
apt-get purge 旧内核

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

update-grub
reboot

开启BBR

开机后uname -r看看是不是内核> = 4.9

执行lsmod | grep bbr,如果中查询查询结果没有tcp_bbr的话教育就先执行

modprobe tcp_bbr
echo "tcp_bbr" >> /etc/modules-load.d/modules.conf

执行

echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf

保存生效

sysctl -p

执行

sysctl net.ipv4.tcp_available_congestion_control
sysctl net.ipv4.tcp_congestion_control

如果结果都有bbr,则证明你的内核已开启bbr

执行lsmod | grep bbr,看到有tcp_bbr模块即说明bbr已启动

V2ray设置参考: https://toutyrater.github.io/advanced/tls.html BBR设置参考: https://github.com/iMeiji/shadowsocks_install/wiki/%E5%BC%80%E5%90%AFTCP-BBR%E6%8B%A5%E5%A1%9E%E6%8E%A7%E5%88%B6%E7%AE%97%E6%B3%95