记录我的一些生活写照、无聊的牢骚、内心世界的活动 注册 | 登陆

一键脚本 LINUX VPS一键升级到最新系统内核版本并开启BBR + FQ

 一键脚本 LINUX VPS一键升级到最新系统内核版本并开启BBR + FQ

BBR是Google提出的一项开源的网络拥堵控制算法,项目地址:https://github.com/google/bbr。

一般来说,买了Linux VPS的首要工作就是开启BBR,用于减少网络拥堵和降低TCP连接的延迟(此延迟并非Ping延迟)。

Linux系统内核高于4.9的一般内置了BBR算法,可以手动开启;但是手动升级内核和开启BBR的步骤太繁琐,才有了各路大神开发的一键脚本,本文使用的是目前最常见的来自@ylx2016大佬开源的一键脚本;该脚本可以一键升级到最新系统内核并卸载原有内核,一键开启BBR。

这个脚本有 BBR原版 / BBR Plus / Lotserver(锐速) / xanmod 等等,该怎么选?根据站长的经验,一般用BBR原版内核,并使用BBR + FQ算法就行了;丢包率特别高的可以用BBR Plus + FQ算法。

 重要提醒:已经用于生产环境的VPS上请谨慎使用该一键脚本。

1、通过SSH工具连接上VPS,安装 wget 和 curl;已经有安装的可以跳过本步骤。

Centos系统: yum install wget curl -y
Ubuntu/Debian系统: apt-get install wget curl -y

2、输入以下命令并回车(下载并自动执行一键脚本);

bash <(curl -sL https://git.huaweicdn.net/tcp.sh)

3、执行脚本之后如图所示:

一键脚本 Linux VPS一键升级到最新系统内核版本并开启BBR + FQ插图

4、输入1并回车,安装BBR原版内核最新版(请注意脚本更新之后的数字变动);这一切都是自动的,只需要在安装完毕之后确认一下内核是否安装成功,如果出现下列代码示例,则输入y之后按回车,VPS会重新启动;如果没有出现如下示例代码,则重新运行该一键脚本,如果没有出现如下示例代码,重启之后VPS会失联。

额外补充:Ubuntu / Debian 系统在此步骤会多一个内核移除提示,这一步选NO,之后回车;如下图所示:

一键脚本 Linux VPS一键升级到最新系统内核版本并开启BBR + FQ插图1

Generating grub configuration file ... Found linux image: /boot/vmlinuz-5.14.10 Found initrd image: /boot/initrd.img-5.14.10 done [注意] 请检查上面是否有内核信息,无内核千万别重启 [注意] rescue不是正常内核,要排除这个

一键脚本 Linux VPS一键升级到最新系统内核版本并开启BBR + FQ插图2

5、VPS重启之后,SSH重新连接上VPS,还是这个命令(按小键盘上箭头即可调用出来):

bash <(curl -sL https://git.huaweicdn.net/tcp.sh)

并回车,继续执行一键脚本;忽略下图中的“BBR启动成功”,因为本文示例VPS之前就使用BBR Plus + FQ加速。

一键脚本 Linux VPS一键升级到最新系统内核版本并开启BBR + FQ插图3

6、输入11并回车,使用BBR+FQ加速(请注意脚本更新之后的数字变动)

一键脚本 Linux VPS一键升级到最新系统内核版本并开启BBR + FQ插图4

7、输入reboot重启VPS,再次执行:

bash <(curl -sL https://git.huaweicdn.net/tcp.sh)

查看BBR是否启动成功,如下图所示就是成功开启了。

一键脚本 Linux VPS一键升级到最新系统内核版本并开启BBR + FQ插图5

境外服务器安装:

预先准备
centos:yum install ca-certificates wget -y && update-ca-trust force-enable
debian/ubuntu:apt-get install ca-certificates wget -y && update-ca-certificates

不卸载内核版本
wget -O tcpx.sh "https://github.com/ylx2016/Linux-NetSpeed/raw/master/tcpx.sh" && chmod +x tcpx.sh && ./tcpx.sh
卸载内核版本
wget -O tcp.sh "https://github.com/ylx2016/Linux-NetSpeed/raw/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh

关联action自动编译内核
https://github.com/ylx2016/kernel/

双持bbr+锐速
bbr 添加
echo "net.core.default_qdisc=fq" >> /etc/sysctl.d/99-sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.d/99-sysctl.conf
sysctl -p

编辑锐速文件
nano /appex/etc/config

检测代码有BUG,如果锐速正常 运行查看
bash /appex/bin/lotServer.sh status | grep "LotServer"

检查bbr 内核默认bbr算法不会有输出
lsmod | grep bbr

检查centos安装内核
grubby --info=ALL|awk -F= '$1=="kernel" {print i++ " : " $2}'

查看当前支持TCP算法
cat /proc/sys/net/ipv4/tcp_allowed_congestion_control
查看当前运行的算法
cat /proc/sys/net/ipv4/tcp_congestion_control
查看当前队列算法
sysctl net.core.default_qdisc

命令: uname -a
作用: 查看系统内核版本号及系统名称

命令: cat /proc/version
作用: 查看目录"/proc"下version的信息,也可以得到当前系统的内核版本号及系统名称

真实队列查看? 更改队列算法可能需要重启生效
tc -s qdisc show

/etc/sysctl.d/99-sysctl.conf
sysctl --system

ylx2016与chiakge、cx9208无任何关系
bbsplus算法原作者
https://blog.csdn.net/dog250/article/details/80629551
bbrplus首用名 ?
https://github.com/cx9208/bbrplus
新版bbrplus
https://github.com/UJX6N/bbrplus-5.10
xanmod官网
https://xanmod.org
Zen官网
https://liquorix.net/
锐速
https://moeclub.org/2017/03/09/14/
其他内核
https://github.com/alibaba/cloud-kernel
https://github.com/Tencent/TencentOS-kernel
官方编译好的内核
https://sourceforge.net/projects/xanmod/files/releases/current
https://elrepo.org/linux/kernel/el7/x86_64/RPMS/
https://elrepo.org/linux/kernel/el8/x86_64/RPMS/
https://kernel.ubuntu.com/~kernel-ppa/mainline/
http://mirrors.aliyun.com/alinux/2.1903/plus/x86_64/Packages/
https://mirrors.tencent.com/tlinux/2.4/tlinux/x86_64/RPMS/
https://bintray.com/multipath-tcp/mptcp_rpm/mptcp/v0.95.1#files
https://bintray.com/multipath-tcp/mptcp_deb/mptcp/v0.95.1#files

DD脚本
https://git.beta.gs/
https://www.cxthhhhh.com/network-reinstall-system-modify

高科技
https://github.com/mack-a/v2ray-agent
https://github.com/phlinhng/v2ray-tcp-tls-web
https://github.com/johnrosen1/vpstoolbox
https://github.com/wulabing/Xray_onekey

服务周期
https://zh.wikipedia.org/zh/Ubuntu
https://wiki.ubuntu.com/Releases
https://wiki.debian.org/LTS
https://wiki.centos.org/zh/About/Product

XML/HTML代码
  1. #Usage 脚本使用方法
  2. bash <(curl -Lso- https://git.io/kernel.sh)
  3. #通过 curl 命令安装 via curl to install script
  4. curl -O https://raw.githubusercontent.com/jinwyp/one_click_script/master/install_kernel.sh && chmod +x ./install_kernel.sh && ./install_kernel.sh
  5. #通过 wget 命令安装 Linux 内核 和 Wireguard via wget to install script
  6. wget --no-check-certificate https://raw.githubusercontent.com/jinwyp/one_click_script/master/install_kernel.sh && chmod +x ./install_kernel.sh && ./install_kernel.sh
以上脚本任选一个就可以安装linux新版内核并开启BBR或BBR Plus加速,详细参考官方说明。

« 上一篇 | 下一篇 »

发表评论

评论内容 (必填):