OpenVPN fails to register remote DNS server

Jul 16, 2016   #openvpn  #fix  #dns 

You are starting your OpenVPN client and constantly getting an error message:

openvpn --config myconfig.ovpn

openvpn Unrecognized option or missing parameter(s) in [PUSH-OPTIONS]:23: register-dns (2.3.2)

Also, remote DNS server is not registered in your /etc/resolv.conf.

To fix this:

  • add these lines to your OpenVPN config (myconfig.ovpn):

    up /etc/openvpn/update-resolv-conf                                                                                                                                     
    down /etc/openvpn/update-resolv-conf
  • add –script-security 2 as a parameter to OpenVPN:

    openvpn --config myconfig.ovpn --script-security 2