text ubuntu18.04安装2.6.8开启BBR

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text ubuntu18.04安装2.6.8开启BBR相关的知识,希望对你有一定的参考价值。

一.更新
1.源
2.内核
二.安装一些工具
1.pip3(install python3-pip)
2.安装shadowsocks(pip3 install https://github.com/shadowsocks/shadowsocks/archive/master.zip),ssserver --version 可以查看版本
三.配置shadowsocks
1.mkdir /etc/shadowsocks
2.vim /etc/shadowsocks/config.json
{
    "server":"::",
    "server_port":8388,
    "local_address": "127.0.0.1",
    "local_port":1080,
    "password":"mypassword",
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": false
}
3.启动shadowsocks(ssserver -c /etc/shadowsocks/config.json)
四.配置Systemd管理Shadowsocks
1.vim /etc/systemd/system/shadowsocks-server.service
[Unit]
Description=Shadowsocks Server
After=network.target

[Service]
ExecStart=/usr/local/bin/ssserver -c /etc/shadowsocks/config.json
Restart=on-abort

[Install]
WantedBy=multi-user.target
2.systemctl start shadowsocks-server
  systemctl enable shadowsocks-server
五.开启BBR
1.确认内核是否高于4.9.0(uname -r),低于则apt update
sudo apt-cache showpkg linux-image
apt install linux-image-4.10.0-22-generic
reboot
purge-old-kernels
2.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
检查是否开启bbr
  sysctl net.ipv4.tcp_available_congestion_control
  sysctl net.ipv4.tcp_congestion_control
  六.优化网络
  1.vim /etc/sysctl.d/local.conf
  # max open files
fs.file-max = 51200
# max read buffer
net.core.rmem_max = 67108864
# max write buffer
net.core.wmem_max = 67108864
# default read buffer
net.core.rmem_default = 65536
# default write buffer
net.core.wmem_default = 65536
# max processor input queue
net.core.netdev_max_backlog = 4096
# max backlog
net.core.somaxconn = 4096

# resist SYN flood attacks
net.ipv4.tcp_syncookies = 1
# reuse timewait sockets when safe
net.ipv4.tcp_tw_reuse = 1
# turn off fast timewait sockets recycling
net.ipv4.tcp_tw_recycle = 0
# short FIN timeout
net.ipv4.tcp_fin_timeout = 30
# short keepalive time
net.ipv4.tcp_keepalive_time = 1200
# outbound port range
net.ipv4.ip_local_port_range = 10000 65000
# max SYN backlog
net.ipv4.tcp_max_syn_backlog = 4096
# max timewait sockets held by system simultaneously
net.ipv4.tcp_max_tw_buckets = 5000
# turn on TCP Fast Open on both client and server side
net.ipv4.tcp_fastopen = 3
# TCP receive buffer
net.ipv4.tcp_rmem = 4096 87380 67108864
# TCP write buffer
net.ipv4.tcp_wmem = 4096 65536 67108864
# turn on path MTU discovery
net.ipv4.tcp_mtu_probing = 1
net.ipv4.tcp_congestion_control = bbr

sysctl --system
vim /etc/systemd/system/shadowsocks-server.service
在ExecStart前插入一行,内容为:
ExecStartPre=/bin/sh -c 'ulimit -n 51200'

重载shadowsocks-server.service
systemctl daemon-reload
重启SS
systemctl restart shadowsocks-server
2.开启FAST Open
vim /etc/shadowsocks/config.json
systemctl restart shadowsocks-server

以上是关于text ubuntu18.04安装2.6.8开启BBR的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu18.04安装Docker完整教程

ubuntu18.04 开启tftp server

Ubuntu18.04下安装Sublime Text3

Ubuntu 18.04 系统U盘安装与初步设置

在Ubuntu上安装sublime 3 ,how to install sublime 3 text on Ubuntu 18.04

Ubuntu18.04下搭建LAMP环境