Browse code

dco: add documentation for ovpn-dco-linux

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20220805093703.27940-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24817.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Antonio Quartulli authored on 2022/08/05 18:37:03
Showing 4 changed files
... ...
@@ -79,6 +79,15 @@ Cookie based handshake for UDP server
79 79
     shake. The tls-crypt-v2 option allows controlling if older clients are
80 80
     accepted.
81 81
 
82
+Data channel offloading with ovpn-dco
83
+    2.6.0+ implements support for data-channel offloading where the data packets
84
+    are directly processed and forwarded in kernel space thanks to the ovpn-dco
85
+    kernel module. The userspace openvpn program acts purely as a control plane
86
+    application. Note that DCO will use DATA_V2 packets in P2P mode, therefore,
87
+    this implies that peers must be running 2.6.0+ in order to have P2P-NCP
88
+    which brings DATA_V2 packet support.
89
+
90
+
82 91
 Deprecated features
83 92
 -------------------
84 93
 ``inetd`` has been removed
85 94
new file mode 100644
... ...
@@ -0,0 +1,122 @@
0
+OpenVPN data channel offload
1
+============================
2
+2.6.0+ implements support for data-channel offloading where the data packets
3
+are directly processed and forwarded in kernel space thanks to the ovpn-dco
4
+kernel module. The userspace openvpn program acts purely as a control plane
5
+application.
6
+
7
+
8
+Overview of current release
9
+---------------------------
10
+- See the "Limitations by design" and "Current limitations" sections for
11
+  features that are not and/or will not be supported by OpenVPN + ovpn-dco.
12
+
13
+
14
+Getting started (Linux)
15
+-----------------------
16
+- Use a recent Linux kernel. Linux 5.4.0 and newer are known to work with
17
+  ovpn-dco.
18
+
19
+Get the ovpn-dco module from one these urls and build it:
20
+
21
+* https://gitlab.com/openvpn/ovpn-dco
22
+* https://github.com/OpenVPN/ovpn-dco
23
+
24
+e.g.
25
+
26
+    git clone https://github.com/OpenVPN/ovpn-dco
27
+    cd ovpn-dco
28
+    make
29
+    sudo make install
30
+
31
+If you want to report bugs please ensure to compile ovpn-dco with
32
+`make DEBUG=1` and include any debug message being printed by the
33
+kernel (you can view those messages with `dmesg`).
34
+
35
+Clone and build OpenVPN (or use OpenVPN 2.6+). For example:
36
+
37
+    git clone https://github.com/openvpn/openvpn.git
38
+    cd openvpn
39
+    autoreconf -vi
40
+    ./configure --enable-dco
41
+    make
42
+    sudo make install # Or just run src/openvpn/openvpn
43
+
44
+When starting openvpn it will automatically detect DCO support and use the
45
+kernel module. Add the option `--disable-dco` to disable data channel offload
46
+support. If the configuration contains an option that is incompatible with
47
+data channel offloading, OpenVPN will automatically disable DCO support and
48
+warn the user.
49
+
50
+Should OpenVPN be configured to use a feature that is not supported by ovpn-dco
51
+or should the ovpn-dco kernel module not be available on the system, you will
52
+see a message like
53
+
54
+    Note: Kernel support for ovpn-dco missing, disabling data channel offload.
55
+
56
+in your log.
57
+
58
+
59
+DCO and P2P mode
60
+----------------
61
+DCO is also available when running OpenVPN in P2P mode without `--pull` /
62
+`--client` option. P2P mode is useful for scenarios when the OpenVPN tunnel
63
+should not interfere with overall routing and behave more like a "dumb" tunnel,
64
+like GRE.
65
+
66
+However, DCO requires DATA_V2 to be enabled, which is available for P2P mode
67
+only in OpenVPN 2.6 and later.
68
+
69
+OpenVPN prints a diagnostic message for the P2P NCP result when running in P2P
70
+mode:
71
+
72
+    P2P mode NCP negotiation result: TLS_export=1, DATA_v2=1, peer-id 9484735, cipher=AES-256-GCM
73
+
74
+Double check that you have `DATA_v2=1` in your output and a supported AEAD
75
+cipher (AES-XXX-GCM or CHACHA20POLY1305).
76
+
77
+
78
+Routing with ovpn-dco
79
+---------------------
80
+The ovpn-dco kernel module implements a more transparent approach to
81
+configuring routes to clients (aka "iroutes") and consults the main kernel
82
+routing tables for forwarding decisions.
83
+
84
+- Each client has a VPN IPv4 and/or a VPN IPv6 assigned to it;
85
+- additional IP ranges can be routed to a client by adding a route with
86
+  a client VPN IP as the gateway/nexthop (i.e. ip route add a.b.c.d/24 via
87
+  $VPNIP);
88
+- due to the point above, there is no real need to add a companion `--route` for
89
+  each `--iroute` directive, unless you want to blackhole traffic when the
90
+  specific client is not connected;
91
+- no internal routing is available. If you need truly internal routes, this can
92
+  be achieved either with filtering using `iptables` or using `ip rule`;
93
+- client-to-client behaviour, as implemented in userspace, does not exist:
94
+  packets always reach the tunnel interface and are then re-routed to the
95
+  destination peer based on the system routing table.
96
+
97
+
98
+Limitations by design
99
+----------------------
100
+- Layer 3 (dev tun) only;
101
+- only the following AEAD ciphers are currently supported: Chacha20-Poly1305
102
+  and AES-GCM-128/192/256;
103
+- no support for compression or compression framing:
104
+  - see also the `--compress migrate` option to move to a setup without
105
+    compression;
106
+- various features not implemented since they have better replacements:
107
+  - `--shaper`, use tc instead;
108
+  - packet manipulation, use nftables/iptables instead;
109
+- OpenVPN 2.4.0 is the minimum version required for peers to connect:
110
+  - older versions are missing support for the AEAD ciphers;
111
+- topology subnet is the only supported `--topology` for servers;
112
+- iroute directives install routes on the host operating system, see also
113
+  Routing with ovpn-dco.
114
+
115
+
116
+Current implementation limitations
117
+-------------------
118
+- `--persist-tun` not tested;
119
+- IPv6 mapped IPv4 addresses need Linux 5.4.189+/5.10.110+/5.12+ to work;
120
+- some incompatible options may not properly fallback to non-dco;
121
+- no per client statistics. Only total statistics available on the interface.
... ...
@@ -91,3 +91,16 @@ used when debugging or testing out special usage scenarios.
91 91
   *(Linux only)* Set the TX queue length on the TUN/TAP interface.
92 92
   Currently defaults to operating system default.
93 93
 
94
+--disable-dco
95
+  Disables the opportunistic use of data channel offloading if available.
96
+  Without this option, OpenVPN will opportunistically use DCO mode if
97
+  the config options and the running kernel supports using DCO.
98
+
99
+  Data channel offload currently requires data-ciphers to only contain
100
+  AEAD ciphers (AES-GCM and Chacha20-Poly1305) and Linux with the
101
+  ovpn-dco module.
102
+
103
+  Note that some options have no effect or cannot be used when DCO mode
104
+  is enabled.
105
+
106
+  On platforms that do not support DCO ``disable-dco`` has no effect.
... ...
@@ -325,6 +325,12 @@ fast hardware. SSL/TLS authentication must be used in this mode.
325 325
   from the kernel to OpenVPN. Once in OpenVPN, the ``--iroute`` directive
326 326
   routes to the specific client.
327 327
 
328
+  However, when using DCO, the ``--iroute`` directive is usually enough
329
+  for DCO to fully configure the routing table. The extra ``--route``
330
+  directive is required only if the expected behaviour is to route the
331
+  traffic for a specific network to the VPN interface also when the
332
+  responsible client is not connected (traffic will then be dropped).
333
+
328 334
   This option must be specified either in a client instance config file
329 335
   using ``--client-config-dir`` or dynamically generated using a
330 336
   ``--client-connect`` script.