I really appreciate help optimizing this VPN where possible. I am no expert.
I require maximum performance because we are about to migrate our services between datacenters.
VPN server config:
port 1194
proto udp
dev-type tun
dev sh0
tun-mtu 1500
mssfix 1450
reneg-sec 0
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/vpn2.crt
key /etc/openvpn/keys/vpn2.key
dh /etc/openvpn/keys/dh2048.pem
tls-auth /etc/openvpn/keys/ta.key 0
server 172.22.0.0 255.255.0.0
client-config-dir ccd
ifconfig-pool-persist ipp.txt
route 10.5.0.0 255.255.0.0
push "route 172.16.0.0 255.255.0.0"
push "route 10.33.148.0 255.255.255.0"
push "route 10.33.45.128 255.255.255.128"
push "route 10.32.204.0 255.255.255.0"
push "route 10.34.14.96 255.255.255.224"
client-to-client
keepalive 1 7
cipher DES-EDE3-CBC
comp-lzo
persist-key
persist-tun
status /var/log/openvpn/status.log
log /var/log/openvpn/openvpn.log
mute 20
verb 4
script-security 2
txqueuelen 1000
VPN client config:
client jdi-vpn-client
remote-random
remote XXX.XXX.XXX.XXX 1194
proto udp
dev vpn
dev-type tun
cipher DES-EDE3-CBC
comp-lzo yes
script-security 2
nobind
persist-key
persist-tun
cert /etc/openvpn/keys/jdi-vpn-client.crt
key /etc/openvpn/keys/jdi-vpn-client.key
ca /etc/openvpn/keys/ca.crt
tls-auth /etc/openvpn/keys/ta.key 1
status /var/log/openvpn/status.log
log /var/log/openvpn/openvpn.log
verb 3
mute 20
txqueuelen 1000
Server log:
Thu Jul 23 04:17:21 2015 us=478916 XXX.XXX.XXX.XXX:37197 Re-using SSL/TLS context
Thu Jul 23 04:17:21 2015 us=478947 XXX.XXX.XXX.XXX:37197 LZO compression initialized
Thu Jul 23 04:17:21 2015 us=479033 XXX.XXX.XXX.XXX:37197 Control Channel MTU parms [ L:1542 D:166 EF:66 EB:0 ET:0 EL:0 ]
Thu Jul 23 04:17:21 2015 us=479059 XXX.XXX.XXX.XXX:37197 Data Channel MTU parms [ L:1542 D:1450 EF:42 EB:135 ET:0 EL:0 AF:3/1 ]
Thu Jul 23 04:17:21 2015 us=479102 XXX.XXX.XXX.XXX:37197 Local Options String: 'V4,dev-type tun,link-mtu 1542,tun-mtu 1500,proto UDPv4,comp-lzo,keydir 0,cipher DES-EDE3-CBC,auth SHA1,keysize 192,tls-auth,key-method 2,tls-server'
Thu Jul 23 04:17:21 2015 us=479121 XXX.XXX.XXX.XXX:37197 Expected Remote Options String: 'V4,dev-type tun,link-mtu 1542,tun-mtu 1500,proto UDPv4,comp-lzo,keydir 1,cipher DES-EDE3-CBC,auth SHA1,keysize 192,tls-auth,key-method 2,tls-client'
Thu Jul 23 04:17:21 2015 us=479146 XXX.XXX.XXX.XXX:37197 Local Options hash (VER=V4): 'b5edb94e'
Thu Jul 23 04:17:21 2015 us=479170 XXX.XXX.XXX.XXX:37197 Expected Remote Options hash (VER=V4): '53f7fc82'
Thu Jul 23 04:17:21 2015 us=479205 XXX.XXX.XXX.XXX:37197 TLS: Initial packet from [AF_INET]XXX.XXX.XXX.XXX:37197, sid=63721000 64511d3b
Thu Jul 23 04:17:21 2015 us=913342 XXX.XXX.XXX.XXX:37197 VERIFY OK: depth=1, /C=GB/ST=XXXXXXXXX/L=XXXXXXX/O=XXXXXXXXXXXX/CN=XXXXXXXXXXXX_CA/emailAddress=XXXXXXXXXXXXXXXXXXX
Thu Jul 23 04:17:21 2015 us=913605 XXX.XXX.XXX.XXX:37197 VERIFY OK: depth=0, /C=GB/ST=XXXXXXXXX/L=XXXXXXX/O=XXXXXXXXXXXX/CN=jdi-vpn-client/emailAddress=XXXXXXXXXXXXXXXXXXX
Thu Jul 23 04:17:22 2015 us=53300 XXX.XXX.XXX.XXX:37197 Data Channel Encrypt: Cipher 'DES-EDE3-CBC' initialized with 192 bit key
Thu Jul 23 04:17:22 2015 us=53342 XXX.XXX.XXX.XXX:37197 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Jul 23 04:17:22 2015 us=53365 XXX.XXX.XXX.XXX:37197 Data Channel Decrypt: Cipher 'DES-EDE3-CBC' initialized with 192 bit key
Thu Jul 23 04:17:22 2015 us=53385 XXX.XXX.XXX.XXX:37197 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Jul 23 04:17:22 2015 us=91596 XXX.XXX.XXX.XXX:37197 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 2048 bit RSA
Thu Jul 23 04:17:22 2015 us=91646 XXX.XXX.XXX.XXX:37197 [jdi-vpn-client] Peer Connection Initiated with [AF_INET]XXX.XXX.XXX.XXX:37197
Thu Jul 23 04:17:22 2015 us=91845 MULTI: new connection by client 'jdi-vpn-client' will cause previous active sessions by this client to be dropped. Remember to use the --duplicate-cn option if you want multiple clients using the same certificate or username to concurrently connect.
Thu Jul 23 04:17:22 2015 us=91965 MULTI_sva: pool returned IPv4=172.22.0.6, IPv6=1a00::b8cc:e2d7:227f:0
Thu Jul 23 04:17:22 2015 us=92034 MULTI: Learn: 172.22.0.6 -> jdi-vpn-client/XXX.XXX.XXX.XXX:37197
Thu Jul 23 04:17:22 2015 us=92055 MULTI: primary virtual IP for jdi-vpn-client/XXX.XXX.XXX.XXX:37197: 172.22.0.6
Thu Jul 23 04:17:24 2015 us=550225 jdi-vpn-client/XXX.XXX.XXX.XXX:37197 PUSH: Received control message: 'PUSH_REQUEST'
Thu Jul 23 04:17:24 2015 us=550263 jdi-vpn-client/XXX.XXX.XXX.XXX:37197 send_push_reply(): safe_cap=960
Thu Jul 23 04:17:24 2015 us=550351 jdi-vpn-client/XXX.XXX.XXX.XXX:37197 SENT CONTROL [jdi-vpn-client]: 'PUSH_REPLY,route 172.16.0.0 255.255.0.0,route 10.33.148.0 255.255.255.0,route 10.33.45.128 255.255.255.128,route 10.32.204.0 255.255.255.0,route 10.34.14.96 255.255.255.224,route 172.22.0.0 255.255.0.0,topology net30,ping 1,ping-restart 7,ifconfig 172.22.0.6 172.22.0.5' (status=1)
Client log:
Thu Jul 23 10:17:21 2015 OpenVPN 2.2.1 x86_64-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Dec 1 2014
Thu Jul 23 10:17:21 2015 WARNING: No server certificate verification method has been enabled. See
http://openvpn.net/howto.html#mitm for more info.
Thu Jul 23 10:17:21 2015 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Thu Jul 23 10:17:21 2015 Control Channel Authentication: using '/etc/openvpn/keys/ta.key' as a OpenVPN static key file
Thu Jul 23 10:17:21 2015 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Jul 23 10:17:21 2015 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Jul 23 10:17:21 2015 LZO compression initialized
Thu Jul 23 10:17:21 2015 Control Channel MTU parms [ L:1542 D:166 EF:66 EB:0 ET:0 EL:0 ]
Thu Jul 23 10:17:21 2015 Socket Buffers: R=[212992->131072] S=[212992->131072]
Thu Jul 23 10:17:21 2015 Data Channel MTU parms [ L:1542 D:1450 EF:42 EB:135 ET:0 EL:0 AF:3/1 ]
Thu Jul 23 10:17:21 2015 Local Options hash (VER=V4): '53f7fc82'
Thu Jul 23 10:17:21 2015 Expected Remote Options hash (VER=V4): 'b5edb94e'
Thu Jul 23 10:17:21 2015 UDPv4 link local: [undef]
Thu Jul 23 10:17:21 2015 UDPv4 link remote: [AF_INET]XXX.XXX.XXX.XXX:1194
Thu Jul 23 10:17:21 2015 TLS: Initial packet from [AF_INET]XXX.XXX.XXX.XXX:1194, sid=8c29fadf 200f6392
Thu Jul 23 10:17:21 2015 VERIFY OK: depth=1, /C=GB/ST=XXXXXXXXX/L=XXXXXXX/O=XXXXXXXXXXXX/CN=XXXXXXXXXXXX_CA/emailAddress=XXXXXXXXXXXXXXXXXXX
Thu Jul 23 10:17:21 2015 VERIFY OK: depth=0, /C=GB/ST=XXXXXXXXX/L=XXXXXXX/O=XXXXXXXXXXXX/CN=vpn2/emailAddress=XXXXXXXXXXXXXXXXXXX
Thu Jul 23 10:17:22 2015 Data Channel Encrypt: Cipher 'DES-EDE3-CBC' initialized with 192 bit key
Thu Jul 23 10:17:22 2015 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Jul 23 10:17:22 2015 Data Channel Decrypt: Cipher 'DES-EDE3-CBC' initialized with 192 bit key
Thu Jul 23 10:17:22 2015 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Jul 23 10:17:22 2015 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 2048 bit RSA
Thu Jul 23 10:17:22 2015 [vpn2] Peer Connection Initiated with [AF_INET]XXX.XXX.XXX.XXX:1194
Thu Jul 23 10:17:24 2015 SENT CONTROL [vpn2]: 'PUSH_REQUEST' (status=1)
Thu Jul 23 10:17:24 2015 PUSH: Received control message: 'PUSH_REPLY,route 172.16.0.0 255.255.0.0,route 10.33.148.0 255.255.255.0,route 10.33.45.128 255.255.255.128,route 10.32.204.0 255.255.255.0,route 10.34.14.96 255.255.255.224,route 172.22.0.0 255.255.0.0,topology net30,ping 1,ping-restart 7,ifconfig 172.22.0.6 172.22.0.5'
Thu Jul 23 10:17:24 2015 OPTIONS IMPORT: timers and/or timeouts modified
Thu Jul 23 10:17:24 2015 OPTIONS IMPORT: --ifconfig/up options modified
Thu Jul 23 10:17:24 2015 OPTIONS IMPORT: route options modified
Thu Jul 23 10:17:24 2015 ROUTE default_gateway=10.5.0.1
Thu Jul 23 10:17:24 2015 TUN/TAP device vpn opened
Thu Jul 23 10:17:24 2015 TUN/TAP TX queue length set to 1000
Thu Jul 23 10:17:24 2015 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Thu Jul 23 10:17:24 2015 /sbin/ifconfig vpn 172.22.0.6 pointopoint 172.22.0.5 mtu 1500
Thu Jul 23 10:17:24 2015 /sbin/route add -net 172.16.0.0 netmask 255.255.0.0 gw 172.22.0.5
Thu Jul 23 10:17:24 2015 /sbin/route add -net 10.33.148.0 netmask 255.255.255.0 gw 172.22.0.5
Thu Jul 23 10:17:24 2015 /sbin/route add -net 10.33.45.128 netmask 255.255.255.128 gw 172.22.0.5
Thu Jul 23 10:17:24 2015 /sbin/route add -net 10.32.204.0 netmask 255.255.255.0 gw 172.22.0.5
Thu Jul 23 10:17:24 2015 /sbin/route add -net 10.34.14.96 netmask 255.255.255.224 gw 172.22.0.5
Thu Jul 23 10:17:24 2015 /sbin/route add -net 172.22.0.0 netmask 255.255.0.0 gw 172.22.0.5
Thu Jul 23 10:17:24 2015 Initialization Sequence Completed
Performance without VPN:
iperf -c XXX.XXX.XXX.XXX
------------------------------------------------------------
Client connecting to XXX.XXX.XXX.XXX, TCP port 5001
TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[ 3] local 10.5.167.76 port 32773 connected with XXX.XXX.XXX.XXX port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 974 MBytes 816 Mbits/sec
Performance over VPN:
iperf -c 172.22.0.1
------------------------------------------------------------
Client connecting to 172.22.0.1, TCP port 5001
TCP window size: 45.0 KByte (default)
------------------------------------------------------------
[ 3] local 172.22.0.6 port 40141 connected with 172.22.0.1 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 65.5 MBytes 54.7 Mbits/sec
CPU usage during performance test over VPN:
These are both powerfull machines, and the openvpn process does not exceed 20% cpu usage on either the client or server.
Other information:
The server and client have a 1Gbit interface. The 816Mbits/sec bandwidth test above confirms the 1Gbit interface bandwidth limit of the client.
Server interface
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 00:25:90:3c:8b:86 brd ff:ff:ff:ff:ff:ff
37: sh0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 1000
link/none
Client interface
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 42:01:0a:05:a7:4c brd ff:ff:ff:ff:ff:ff
77: vpn: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 1000
link/none
I notice the client eth0 interface has n mtu of 1460, but the client vpn interface has a mtu of 1500. Could this be an issue? I don't really understand if I need to tweak the mtu settings in the openvpn config.