9

FreeBSD内核开启BBR

 2 years ago
source link: https://garywu520.github.io/2022/07/25/FreeBSD%E5%86%85%E6%A0%B8%E5%BC%80%E5%90%AFBBR/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

FreeBSD内核开启BBR

2022-07-25

字数统计: 305字

  |   阅读时长≈ 1分

FreeBSD内核开启BBR

1. 下载源码

umount /usr/src
rm -rf /usr/src
cd /root/
wget http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.3-RELEASE/src.txz
tar xzpf src.txz
cp -R usr/src /usr/

cd /usr/src/sys/amd64/conf
cp GENERIC BBR

2.调整配置

cat BBR

修改 ident 的值为 BBR ,并在 ident行添加以下内容:

ident     BBR

options TCPHPTS
options RATELIMIT
makeoptions WITH_EXTRA_TCP_STACKS=1

3. 新建src.conf

cat /etc/src.conf

KERNCONF=BBR
MALLOC_PRODUCTION=yes

4. 编译BBR内核

/usr/sbin/config BBR
cd ../compile/BBR
make cleandepend && make depend

#N设置为CPU核心数+1
make -jN

make install

#重启系统

如果编译出错,通常原因是配置时模块缺失。实在不能确定是否需要的模块请不要禁用。

uname -a

如果显示BBR,说明BBR内核编译并安装成功

#移除老内核
rm -rf /boot/kernel.old

5. 配置BBR

#bbr写入到/etc/rc.conf
sysrc kld_list+="tcp_rack tcp_bbr"

#sysctl启动时加载BBR模块
echo 'net.inet.tcp.functions_default=bbr' >> /etc/sysctl.conf

#校验bbr加载
sysctl net.inet.tcp.functions_default
#如果返回结果是net.inet.tcp.functions_default: bbr,则说明启用成功

#为所有 TCP 会话启用 BBR 日志记录
echo 'net.inet.tcp.bb.log_auto_mode=4' >>/etc/sysctl.con
echo 'net.inet.tcp.bb.log_auto_all=1' >>/etc/sysctl.con
echo 'net.inet.tcp.bb.log_auto_ratio=1' >>/etc/sysctl.con

Netflix GitHub项目: tcplog_dumper

扫一扫,分享到微信


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK