My goal is to optimize my routed TUN setups throughput between site A and site B for normal traffic such as rsync, FTPS, HTTPS, CIFS, SSH etc. I have been using this as reference:
https://community.openvpn.net/openvpn/wiki/Gigabit_Networks_Linux#no1
Some facts about the hardware.
OpenVPN server at site A
- OpenVPN version 2.0.9 (can't upgrade)
- libssl0.9.8
- CPU, Intel(R) Atom(TM) CPU D510 @ 1.66GHz (DualCore, no support for AES-NI)
- RAM, 4096MB DDR2 @ 667Mhz
- WAN, 250 Mbits/s downstream and 100 Mbits/s upstream
OpenVPN client at site B
- OpenVPN version 2.0.9 (can't upgrade)
- libssl0.9.8
- CPU, Intel(R) Atom(TM) CPU D405 @ 1.50GHz (SingleCore, no support for AES-NI)
- RAM, 1024MB DDR2 @ 667MHz
- WAN, 100 Mbits/s downstream and 10 Mbits/s upstream
Both sites are using the same ISP and the client will mostly "pull" data from the server i.e. the transfer rate would mainly be 100 Mbits/s between site A and site B. Measured throughputs from site B to A, without tunneling are (according to iperf):
- 96.4 Mbits/s downstream
- 10.6 Mbits/s upstream
I've done some testing with the MTU's but the result make absolutely no sense to me. Take a look at this:
iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[ 4] local 192.168.1.2 port 5001 connected with 172.16.0.2 port 48457
[ 4] 0.0-10.1 sec 37.5 MBytes 31.2 Mbits/sec
[ 5] local 192.168.1.2 port 5001 connected with 172.16.0.2 port 53760
[ 5] 0.0-10.1 sec 136 MBytes 114 Mbits/sec
[ 4] local 192.168.1.2 port 5001 connected with 172.16.0.2 port 53819
[ 4] 0.0-10.1 sec 202 MBytes 168 Mbits/sec
[ 5] local 192.168.1.2 port 5001 connected with 172.16.0.2 port 53853
[ 5] 0.0-10.1 sec 263 MBytes 219 Mbits/sec
First run is with MTU size 1500, second 6000, third 9000 and last 12000. From there the throughput just escalates along with the higher MTU size. The actual throughput when doing a drag and drop copy of an ISO file was graphed to 19.34 Mbits/s by Cacti. Can I expect higher throughput with this hardware or does this look like optimal throughput for the hardware used? Changing MTU size does not have a noticeable effect on the throughput nor does a "decrease" in decryption (Blowfish or AES128). Finally, what am I doing wrong with iperf? If I could get reliable results then I could find the optimal MTU.
Server config.
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
local 192.168.1.2
port X
proto udp
dev tun
persist-tun
persist-key
server 172.16.0.0 255.255.255.0
ifconfig-pool-linear ipp 0
client-to-client
client-config-dir ccd
route 192.168.2.0 255.255.255.0
keepalive 10 120
cipher aes-256-cbc
auth sha256
tls-server
tls-cipher AES256-SHA
tls-auth ta.key 0
verb 6
log-append /var/log/openvpn.log
status openvpn-status.log
max-clients 1
user nobody
group nogroup
comp-lzo yes
tun-mtu 1500
fragment 0
mssfix 0
Client config.
client
dev tun
proto udp
remote X Y
resolv-retry infinite
nobind
user nobody
group nogroup
persist-key
persist-tun
ca ca.crt
cert client.crt
key client.key
comp-lzo yes
verb 6
log-append /var/log/openvpn.log
cipher aes-256-cbc
auth sha256
tls-client
tls-cipher AES256-SHA
tls-auth ta.key 1
nobind
tun-mtu 1500
fragment 0
mssfix 0