openvpn point-to-point server listening both on v4 and v6

at work i have openvpn between OVH dedicated server and our datacenter. due to varying bandwidth we sometimes use udp over ipv6 and sometimes over ipv4 as an encapsulation method. whenever we did the switch we always had to reconfigure both ends of the tunnel. it turns out that with recent openvpns and kernels it’s possible to have single server config that listens on both v4 and v6.

on the server side i used to reconfigure from:

local 2001:1122:1:123::2
port 1234
proto udp6

to

local 123.45.67.89
port 1234
proto udp

and on the client side from:

remote 2001:1122:1:123::2 1234
proto udp

to

remote 123.45.67.89 1234
proto udp

with recent kernels [ >=3.15] , using openvpn >2.3.1 it’s possible to have the server listen on both v4 and v6. so my new server code includes:

# there's no more listen here!
port 1806
multihome
proto udp6

and client has either:

remote 123.45.67.89 1234 udp

or

remote 2001:1122:1:123::2 1234 udp6

one thing less to edit in the middle of the night : ]

helpful resources: https://community.openvpn.net/openvpn/ticket/306

Leave a Reply

Your email address will not be published. Required fields are marked *

(Spamcheck Enabled)