下载rintd二进制文件(原版bbr和修改版bbr二选一即可):
1. wget --no-check-certificate https://raw.githubusercontent.com/mixool/rinetd/master/rinetd
2. wget --no-check-certificate https://raw.githubusercontent.com/mixool/rinetd/master/rinetd_bbr_powered -O /root/rinetd
- 修改权限:
chmod +x rinetd
修改rinetd的配置文件rinetd.conf,添加监听地址:
vi rinetd.conf# bindadress bindport connectaddress connectport
0.0.0.0 443 0.0.0.0 443
0.0.0.0 80 0.0.0.0 80
设置开机启动
vi /etc/systemd/system/rinetd.service[Unit]
Description=rinetd
[Service]
ExecStart=/root/rinetd -f -c /root/rinetd.conf raw venet0:0
Restart=always
[Install]
WantedBy=multi-user.target
最后执行:
systemctl enable rinetd.service && systemctl start rinetd.serviceLKL BBR RINETD
- 更新个自己写的一键(rinetd文件不一定是最新的):
curl https://raw.githubusercontent.com/mixool/script/master/rinetd.sh | bash
OPENVZ VPS的Google BBR加速之Rinetd方式
简介
手动搭建
1
|
wget -O /usr/bin/rinetd-bbr https://github.com/linhua55/lkl_study/releases/download/v1.2/rinetd_bbr_powered
|
1
|
chmod a+x /usr/bin/rinetd-bbr
|
1
|
vi /etc/rinetd-bbr.conf
|
1
2
3
|
# bindadress bindport connectaddress connectport
0.0.0.0 443 0.0.0.0 443
|
1
2
3
4
5
6
7
8
9
10
|
# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/void
inet 127.0.0.2/32 scope host venet0
inet 10.10.10.10/32 brd 10.10.10.10 scope global venet0:0
|
1
|
/usr/bin/rinetd-bbr -f -c /etc/rinetd-bbr.conf raw venet0:0 &
|
验证
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
|
[ 0.000000] Linux version 4.10.0+ (root@gcc) (gcc version 4.9.4 (Ubuntu 4.9.4-2ubuntu1~14.04.1) ) #1 Mon Jul 31 04:50:50 UTC 2017
[ 0.000000] bootmem address range: 0x7f2acc000000 - 0x7f2acffff000
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16159
[ 0.000000] Kernel command line: virtio_mmio.device=268@0x1000000:1
[ 0.000000] PID hash table entries: 256 (order: -1, 2048 bytes)
[ 0.000000] Dentry cache hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.000000] Memory available: 64492k/0k RAM
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:4096
[ 0.000000] lkl: irqs initialized
[ 0.000000] clocksource: lkl: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns
[ 0.000001] lkl: time and timers initialized (irq2)
[ 0.000003] pid_max: default: 4096 minimum: 301
[ 0.000021] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
[ 0.000023] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
[ 0.009053] console [lkl_console0] enabled
[ 0.009056] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.009128] NET: Registered protocol family 16
[ 0.009265] clocksource: Switched to clocksource lkl
[ 0.009324] NET: Registered protocol family 2
[ 0.009418] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[ 0.009421] TCP bind hash table entries: 512 (order: 0, 4096 bytes)
[ 0.009503] TCP: Hash tables configured (established 512 bind 512)
[ 0.009971] UDP hash table entries: 128 (order: 0, 4096 bytes)
[ 0.009976] UDP-Lite hash table entries: 128 (order: 0, 4096 bytes)
[ 0.010060] virtio-mmio: Registering device virtio-mmio.0 at 0x1000000-0x100010b, IRQ 1.
[ 0.010186] workingset: timestamp_bits=62 max_order=14 bucket_order=0
[ 0.010203] virtio-mmio virtio-mmio.0: Failed to enable 64-bit or 32-bit DMA. Trying to continue, but this might not work.
[ 0.010350] NET: Registered protocol family 10
[ 0.010849] Segment Routing with IPv6
[ 0.010859] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 0.010993] Warning: unable to open an initial console.
[ 0.011006] This architecture does not have kernel memory protection.
[ 2.169284] random: fast init done
|
1
2
3
4
5
6
7
8
|
# iptables -t raw -nL
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 /* LKL_RAW */
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 /* LKL_RAW */
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
|
About
study the LKL(linux kernel library) https://github.com/lkl/linux
lkl_study
study the LKL(linux kernel library) https://github.com/lkl/linux
Only apply to 64Bit Linux with ipv4 network.
Rinetd version(with LKL and raw socket backend)
Compile
- compile static library liblkl.a
https://github.com/linhua55/linux/tree/rinetd_bpf
refer to https://github.com/lkl/linux
Linux(LKL)'s kernel configuration file is the .config file in this repository, it need to be placed at the root directory of the LKL repository.
- compile rinetd(with lkl)
https://github.com/linhua55/rinetd
refer to https://github.com/linhua55/rinetd/blob/lkl_raw/make.sh
replace /home/vagrant/lkl/linux/tools/lkl/liblkl.a and /home/vagrant/lkl/linux/tools/lkl/include with your actual LKL path.
Release
rinetd(lkl) with bbr powered congestion control
wget "https://github.com/linhua55/lkl_study/releases/download/v1.2/rinetd_bbr_powered" -O /usr/bin/rinetd
rinetd(lkl) with bbr congestion control
wget "https://github.com/linhua55/lkl_study/releases/download/v1.2/rinetd_bbr" -O /usr/bin/rinetd
rinetd(lkl) with pcc congestion control
wget "https://github.com/linhua55/lkl_study/releases/download/v1.2/rinetd_pcc" -O /usr/bin/rinetd
For usage, refer to:
https://gist.github.com/codexss/1d5a834c479bb1532b9f82b23ee2f3fa
https://github.com/mixool/rinetd
https://www.v2ex.com/t/353778#r_4311799
One-key script
Thanks to @phuslu for his one-key script
Usage:
curl https://raw.githubusercontent.com/linhua55/lkl_study/master/get-rinetd.sh | bash
The configuration file generated by one-key script is /etc/rinetd-bbr.conf. By default, it only proxy(speed up) port 443and80, modify the port number as needed.
Determine if function
Use top command, view process rinetd's CPU usage. The faster of network speed, the bigger of CPU usage.
Caution:
- Dependency: iptables, grep, cut, xargs. Usual linux have these tools,But some linux use firewalld instead of iptables, it need install iptables
- For KVM VPS, need to change
venet0:0to the name of the network interface which have KVM's public IP, normally it iseth0
Some technical details
https://linhua55.github.io/2017/04/24/LKL(Linux%20Kernel%20Library)/
from https://github.com/linhua55/lkl_study
No comments:
Post a Comment