centos7与8启动方法不同(似乎)
我没看过原文,不想看,先贴上https://github.com/google/bbr
centos7
- 查看系统版本
cat /etc/redhat-release
输出类似这样的
CentOS Linux release 7.6.1810 (Core)
2.安装elrepo并升级内核
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
这里是centos7的,似乎有个centos8版本的,但我centos8安装过,然后后面第三步开始过不去,不清楚是啥原因
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
yum --enablerepo=elrepo-kernel install kernel-ml -y
3.安装完成后查看当前已安装的内核
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
会返回一串这样的
0 : CentOS Linux (4.19.0-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux 7 Rescue ee7953a3b5944053a26f29daf8c71e2f (3.10.0-862.14.4.el7.x86_64)
2 : CentOS Linux (3.10.0-862.14.4.el7.x86_64) 7 (Core)
3 : CentOS Linux (3.10.0-862.3.2.el7.x86_64) 7 (Core)
4 : CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)
5 : CentOS Linux (0-rescue-4bbda2095d924b72b05507b68bd509f0) 7 (Core)
4.把CentOS Linux (4.19.0-1.el7.elrepo.x86_64) 7 (Core)内核设置为默认
不一定是这个版本,但大概都是0:这个,改的时候看一下名字
grub2-set-default 0
- 重启服务器
reboot
直接去控制台重启就行,之前我用阿里云的试了一下,reboot好像不行
6. 设置BBR
(1)编辑配置文件
vi /etc/sysctl.conf
(2)在里面加入(i)
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
(wq)
(3)加载系统参数
sysctl -p
7.验证是否开启bbr
两种代码
(1)
sysctl net.ipv4.tcp_available_congestion_control
若返回
net.ipv4.tcp_available_congestion_control = reno cubic bbr
则成功
若返回
net.ipv4.tcp_available_congestion_control = reno cubic
就回头看看漏了什么
(2)
lsmod | grep bbr
返回
tcp_bbr 20480 2
centos8
启用BBR的条件是内核版本大于4.9,而centos8的内核已经够了
- 查看内核版本
uname -r
返回
4.18.0-338.el8.x86_64
内核版本够了,只要在sysctl.conf配置文件加入两句内容,在重新加载系统参数即可即可
2.加内容
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
加载系统参数
sysctl -p
3.查看是否成功,同7
(1)
sysctl -n net.ipv4.tcp_congestion_control
(2)
lsmod | grep bbr