天天看點

Debian 9 和 CentOS 7 開啟 BBRDebian 9 和 CentOS 7 開啟 BBR

Debian 9 和 CentOS 7 開啟 BBR

  1. Debian 9 開啟BBR

由于Debian 9預設的核心版本就是4.9.x,不需要像别的系統需要更換核心,直接就能開啟BBR算法。

隻需要執行三行代碼就能開啟BBR:

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

如果輸出的結果中,都有BBR則代表開啟成功。

  1. CentOS7 開啟BBR

    檢視CentOS版本

cat /etc/redhat-release

檢視核心版本

cat /proc/version

在 CentOS 7 上安裝新核心

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

檢視目前已經安裝的核心:

awk -F' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg

傳回類似以下結果:

0 : CentOS Linux (4.10.2-1.el7.elrepo.x86_64) 7 (Core)

1 : CentOS Linux (3.10.0-514.10.2.el7.x86_64) 7 (Core)

2 : CentOS Linux (3.10.0-514.6.1.el7.x86_64) 7 (Core)

...

設定預設核心為 最新,比如上面的4.10.2-1.el7.elrepo.x86_64 ,并重新開機

grub2-set-default 0

reboot

如果用的是 Google Cloud Platform 的話,系統會變為 Read-only,執行下 mount -o remount rw / 就可以了

重新開機後,編輯 /etc/sysctl.conf,加入或修改下面兩行

net.core.default_qdisc = fq

net.ipv4.tcp_congestion_control = bbr

儲存後運作 sysctl -p

運作 lsmod | grep tcp_bbr 看 BBR 是否已經正常啟動,若顯示 tcp_bbr 表示已經啟動

繼續閱讀