forked from AutisticShark/Airport-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bbr_c8.sh
118 lines (106 loc) · 3.32 KB
/
bbr_c8.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
cat << "EOF"
Author: M1Screw
Github: https://github.com/M1Screw/Airport-toolkit
EOF
echo "BBR configuration (via Mainline or Longterm Kernel) for CentOS Stream 8 x86_64"
[ $(id -u) != "0" ] && { echo "Error: You must be root to run this script!"; exit 1; }
do_elrepo(){
echo "Install and configure the elrepo"
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install -y https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm
}
do_kernel(){
echo "Install mainline kernel"
yum --enablerepo=elrepo-kernel install kernel-ml -y
grub2-set-default 0
}
do_kernel_lt(){
echo "Install longterm kernel"
yum --enablerepo=elrepo-kernel install kernel-lt -y
grub2-set-default 0
}
do_headers(){
echo "Install mainline kernel-headers and clean the default one"
yum remove kernel-headers -y
yum --enablerepo=elrepo-kernel install kernel-ml-headers -y
}
do_headers_lt(){
echo "Install longterm kernel-headers and clean the default one"
yum remove kernel-headers -y
yum --enablerepo=elrepo-kernel install kernel-ml-headers -y
}
do_tools(){
echo "Install mainline kernel-tools and clean the default one"
yum remove kernel-tools kernel-tools-libs -y
yum --enablerepo=elrepo-kernel install kernel-ml-tools kernel-ml-tools-libs -y
}
do_tools_lt(){
echo "Install longterm kernel-tools and clean the default one"
yum remove kernel-tools kernel-tools-libs -y
yum --enablerepo=elrepo-kernel install kernel-ml-tools kernel-ml-tools-libs -y
}
do_enable_bbr(){
echo "Enable BBR module"
modprobe tcp_bbr
echo "tcp_bbr" | tee --append /etc/modules-load.d/modules.conf
echo "Configure BBR in sysctl.conf"
echo "net.core.default_qdisc=fq" | tee --append /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" | tee --append /etc/sysctl.conf
sysctl -p
}
do_status_check(){
echo "Current running kernel:"
uname -r
echo "BBR module status:"
lsmod | grep bbr
echo "BBR system configuration status:"
sysctl net.ipv4.tcp_available_congestion_control
sysctl net.ipv4.tcp_congestion_control
echo "Kernel related rpm packages:"
rpm -qa | grep kernel
echo "System booting kernel options:"
ls -l /boot/vmlinuz-*
}
do_update_kernel(){
echo "Upgrade kernel and related packages"
yum --enablerepo=elrepo-kernel update kernel-lt kernel-ml kernel-lt-headers kernel-ml-headers kernel-lt-tools-libs kernel-ml-tools-libs -y
}
do_reboot(){
echo "System require a reboot to complete the mainline kernel installation process, press Y to continue, or press any key else to exit this script."
read is_reboot
if [[ ${is_reboot} == "y" || ${is_reboot} == "Y" ]]; then
reboot
else
echo "Reboot has been canceled..."
exit 0
fi
}
if [[ $1 == "status" ]]; then
do_status_check
exit 1
fi
if [[ $1 == "bbr" ]]; then
do_enable_bbr
exit 1
fi
if [[ $1 == "update" ]]; then
do_update_kernel
exit 1
fi
do_elrepo
if [[ $1 == "longterm" ]]; then
do_kernel_lt
do_headers_lt
do_tools_lt
do_enable_bbr
do_reboot
exit 1
fi
do_kernel
do_headers
do_tools
do_enable_bbr
do_reboot