Skip to content

Instantly share code, notes, and snippets.

@paigeadelethompson
Last active July 25, 2023 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paigeadelethompson/c4790f4414d736e2a33deb8a816e9e12 to your computer and use it in GitHub Desktop.
Save paigeadelethompson/c4790f4414d736e2a33deb8a816e9e12 to your computer and use it in GitHub Desktop.
#!/bin/bash
ip -j addr | jq -r '.[] | select(.ifname | startswith("tun")) | .ifname +" "+ .addr_info[0].local' | awk '{print $2"%"$1}' | parallel -u -j8 iperf --bind {} -c 10.1.0.1 -p 443 -i
1
#!/bin/bash
/bin/ip route add 10.1.0.1 via $route_vpn_gateway dev $dev table $dev
/bin/ip rule add from $(/bin/ip -j addr show dev $dev | jq -r '.[] | .addr_info[0].local' | tr -d '\n') table $dev
#!/bin/bash
/bin/echo "100 tun0" >> /etc/iproute2/rt_tables
/bin/echo "200 tun1" >> /etc/iproute2/rt_tables
/bin/echo "300 tun2" >> /etc/iproute2/rt_tables
/bin/echo "400 tun3" >> /etc/iproute2/rt_tables
/bin/echo "500 tun4" >> /etc/iproute2/rt_tables
/bin/echo "600 tun5" >> /etc/iproute2/rt_tables
/bin/echo "700 tun6" >> /etc/iproute2/rt_tables
/bin/echo "800 tun7" >> /etc/iproute2/rt_tables
/bin/echo "900 tun8" >> /etc/iproute2/rt_tables
# Notes
# https://community.openvpn.net/openvpn/wiki/Gigabit_Networks_Linux
# https://haydenjames.io/improving-openvpn-performance-and-throughput/
# https://github.com/OpenVPN/ovpn-dco/issues/1
# https://github.com/OpenVPN/ovpn-dco
client
connect-retry 5
dev-type tun
proto udp
port 1194
remote 192.168.1.104 1194
cipher CHACHA20-POLY1305
data-ciphers CHACHA20-POLY1305
verb 3
mute 20
ca ca.crt
key cli.key
cert cli.crt
#dh dh.pem
tun-mtu 1500
mssfix 1460
sndbuf 512000
rcvbuf 512000
txqueuelen 2000
route-noexec
up ./up.sh
route-up ./route-up.sh
comp-lzo no
fast-io
# Notes
# https://community.openvpn.net/openvpn/wiki/Gigabit_Networks_Linux
# https://haydenjames.io/improving-openvpn-performance-and-throughput/
# https://github.com/OpenVPN/ovpn-dco/issues/1
# https://github.com/OpenVPN/ovpn-dco
dev tun
proto udp
port 1194
cipher CHACHA20-POLY1305
data-ciphers CHACHA20-POLY1305
verb 3
mute 20
server 10.1.0.0 255.255.255.0
ca ca.crt
key ovpn.key
cert ovpn.crt
dh dh.pem
tun-mtu 1500
mssfix 1460
sndbuf 512000
rcvbuf 512000
txqueuelen 2000
comp-lzo no
push "sndbuf 512000"
push "rcvbuf 512000"
fast-io
duplicate-cn
#!/bin/bash
seq 1 8 | sudo parallel -u -j8 openvpn --script-security 2 --dev tun{} --config openvpn.conf
@paigeadelethompson
Copy link
Author

paigeadelethompson commented Jul 25, 2023

first multiclient load test, server is iperf -s 0.0.0.0 -p 443 actual available bandwidth approx 480mbps

client command is: ip -j addr | jq -r '.[] | select(.ifname | startswith("tun")) | .ifname +" "+ .addr_info[0].local' | awk '{print $2"%"$1}' | parallel --tag -j8 iperf --bind {} -c 10.1.0.1 -p 443 > loadtest.log

10.1.0.90%tun1	------------------------------------------------------------
10.1.0.90%tun1	Client connecting to 10.1.0.1, TCP port 443
10.1.0.90%tun1	TCP window size: 16.0 KByte (default)
10.1.0.90%tun1	------------------------------------------------------------
10.1.0.90%tun1	[  1] local 10.1.0.90 port 50609 connected with 10.1.0.1 port 443 (icwnd/mss/irtt=13/1383/59959)
10.1.0.90%tun1	[ ID] Interval       Transfer     Bandwidth
10.1.0.90%tun1	[  1] 0.0000-10.0685 sec  26.8 MBytes  22.3 Mbits/sec
10.1.0.70%tun5	------------------------------------------------------------
10.1.0.70%tun5	Client connecting to 10.1.0.1, TCP port 443
10.1.0.70%tun5	TCP window size: 16.0 KByte (default)
10.1.0.70%tun5	------------------------------------------------------------
10.1.0.70%tun5	[  1] local 10.1.0.70 port 35969 connected with 10.1.0.1 port 443 (icwnd/mss/irtt=13/1383/67710)
10.1.0.70%tun5	[ ID] Interval       Transfer     Bandwidth
10.1.0.70%tun5	[  1] 0.0000-10.0839 sec  29.1 MBytes  24.2 Mbits/sec
10.1.0.82%tun7	------------------------------------------------------------
10.1.0.82%tun7	Client connecting to 10.1.0.1, TCP port 443
10.1.0.82%tun7	TCP window size: 16.0 KByte (default)
10.1.0.82%tun7	------------------------------------------------------------
10.1.0.82%tun7	[  1] local 10.1.0.82 port 43841 connected with 10.1.0.1 port 443 (icwnd/mss/irtt=13/1383/62598)
10.1.0.82%tun7	[ ID] Interval       Transfer     Bandwidth
10.1.0.82%tun7	[  1] 0.0000-10.0846 sec  29.8 MBytes  24.7 Mbits/sec
10.1.0.78%tun6	------------------------------------------------------------
10.1.0.78%tun6	Client connecting to 10.1.0.1, TCP port 443
10.1.0.78%tun6	TCP window size: 16.0 KByte (default)
10.1.0.78%tun6	------------------------------------------------------------
10.1.0.78%tun6	[  1] local 10.1.0.78 port 39923 connected with 10.1.0.1 port 443 (icwnd/mss/irtt=13/1383/64037)
10.1.0.78%tun6	[ ID] Interval       Transfer     Bandwidth
10.1.0.78%tun6	[  1] 0.0000-10.0846 sec  29.0 MBytes  24.1 Mbits/sec
10.1.0.86%tun3	------------------------------------------------------------
10.1.0.86%tun3	Client connecting to 10.1.0.1, TCP port 443
10.1.0.86%tun3	TCP window size: 16.0 KByte (default)
10.1.0.86%tun3	------------------------------------------------------------
10.1.0.86%tun3	[  1] local 10.1.0.86 port 56303 connected with 10.1.0.1 port 443 (icwnd/mss/irtt=13/1383/61248)
10.1.0.86%tun3	[ ID] Interval       Transfer     Bandwidth
10.1.0.86%tun3	[  1] 0.0000-10.1058 sec  42.5 MBytes  35.3 Mbits/sec
10.1.0.98%tun8	------------------------------------------------------------
10.1.0.98%tun8	Client connecting to 10.1.0.1, TCP port 443
10.1.0.98%tun8	TCP window size: 16.0 KByte (default)
10.1.0.98%tun8	------------------------------------------------------------
10.1.0.98%tun8	[  1] local 10.1.0.98 port 38983 connected with 10.1.0.1 port 443 (icwnd/mss/irtt=13/1383/57173)
10.1.0.98%tun8	[ ID] Interval       Transfer     Bandwidth
10.1.0.98%tun8	[  1] 0.0000-10.1058 sec  28.8 MBytes  23.9 Mbits/sec
10.1.0.74%tun4	------------------------------------------------------------
10.1.0.74%tun4	Client connecting to 10.1.0.1, TCP port 443
10.1.0.74%tun4	TCP window size: 16.0 KByte (default)
10.1.0.74%tun4	------------------------------------------------------------
10.1.0.74%tun4	[  1] local 10.1.0.74 port 53627 connected with 10.1.0.1 port 443 (icwnd/mss/irtt=13/1383/65560)
10.1.0.74%tun4	[ ID] Interval       Transfer     Bandwidth
10.1.0.74%tun4	[  1] 0.0000-10.1059 sec  32.1 MBytes  26.7 Mbits/sec
10.1.0.94%tun2	------------------------------------------------------------
10.1.0.94%tun2	Client connecting to 10.1.0.1, TCP port 443
10.1.0.94%tun2	TCP window size: 16.0 KByte (default)
10.1.0.94%tun2	------------------------------------------------------------
10.1.0.94%tun2	[  1] local 10.1.0.94 port 35773 connected with 10.1.0.1 port 443 (icwnd/mss/irtt=13/1383/58584)
10.1.0.94%tun2	[ ID] Interval       Transfer     Bandwidth
10.1.0.94%tun2	[  1] 0.0000-10.1059 sec  36.6 MBytes  30.4 Mbits/sec

iperf stats from the server perspective

[ ID] Interval            Transfer    Bandwidth       Reads=Dist
[ 11] 0.0000-16.7130 sec  64.0 MBytes  32.1 Mbits/sec  36762=36709:18:5:12:10:5:2:1
[  9] 0.0000-18.8445 sec  64.0 MBytes  28.5 Mbits/sec  38129=38073:20:8:19:5:3:1:0
[ 10] 0.0000-18.9518 sec  64.0 MBytes  28.3 Mbits/sec  37502=37446:20:10:13:11:2:0:0
[ 15] 0.0000-19.0430 sec  64.0 MBytes  28.2 Mbits/sec  37297=37229:24:18:17:6:1:1:1
[ 16] 0.0000-19.2162 sec  64.0 MBytes  27.9 Mbits/sec  37611=37551:19:11:19:9:1:1:0
[ 13] 0.0000-19.5943 sec  64.0 MBytes  27.4 Mbits/sec  37213=37149:25:18:11:6:4:0:0
[ 14] 0.0000-19.6448 sec  64.0 MBytes  27.3 Mbits/sec  37586=37531:21:11:13:7:3:0:0
[ 12] 0.0000-19.7575 sec  64.0 MBytes  27.2 Mbits/sec  37781=37722:23:10:15:10:1:0:0

@paigeadelethompson
Copy link
Author

This was not a good test example, the server is running on a debian armel vm running on a macbook m1 parallels bridging wifi) from one laptop wifi to another

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment