Manual for enabling BBR in zh-cn (#1096)
* Manual for enabling BBR in zh-cn * Update docs linked to bbr manual
This commit is contained in:
parent
f6ec4e53ca
commit
63133e1de4
@ -202,6 +202,7 @@ wget https://git.io/vpnupgrade -O vpnup.sh && sudo sh vpnup.sh
|
||||
- [VPN 分流](docs/advanced-usage-zh.md#vpn-分流)
|
||||
- [访问 VPN 服务器的网段](docs/advanced-usage-zh.md#访问-vpn-服务器的网段)
|
||||
- [更改 IPTables 规则](docs/advanced-usage-zh.md#更改-iptables-规则)
|
||||
- [部署Google BBR拥塞控制算法](docs/advanced-usage-zh.md#部署google-bbr拥塞控制算法)
|
||||
|
||||
## 问题和反馈
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
* [VPN 分流](#vpn-分流)
|
||||
* [访问 VPN 服务器的网段](#访问-vpn-服务器的网段)
|
||||
* [更改 IPTables 规则](#更改-iptables-规则)
|
||||
* [部署Google BBR拥塞控制算法](#部署google-bbr拥塞控制算法)
|
||||
|
||||
## 使用其他的 DNS 服务器
|
||||
|
||||
@ -279,6 +280,14 @@ iptables -t nat -I POSTROUTING -s 192.168.42.0/24 -o "$netif" -j MASQUERADE
|
||||
|
||||
**注:** 如果使用 Rocky Linux, AlmaLinux 或者 CentOS/RHEL 8 并且在安装 VPN 时 firewalld 正在运行,则可能已配置 nftables。在这种情况下,编辑 `/etc/sysconfig/nftables.conf` 而不是 `/etc/sysconfig/iptables`。
|
||||
|
||||
## 部署Google BBR拥塞控制算法
|
||||
|
||||
VPN服务器搭建完成后,可以通过部署Google BBR拥塞控制算法提升性能。
|
||||
|
||||
这通常只需要在配置文件 `/etc/sysctl.conf` 中插入设定即可完成。但是部分Linux发行版可能需要额外更新Linux Kernel。
|
||||
|
||||
详细的部署方法,可以参考[这篇文档](bbr-zh.md)。
|
||||
|
||||
## 授权协议
|
||||
|
||||
版权所有 (C) 2021-2022 [Lin Song](https://github.com/hwdsl2) [![View my profile on LinkedIn](https://static.licdn.com/scds/common/u/img/webpromo/btn_viewmy_160x25.png)](https://www.linkedin.com/in/linsongui)
|
||||
|
106
docs/bbr-zh.md
Normal file
106
docs/bbr-zh.md
Normal file
@ -0,0 +1,106 @@
|
||||
# Google BBR
|
||||
|
||||
Google BBR是一种由Google开发的拥塞控制算法,它能够显著提升服务器吞吐率并降低延迟。
|
||||
|
||||
Google BBR已经被内置于Linux Kernel 4.9及更高版本中,但是需要手动开启。
|
||||
|
||||
关于Google BBR算法,可以在这篇[官方博客](https://cloud.google.com/blog/products/networking/tcp-bbr-congestion-control-comes-to-gcp-your-internet-just-got-faster)或者这个[官方库](https://github.com/google/bbr)中找到更多信息。
|
||||
|
||||
## 准备
|
||||
|
||||
可以通过命令 `uname -r` 来查看当前Linux Kernel版本。版本大于等于4.9时,可以直接参照[下方的说明](#部署google-bbr)部署BBR。
|
||||
|
||||
通常而言,Ubuntu 18.04+, Debian 10+,CentOS 8+及RHEL 8+的内核版本都大于4.9。但是对于CentOS 7或者Amazon Linux 2,需要通过以下的方式更新内核之后才能部署Google BBR。
|
||||
|
||||
### Amazon Linux 2
|
||||
|
||||
Amazon Linux 2提供过经过验证的新版Linux Kernel,并可以通过启用预置的Extras库安装。
|
||||
|
||||
1. 启用 `kernel-ng` Extras 库
|
||||
```bash
|
||||
sudo amazon-linux-extras install kernel-ng
|
||||
```
|
||||
2. 更新包
|
||||
```bash
|
||||
sudo yum update
|
||||
```
|
||||
3. 重启系统
|
||||
```bash
|
||||
sudo reboot
|
||||
```
|
||||
4. 检查Linux Kernel版本
|
||||
```bash
|
||||
uname -r
|
||||
```
|
||||
|
||||
### CentOS 7
|
||||
|
||||
当使用CentOS 7时,需要安装由ELRepo Project提供的新版Linux Kernel。可以在[这个页面](http://elrepo.org/tiki/kernel-ml)找到有关ELRepo Project提供的Linux Kernel的更多信息。
|
||||
|
||||
以下的安装说明,因为缺少可供参考的中文文档,暂仅提供英文版。
|
||||
|
||||
1. Import ELRepo Project's public key.
|
||||
```bash
|
||||
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
|
||||
```
|
||||
2. Install ELRepo for RHEL-7, SL-7 or CentOS-7.
|
||||
```bash
|
||||
sudo yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
|
||||
```
|
||||
3. Install `kernel-ml`.
|
||||
```bash
|
||||
sudo yum --enablerepo=elrepo-kernel install kernel-ml
|
||||
```
|
||||
4. Confirm the result.
|
||||
```bash
|
||||
rpm -qa | grep kernel
|
||||
```
|
||||
You should see `kernel-ml-xxx` in output.
|
||||
5. Show all entries in the grub2 menu and setup `kernel-ml`.
|
||||
```bash
|
||||
sudo egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
|
||||
```
|
||||
**Indexing starts at `0`.**
|
||||
For example, when the `kernel-ml` is located at `1`, use the command below to activate `kernel-ml`.
|
||||
```bash
|
||||
sudo grub2-set-default 1
|
||||
```
|
||||
6. Reboot.
|
||||
```bash
|
||||
sudo reboot
|
||||
```
|
||||
7. Check Linux kernel version.
|
||||
```bash
|
||||
uname -r
|
||||
```
|
||||
|
||||
## 部署Google BBR
|
||||
|
||||
在这个部分,我们将通过修改配置文件启动Google BBR。
|
||||
|
||||
1. 备份 `/etc/sysctl.conf`
|
||||
```bash
|
||||
sudo cp /etc/sysctl.conf /etc/sysctl.conf.backup
|
||||
```
|
||||
2. 修改`/etc/sysctl.conf`
|
||||
```bash
|
||||
sudo vim /etc/sysctl.conf
|
||||
```
|
||||
在文件中增加以下行
|
||||
```
|
||||
net.core.default_qdisc = fq
|
||||
net.ipv4.tcp_congestion_control = bbr
|
||||
```
|
||||
3. 启用Google BBR
|
||||
```bash
|
||||
sudo sysctl -p
|
||||
```
|
||||
4. 检查Google BBR状态
|
||||
```bash
|
||||
sudo sysctl net.ipv4.tcp_available_congestion_control
|
||||
# net.ipv4.tcp_available_congestion_control = reno cubic bbr
|
||||
sudo sysctl -n net.ipv4.tcp_congestion_control
|
||||
# bbr
|
||||
lsmod | grep bbr
|
||||
# tcp_bbr 16384 0
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user