开启BBR
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf sysctl -p lsmod | grep bbr sysctl -n net.ipv4.tcp_congestion_control
更新内核
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh https://www.elrepo.org/elrepo-release-8.0-2.el8.elrepo.noarch.rpm yum --disablerepo="*" --enablerepo="elrepo-kernel" list available yum --enablerepo="elrepo-kernel" list available yum -y --enablerepo=elrepo-kernel install kernel-ml kernel-ml-devel reboot
开启BBR V2
#启用BBRv2
wget --no-check-certificate https://www.cloudy.pub/down/files/kernel/kernel-5.4.0_rc6-1.x86_64.rpm
rpm --force -ivh kernel-5.4.0_rc6-1.x86_64.rpm
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
echo "net.core.default_qdisc = fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control = bbr2" >> /etc/sysctl.conf
echo "net.ipv4.tcp_ecn = 1" >> /etc/sysctl.conf
echo "net.ipv4.tcp_ecn_fallback = 1" >> /etc/sysctl.conf
sysctl -p
reboot
#查看是否启用成功
sysctl net.ipv4.tcp_available_congestion_control
lsmod | grep bbr
#编译内核,如果直接用成品内核,可跳过以下步骤
yum groupinstall "Development tools"
yum install ncurses-devel bc gcc gcc-c++ ncurses ncurses-devel cmake elfutils-libelf-devel openssl-devel rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed xmlto audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel newt-devel python-devel zlib-devel
yum groups install development -y
yum install gcc bc ncurses-devel openssl-devel elfutils-libelf-devel rsync -y
dnf install grubby -y
scripts/config --disable MODULE_SIG
scripts/config --disable DEBUG_INFO
git clone -o google-bbr -b v2alpha https://github.com/google/bbr.git
cd bbr
make menuconfig
# 在内核设置里打开bbr2相关设置项
grep -i bbr2 .config
# 测试是否已经打开,显示M为已打开
make INSTALL_MOD_STRIP=1 rpm-pkg
# 较长时间等待
grubby --default-kernel
# 如内核不对,则重新制定内核
grubby --info=ALL
grubby --set-default /boot/vmlinuz-内核版本-el8.elrepo.x86_64
#编译报错指南
错误:
No rule to make target 'certs/rhel.pem', needed by 'certs/x509_certificate_list'
修正:
vi .config
#在文件中按/后查找CONFIG_SYSTEM_TRUSTED_KEYS,并向上共3行相关全注释
make menubuild
#有选择全默认回车即可
make INSTALL_MOD_STRIP=1 rpm-pkg -j2
#-j2表示2线程编译,数字几就是几线程,但是多线程会影响编译错误提示,自行抉择是否添加