2024-09-23 16:47:48 +08:00
|
|
|
#!/bin/bash
|
2024-11-18 23:12:52 +08:00
|
|
|
declare kernel_version=$(uname -r | awk -F "." '{print $1}')
|
|
|
|
if ! [[ $kernel_version -ge 5 ]];then
|
2024-09-23 16:47:48 +08:00
|
|
|
echo "系统内核版本过低"
|
|
|
|
exit
|
|
|
|
fi
|
2024-09-23 18:25:54 +08:00
|
|
|
grep -q "net.core.default_qdisc=fq" "/etc/sysctl.conf" || echo 'net.core.default_qdisc=fq' | tee -a "/etc/sysctl.conf"
|
|
|
|
grep -q "net.ipv4.tcp_congestion_control=bbr" "/etc/sysctl.conf" || echo 'net.ipv4.tcp_congestion_control=bbr' | tee -a "/etc/sysctl.conf"
|
2024-11-18 23:12:52 +08:00
|
|
|
sysctl -p || echo "BBR 开启失败"
|
|
|
|
sysctl net.ipv4.tcp_available_congestion_control | grep bbr && echo "BBR 开启成功"
|