wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh
chmod +x bbr.sh
./bbr.sh
uname -r
查看内核版本,含有 4.13 就表示 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已启动。
内核升级方法
内核升级方法
如果是 CentOS 系统,执行如下命令即可升级内核:
yum --enablerepo=elrepo-kernel -y install kernel-ml kernel-ml-devel
CentOS 6 的话,执行命令:
sed -i 's/^default=.*/default=0/g' /boot/grub/grub.conf
CentOS 7 的话,执行命令:
grub2-set-default 0
如果是 Debian/Ubuntu 系统,则需要手动下载最新版内核来安装升级。
去这里下载最新版的内核 deb 安装包。
如果系统是 64 位,则下载 amd64 的 linux-image 中含有 generic 这个 deb 包;
如果系统是 32 位,则下载 i386 的 linux-image 中含有 generic 这个 deb 包;
安装的命令如下(以最新版的 64 位 4.12.4 举例而已,请替换为下载好的 deb 包):
去这里下载最新版的内核 deb 安装包。
如果系统是 64 位,则下载 amd64 的 linux-image 中含有 generic 这个 deb 包;
如果系统是 32 位,则下载 i386 的 linux-image 中含有 generic 这个 deb 包;
安装的命令如下(以最新版的 64 位 4.12.4 举例而已,请替换为下载好的 deb 包):
dpkg -i linux-image-4.12.4-041204-generic_4.12.4-041204.201707271932_amd64.deb
安装完成后,再执行命令:
/usr/sbin/update-grub
最后,重启 VPS 即可。
特别说明
如果你使用的是 Google Cloud Platform (GCP)更换内核,有时会遇到重启后,整个磁盘变为只读的情况。只需执行以下命令即可恢复:
mount -o remount rw /
BBR增强版
开启BBR
wget --no-check-certificate -qO 'BBR.sh' 'https://moeclub.org/attachment/LinuxShell/BBR.sh' && chmod a+x BBR.sh && bash BBR.sh -f
注意:执行此命令会自动重启
安装
wget --no-check-certificate -qO 'BBR_POWERED.sh' 'https://moeclub.org/attachment/LinuxShell/BBR_POWERED.sh' && chmod a+x BBR_POWERED.sh && bash BBR_POWERED.sh
或指定某内核
wget --no-check-certificate -qO 'BBR_POWERED.sh' 'https://moeclub.org/attachment/LinuxShell/BBR_POWERED.sh' && chmod a+x BBR_POWERED.sh && bash BBR_POWERED.sh -f v4.11.9
说明:
执行过程中会重新编译模块.
模块默认为开机自动加载.
模块名称:tcp_bbr_powered
可用 modprobe tcp_bbr_powered 命令进行加载模块.
可执行 lsmod |grep 'bbr_powered'
结果不为空,则加载模块成功
可执行 sysctl -w net.ipv4.tcp_congestion_control=bbr_powered 使用此模块.
以上只是说明,直接使用一键脚本即可.
修改引导配置文件中等待时间
sed -i 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=1/g' /etc/default/grub
修改内核为最新安装的内核
sed -i 's/GRUB_DEFAULT=saved/GRUB_DEFAULT=0/g' /etc/default/grub
重新生成引导文件
grub2-mkconfig -o /boot/grub2/grub.cfg
删除旧内核
rpm -qa | grep kernel
yum autoremove -y 内核名字
grub2-mkconfig -o /boot/grub2/grub.cfg
CBBR魔改BBR(第二种)
Debian/Ubuntu(64位)开启魔改BBR
- #### Ubuntu14.04需要提前:
apt-get install -y software-properties-common
add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update
apt-get -y install g++-4.9
- #### Debian9需要提前:
wget http://snapshot.debian.org/archive/debian/20150123T220434Z/pool/main/o/openssl/libssl1.0.0_1.0.2-1_amd64.deb
dpkg -i libssl1.0.0_1.0.2-1_amd64.deb
安装
第一步:
apt-get install -y wget && wget --no-check-certificate -O D1.sh https://raw.githubusercontent.com/xratzh/CBBR/master/D1.sh && bash D1.sh
之后输入Y就会重启
第二步:
wget --no-check-certificate -O D2.sh https://raw.githubusercontent.com/xratzh/CBBR/master/D2.sh && bash D2.sh
CentOS7开启魔改BBR
第一步:
yum install -y wget && wget --no-check-certificate -O C71.sh https://raw.githubusercontent.com/xratzh/CBBR/master/C71.sh && bash C71.sh
之后输入Y就会重启
第二步:
wget --no-check-certificate -O C72.sh https://raw.githubusercontent.com/xratzh/CBBR/master/C72.sh && bash C72.sh
CentOS6开启魔改BBR
第一步:
yum install -y wget && wget --no-check-certificate -O C61.sh https://raw.githubusercontent.com/xratzh/CBBR/master/C61.sh && bash C61.sh
之后输入Y就会重启
第二步:
wget --no-check-certificate -O C62.sh https://raw.githubusercontent.com/xratzh/CBBR/master/C62.sh && bash C62.sh