Projet

Général

Profil

Benchmark VPN » Historique » Version 13

Baptiste Jonglez, 08/06/2014 16:02
Update results

1 2 Baptiste Jonglez
{{>toc}}
2 2 Baptiste Jonglez
3 1 Baptiste Jonglez
h1. Benchmark VPN
4 1 Baptiste Jonglez
5 1 Baptiste Jonglez
But : *étudier la performance de différentes solutions de VPN sur des petits routeurs OpenWRT.*
6 1 Baptiste Jonglez
7 1 Baptiste Jonglez
Le but final étant de se servir des tunnels pour router des IP publiques : [[Partage_ADSL_OpenVPN]]
8 1 Baptiste Jonglez
9 2 Baptiste Jonglez
Pour les autres critères de choix (facilité de mise en place, sécurité, etc), voir [[VPN]].
10 1 Baptiste Jonglez
11 2 Baptiste Jonglez
h2. Méthodologie
12 1 Baptiste Jonglez
13 7 Baptiste Jonglez
Matériel : un routeur à benchmarker, et deux ordinateurs testeurs (voir plus bas pour se contenter d'un seul ordinateur testeur)
14 7 Baptiste Jonglez
15 7 Baptiste Jonglez
Le routeur monte un tunnel VPN avec un ordinateur branché sur le WAN.  Sur le LAN, l'autre ordinateur se connecte normalement.
16 7 Baptiste Jonglez
17 7 Baptiste Jonglez
En un schéma :
18 7 Baptiste Jonglez
19 1 Baptiste Jonglez
!benchmark-setup.png!
20 1 Baptiste Jonglez
21 7 Baptiste Jonglez
Une fois ce setup en place, on utilise iperf en TCP entre les deux laptops, en empruntant le tunnel (i.e. entre 192.168.42.1 et 172.23.38.2 sur le schéma)
22 7 Baptiste Jonglez
23 7 Baptiste Jonglez
On ne fait pas de iperf sur le routeur directement, car iperf bouffe lui-même pas mal de CPU.  De plus, sur le routeur, on ne met ni firewall, ni NAT.
24 7 Baptiste Jonglez
25 7 Baptiste Jonglez
Tests à réaliser : *iperf TCP entre les deux laptops, dans les deux sens*, dans les cas suivants :
26 7 Baptiste Jonglez
27 7 Baptiste Jonglez
* test gros paquets (1400 octets), puis petits paquets (cf. VoIP, 50 à 100 octets, la mesure standard étant 64 octets)
28 7 Baptiste Jonglez
* sans emprunter le VPN (baseline), puis à travers le VPN
29 7 Baptiste Jonglez
30 7 Baptiste Jonglez
Paramètres mesurés :
31 7 Baptiste Jonglez
32 7 Baptiste Jonglez
* débit mesuré par iperf, et en déduire le nombre de paquets par secondes (attention à la taille des headers dans le calcul)
33 7 Baptiste Jonglez
* consommation CPU sur le routeur (difficilement automatisable / reproductible ?)
34 7 Baptiste Jonglez
35 7 Baptiste Jonglez
Autres tests possibles :
36 7 Baptiste Jonglez
37 7 Baptiste Jonglez
* avec/sans firewall stateful
38 7 Baptiste Jonglez
* client connecté sur le wifi plutôt que sur un des ports LAN (mais les résultats risquent de beaucoup dépendre du matériel wifi)
39 2 Baptiste Jonglez
40 1 Baptiste Jonglez
À terme, on peut envisager une automatisation de ce processus, par exemple via un paquet OpenWRT pour le routeur et une configuration toute faite et/out script pour le testeur.
41 2 Baptiste Jonglez
42 11 Baptiste Jonglez
h3. Notes sur iperf
43 11 Baptiste Jonglez
44 11 Baptiste Jonglez
* C'est difficile de choisir la taille des paquets (l'option "-M" fait des choses...)
45 11 Baptiste Jonglez
* Le débit donné par iperf correspond au payload TCP.  Avec des petits paquets, le débit affiché peut facilement être deux fois plus faible que le débit brut sur l'interface (overhead des headers TCP/IP/Ethernet)
46 11 Baptiste Jonglez
* Les chiffres obtenus sont donc à prendre avec des pincettes... C'est l'ordre de grandeur qui est important.
47 11 Baptiste Jonglez
48 8 Baptiste Jonglez
h3. Avec un seul laptop
49 8 Baptiste Jonglez
50 8 Baptiste Jonglez
C'est possible de tester avec un seul laptop, si il a deux interfaces réseau (par exemple une carte réseau USB).  Par contre, il faut bidouiller un peu : si on iperf vers une de ses propres adresses, ça va rester en local et ne pas passer par le routeur. 
51 8 Baptiste Jonglez
52 8 Baptiste Jonglez
Solution : utiliser les *network namespaces* de linux. Technique décrite ici : http://blog.bofh.it/debian/id_446
53 8 Baptiste Jonglez
54 9 Baptiste Jonglez
La première interface est eth0, qui sera branchée sur le WAN (donc côté VPN), tandis que eth1 sera utilisée en simple client sur le LAN.
55 9 Baptiste Jonglez
56 9 Baptiste Jonglez
<pre>
57 9 Baptiste Jonglez
ip netns add bench
58 9 Baptiste Jonglez
ip link set eth1 netns bench
59 9 Baptiste Jonglez
ip netns exec bench ip link set lo up
60 9 Baptiste Jonglez
ip netns exec bench ip link set eth1 up
61 9 Baptiste Jonglez
</pre>
62 9 Baptiste Jonglez
63 9 Baptiste Jonglez
Il suffit ensuite de faire toutes les manips sur eth1 avec @ip netns exec bench@ devant, ou bien carrément lancer un shell dans le nouveau namespace :
64 9 Baptiste Jonglez
65 9 Baptiste Jonglez
<pre>
66 9 Baptiste Jonglez
ip netns exec bench /bin/bash
67 9 Baptiste Jonglez
</pre>
68 9 Baptiste Jonglez
69 1 Baptiste Jonglez
h2. Related
70 2 Baptiste Jonglez
71 2 Baptiste Jonglez
Rien de bien concret côté OpenWRT :
72 1 Baptiste Jonglez
73 2 Baptiste Jonglez
* http://wiki.openwrt.org/doc/howto/performance
74 1 Baptiste Jonglez
* http://wiki.openwrt.org/doc/hardware/performance
75 2 Baptiste Jonglez
76 2 Baptiste Jonglez
h2. Résultats
77 2 Baptiste Jonglez
78 10 Baptiste Jonglez
h3. Template
79 1 Baptiste Jonglez
80 10 Baptiste Jonglez
Example result (fictional):
81 10 Baptiste Jonglez
82 10 Baptiste Jonglez
|_.Techno    |_.Version |_.Packet size |_.In throughput |_. In measured pps |_.Out throughput |_.Out measured pps |_.Router CPU load |
83 10 Baptiste Jonglez
|/2. No VPN  |/2. linux 3.3.8 | 1500   | 95 Mbps        | 3K                | 95 Mbps         | 3K                | 50% sirq         |
84 10 Baptiste Jonglez
                        | 64           | 50 Mbps        | 15K               | 50 Mbps         | 15K               | 95% sirq         |
85 10 Baptiste Jonglez
|/2. Openvpn |/2. 2.2   | 1500         | 40 Mbps        | 1K                | 35 Mbps         | 1K                | 10% sirq, 90% openvpn |
86 10 Baptiste Jonglez
                        | 64           | 5 Mbps         | 5K                | 10 Mbps         | 5K                | 50% sirq, 50% openvpn |
87 10 Baptiste Jonglez
|/2. PPP/L2TPv2 |/2. linux 3.3.8    
88 10 Baptiste Jonglez
                     xl2tp 1.3.1    | 1500         | 40 Mbps        | 1K                | 35 Mbps         | 1K                | 20% sirq, 80% kernel |
89 10 Baptiste Jonglez
                                    | 64           | 5 Mbps         | 5K                | 10 Mbps         | 5K                | 50% sirq, 50% kernel |
90 10 Baptiste Jonglez
91 10 Baptiste Jonglez
"in" and "out" throughput are defined with respect to the client. "in" is VPN server to LAN client, "out" is LAN client to VPN server.
92 10 Baptiste Jonglez
93 10 Baptiste Jonglez
h3. TP-Link WR841N v8
94 12 Baptiste Jonglez
95 12 Baptiste Jonglez
See specs: http://wiki.openwrt.org/toh/tp-link/tl-wr841nd#hardware
96 12 Baptiste Jonglez
97 12 Baptiste Jonglez
*Notes:*
98 12 Baptiste Jonglez
99 12 Baptiste Jonglez
* "payload size" is the size of the TCP payload when using iperf in TCP mode. If you specify "iperf -M X", then the size of the TCP payload is "X - 12" (don't ask me why...)
100 12 Baptiste Jonglez
* IN: from VPN server to LAN client
101 12 Baptiste Jonglez
* OUT: from LAN client to VPN server
102 12 Baptiste Jonglez
* The format for versions is <code><software> <version used by the router> (<version used by the VPN server, i.e. laptop>)</code>
103 13 Baptiste Jonglez
* CPU usage is determined by looking hard at top, so consider it ±5% (if not a bit more)
104 12 Baptiste Jonglez
* Except noted otherwise, everything uses the default config:
105 1 Baptiste Jonglez
106 13 Baptiste Jonglez
  * OpenVPN: no compression, 2048 RSA static key, p2p mode, UDP, Blowfish, SHA1
107 13 Baptiste Jonglez
  * Tinc: no compression, 2048 RSA key, Blowfish, SHA1
108 12 Baptiste Jonglez
109 12 Baptiste Jonglez
|_.Techno       |_.Version                 |_.Payload size |_.Direction |_.Throughput  |_.pps    |_.CPU (usr) |_.CPU (sys) |_.CPU (sirq) |_.Comment           |
110 13 Baptiste Jonglez
|_/4.No VPN     |/4. linux 3.3.8 (3.14.5)  |/2. 1448       | IN         |=.  94.2 Mbps |>.  8129 |=.          |=.          |=.  50%      |  Line speed        |
111 13 Baptiste Jonglez
                                                           | OUT        |=.  94.2 Mbps |>.  8129 |=.          |=.          |=.  55%      |  Line speed        |
112 13 Baptiste Jonglez
                                           |/2.   76       | IN         |=.  17.4 Mbps |>. 28590 |=.          |=.          |=.  99%      |                    |
113 13 Baptiste Jonglez
                                                           | OUT        |=.  23.4 Mbps |>. 38463 |=.          |=.          |=.  99%      |                    |
114 13 Baptiste Jonglez
|_/4.GRE        |/4. linux 3.3.8 (3.14.5)  |/2. 1448       | IN         |=.  92.7 Mbps |>.  8003 |=.          |=.          |=.  78%      |  Line speed        |
115 13 Baptiste Jonglez
                                                           | OUT        |=.  92.8 Mbps |>.  8014 |=.          |=.          |=.  88%      |  Line speed        |
116 13 Baptiste Jonglez
                                           |/2.   76       | IN         |=.  10.5 Mbps |>. 17197 |=.          |=.          |=.  99%      |                    |
117 13 Baptiste Jonglez
                                                           | OUT        |=.  9.92 Mbps |>. 16309 |=.          |=.          |=.  99%      |                    |
118 13 Baptiste Jonglez
|_/4.IPIP       |/4. linux 3.3.8 (3.14.5)  |/2. 1448       | IN         |=.  93.0 Mbps |>.  8024 |=.          |=.          |=.  70%      |  Line speed        |
119 13 Baptiste Jonglez
                                                           | OUT        |=.  93.0 Mbps |>.  8026 |=.          |=.          |=.  80%      |  Line speed        |
120 13 Baptiste Jonglez
                                           |/2.   76       | IN         |=.  11.3 Mbps |>. 18602 |=.          |=.          |=.  99%      |                    |
121 13 Baptiste Jonglez
                                                           | OUT        |=.  11.4 Mbps |>. 18803 |=.          |=.          |=.  99%      |                    |
122 12 Baptiste Jonglez
|_/4.PPP/L2TPv2 |/4. linux 3.3.8 (3.14.5)
123 13 Baptiste Jonglez
                     xl2tp 1.3.1 (1.3.6)   |/2. 1448       | IN         |=.  88.8 Mbps |>.  7661 |=.          |=.          |=.  99%      | Router is not very |
124 13 Baptiste Jonglez
                                                           | OUT        |=.  88.6 Mbps |>.  7648 |=.          |=.          |=.  99%      | responsive (sometimes |
125 13 Baptiste Jonglez
                                           |/2.   76       | IN         |=.  9.59 Mbps |>. 15780 |=.          |=.          |=.  99%      | the PPP session    |
126 13 Baptiste Jonglez
                                                           | OUT        |=.  8.36 Mbps |>. 13745 |=.          |=.          |=.  99%      | even timeouts)     |
127 12 Baptiste Jonglez
|_/4.Tinc
128 12 Baptiste Jonglez
 Default cipher
129 12 Baptiste Jonglez
 Default digest |/4. tinc 1.0.21 (1.0.24)
130 13 Baptiste Jonglez
                 OpenSSL 1.0.1g (1.0.1.g)  |/2. 1448       | IN         |=.  15.9 Mbps |>.  1369 |=.  55%     |=.  20%     |=.  25%      |                    |
131 13 Baptiste Jonglez
                                                           | OUT        |=.  15.1 Mbps |>.  1301 |=.  50%     |=.  25%     |=.  25%      |                    |
132 13 Baptiste Jonglez
                                           |/2.   76       | IN         |=.  1.26 Mbps |>.  2069 |=.  40%     |=.  25%     |=.  35%      |                    |
133 13 Baptiste Jonglez
                                                           | OUT        |=.  1.30 Mbps |>.  2140 |=.  40%     |=.  30%     |=.  30%      |                    |
134 12 Baptiste Jonglez
|_/4.OpenVPN
135 12 Baptiste Jonglez
 Default cipher
136 12 Baptiste Jonglez
 Default auth   |/4. openvpn 2.2.2 (2.3.4)
137 13 Baptiste Jonglez
                 OpenSSL 1.0.1g (1.0.1.g)  |/2. 1448       | IN         |=.  17.9 Mbps |>.  1548 |=.  55%     |=.  20%     |=.  25%      |                    |
138 13 Baptiste Jonglez
                                                           | OUT        |=.  15.6 Mbps |>.  1345 |=.  53%     |=.  23%     |=.  23%      |                    |
139 13 Baptiste Jonglez
                                           |/2.   76       | IN         |=.  1.46 Mbps |>.  2395 |=.  40%     |=.  25%     |=.  35%      |                    |
140 13 Baptiste Jonglez
                                                           | OUT        |=.  1.29 Mbps |>.  2116 |=.  40%     |=.  30%     |=.  30%      |                    |
141 12 Baptiste Jonglez
|_/4.Tinc
142 12 Baptiste Jonglez
 No cipher
143 12 Baptiste Jonglez
 Default digest |/4. tinc 1.0.21 (1.0.24)
144 13 Baptiste Jonglez
                 OpenSSL 1.0.1g (1.0.1.g)  |/2. 1448       | IN         |=.  22.9 Mbps |>.  1975 |=.  45%     |=.  27%     |=.  27%      |                    |
145 13 Baptiste Jonglez
                                                           | OUT        |=.  21.3 Mbps |>.  1842 |=.  40%     |=.  35%     |=.  25%      |                    |
146 13 Baptiste Jonglez
                                           |/2.   76       | IN         |=.  1.53 Mbps |>.  2511 |=.  35%     |=.  30%     |=.  35%      |                    |
147 13 Baptiste Jonglez
                                                           | OUT        |=.  1.57 Mbps |>.  2574 |=.  35%     |=.  35%     |=.  30%      |                    |
148 12 Baptiste Jonglez
|_/4.OpenVPN
149 12 Baptiste Jonglez
 No cipher
150 12 Baptiste Jonglez
 Default auth   |/4. openvpn 2.2.2 (2.3.4)
151 13 Baptiste Jonglez
                 OpenSSL 1.0.1g (1.0.1.g)  |/2. 1448       | IN         |=.  26.8 Mbps |>.  2313 |=.  35%     |=.  30%     |=.  35%      |                    |
152 13 Baptiste Jonglez
                                                           | OUT        |=.  26.2 Mbps |>.  2264 |=.  35%     |=.  30%     |=.  30%      |                    |
153 13 Baptiste Jonglez
                                           |/2.   76       | IN         |=.  1.92 Mbps |>.  3153 |=.  30%     |=.  30%     |=.  40%      |                    |
154 13 Baptiste Jonglez
                                                           | OUT        |=.  1.90 Mbps |>.  3130 |=.  30%     |=.  35%     |=.  35%      |                    |
155 12 Baptiste Jonglez
|_/4.Tinc
156 12 Baptiste Jonglez
 Default cipher
157 12 Baptiste Jonglez
 No digest      |/4. tinc 1.0.21 (1.0.24)
158 13 Baptiste Jonglez
                 OpenSSL 1.0.1g (1.0.1.g)  |/2. 1448       | IN         |=.  23.9 Mbps |>.  2062 |=.  45%     |=.  27%     |=.  27%      |                    |
159 13 Baptiste Jonglez
                                                           | OUT        |=.  21.9 Mbps |>.  1890 |=.  35%     |=.  35%     |=.  30%      |                    |
160 13 Baptiste Jonglez
                                           |/2.   76       | IN         |=.  1.95 Mbps |>.  3206 |=.  25%     |=.  30%     |=.  45%      |                    |
161 13 Baptiste Jonglez
                                                           | OUT        |=.  1.96 Mbps |>.  3225 |=.  25%     |=.  40%     |=.  35%      |                    |
162 12 Baptiste Jonglez
|_/4.OpenVPN
163 12 Baptiste Jonglez
 Default cipher
164 12 Baptiste Jonglez
 No auth        |/4. openvpn 2.2.2 (2.3.4)
165 13 Baptiste Jonglez
                 OpenSSL 1.0.1g (1.0.1.g)  |/2. 1448       | IN         |=.  22.0 Mbps |>.  1899 |=.  50%     |=.  20%     |=.  30%      |                    |
166 13 Baptiste Jonglez
                                                           | OUT        |=.  18.9 Mbps |>.  1632 |=.  50%     |=.  20%     |=.  25%      |                    |
167 13 Baptiste Jonglez
                                           |/2.   76       | IN         |=.  1.71 Mbps |>.  2819 |=.  35%     |=.  30%     |=.  35%      |                    |
168 13 Baptiste Jonglez
                                                           | OUT        |=.  1.46 Mbps |>.  2403 |=.  40%     |=.  30%     |=.  30%      |                    |
169 12 Baptiste Jonglez
|_/4.Tinc
170 12 Baptiste Jonglez
 No cipher
171 12 Baptiste Jonglez
 No digest      |/4. tinc 1.0.21 (1.0.24)
172 13 Baptiste Jonglez
                 OpenSSL 1.0.1g (1.0.1.g)  |/2. 1448       | IN         |=.  42.2 Mbps |>.  3639 |=.  10%     |=.  45%     |=.  45%      |                    |
173 13 Baptiste Jonglez
                                                           | OUT        |=.  36.7 Mbps |>.  3167 |=.  10%     |=.  50%     |=.  40%      |                    |
174 13 Baptiste Jonglez
                                           |/2.   76       | IN         |=.  2.60 Mbps |>.  4276 |=.  10%     |=.  40%     |=.  50%      |                    |
175 13 Baptiste Jonglez
                                                           | OUT        |=.  2.59 Mbps |>.  4257 |=.  10%     |=.  45%     |=.  45%      |                    |
176 12 Baptiste Jonglez
|_/4.OpenVPN
177 12 Baptiste Jonglez
 No cipher
178 12 Baptiste Jonglez
 No auth        |/4. openvpn 2.2.2 (2.3.4)
179 13 Baptiste Jonglez
                 OpenSSL 1.0.1g (1.0.1.g)  |/2. 1448       | IN         |=.  42.8 Mbps |>.  3693 |=.  15%     |=.  35%     |=.  50%      |                    |
180 13 Baptiste Jonglez
                                                           | OUT        |=.  41.8 Mbps |>.  3607 |=.  10%     |=.  45%     |=.  45%      |                    |
181 13 Baptiste Jonglez
                                           |/2.   76       | IN         |=.  2.68 Mbps |>.  4411 |=.  15%     |=.  35%     |=.  50%      |                    |
182 13 Baptiste Jonglez
                                                           | OUT        |=.  2.66 Mbps |>.  4380 |=.  15%     |=.  40%     |=.  45%      |                    |