Debian/Ubuntu/CentOS手動更換內核並開啟BBR擁塞算法

說明

BBRGoogle開源的TCP BBR擁塞控製算法,用於提升網絡連接速度,提升空間巨大,優化效果非常明顯;
BBR僅支持4.9以上內核Ubuntu 18.04 CentOS 8 Debian 9均為4.9以上內核無需更換內核可以直接開啟BBR;

腳本安裝

步驟省略

安裝內核

更新係統軟件包到最新版

apt update && apt upgrade -y

查看係統位數

uname -m

執行後返回x86_64那就是64位係統;如果返回i386或386i686或686那就是32位係統;
下載內核

## 64位係統:

## 4.17.0
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17/linux-headers-4.17.0-041700_4.17.0-041700.201806041953_all.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17/linux-headers-4.17.0-041700-generic_4.17.0-041700.201806041953_amd64.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17/linux-image-unsigned-4.17.0-041700-generic_4.17.0-041700.201806041953_amd64.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v4.17/linux-modules-4.17.0-041700-generic_4.17.0-041700.201806041953_amd64.deb

## 4.19.0
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-headers-4.19.0-041900_4.19.0-041900.201810221809_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-headers-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-image-unsigned-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-modules-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb

## 5.2.4
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.2.4/linux-headers-5.2.4-050204_5.2.4-050204.201907280731_all.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.2.4/linux-headers-5.2.4-050204-generic_5.2.4-050204.201907280731_amd64.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.2.4/linux-image-unsigned-5.2.4-050204-generic_5.2.4-050204.201907280731_amd64.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.2.4/linux-modules-5.2.4-050204-generic_5.2.4-050204.201907280731_amd64.deb

## 5.6.0
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.6/linux-headers-5.6.0-050600_5.6.0-050600.202003292333_all.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.6/linux-headers-5.6.0-050600-generic_5.6.0-050600.202003292333_amd64.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.6/linux-image-unsigned-5.6.0-050600-generic_5.6.0-050600.202003292333_amd64.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.6/linux-modules-5.6.0-050600-generic_5.6.0-050600.202003292333_amd64.deb

## 32位係統:

## 4.19.0
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-headers-4.19.0-041900_4.19.0-041900.201810221809_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-headers-4.19.0-041900-generic_4.19.0-041900.201810221809_i386.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-image-4.19.0-041900-generic_4.19.0-041900.201810221809_i386.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-modules-4.19.0-041900-generic_4.19.0-041900.201810221809_i386.deb

安裝內核

dpkg -i *.deb

更新grub係統引導文件

update-grub

重啟服務器

reboot

重啟後查看係統內核版本,確認是否安裝成功

uname -r

CentOS
更換內核

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

yum --enablerepo=elrepo-kernel install kernel-ml -y

查看內核是否安裝成功

rpm -qa | grep kernel

更新grub係統引導文件

egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'

grub2-set-default 0  #default 0表示第一個內核設置為默認運行, 選擇最新內核就對了

重啟服務器

reboot

開啟BBR

刪除BBR
為了避免升級內核重複添加BBR開啟代碼,可以使用以下命令先刪除一遍

sed -i '/net\.core\.default_qdisc=fq/d' /etc/sysctl.conf

sed -i '/net\.ipv4\.tcp_congestion_control=bbr/d' /etc/sysctl.conf

開啟BBR

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

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

使其生效

sysctl -p

查看BBR是否開啟成功
執行如下命令,如果返回值中有bbr即說明開啟成功

sysctl net.ipv4.tcp_congestion_control

執行如下命令,如果返回值中有tcp_bbr模塊,即說明開啟成功

lsmod | grep bbr

相關說明:

1、VIP會員無限製任意下載,免積分。立即前往開通>>

2、下載積分可通過日常 簽到綁定郵箱 以及 積分兌換 等途徑獲得!

3、本站資源大多存儲在雲盤,如出現鏈接失效請評論反饋,如有密碼,均為:www.ipipn.com。

4、所有站內資源僅供學習交流使用。未經原版權作者許可,禁止用於任何商業環境,否則後果自負。為尊重作者版權,請購買正版作品。

5、站內資源來源於網絡公開發表文件或網友分享,如侵犯您的權益,請聯係管理員處理。

6、本站提供的源碼、模板、軟件工具等其他資源,都不包含技術服務,請大家諒解!

7、源碼、模板等資源會隨著技術、壞境的升級而存在部分問題,還請慎重選擇。

PS.源碼均收集自網絡,如有侵犯閣下權益,請發信件至: admin@ipipn.com .


源站網 » Debian/Ubuntu/CentOS手動更換內核並開啟BBR擁塞算法

發表評論

讚助本站發展 維持服務器消耗

全站源碼免費下載 立刻讚助