wiki:328-route-and-route-ipv6-in-ccd-files

--route and --route-ipv6 can not currently be used in ccd/ (--client-config-dir) config files.

There is no fundamental reason this is so, it's just that it is not easy to implement, and the normal use case can be handled more flexibly using a --learn-address script that will be called on client-connect / client-disconnect with the information from --iroute/--iroute-ipv6 so it can setup routing.

A very basic script could look like this:

#!/bin/bash

add_del="$1"
route="$2"
cname="$3"

case "$route" in
        *:*) six=-6 ;;
        *)   six="" ;;
esac

if [ -n "$dev" ]
then
  device="dev $dev"
else
  device=""
fi

ip $six route "$add_del" "$route" $device

(taken from Samuel Thibault's posting to the openvpn-devel list about this question, http://article.gmane.org/gmane.network.openvpn.devel/11129)

If connecting over UDP, it's recommended to add --explicit-exit-notification to the client config so disconnect notice is quicker.

If you're asking what the typical use case is: think of a client subnet that needs to be routed to a given client, and there are multiple OpenVPN servers that the client can connect to (multiple ports, or even multiple machines for failover). So the "route this network to my tun interface" logic needs to be dynamic on client connect...

Last modified 8 years ago Last modified on 02/10/16 12:43:33