Skip to content

OpenVPN

Getting started

Connect to any OpenVPN protocol-compatible server or service.

References



  1. Select version

    openvpn 2.x

    Install

    Terminal window
    sudo apt install openvpn -y
  2. Make directory

    Terminal window
    mkdir -p /etc/openvpn/profile && cd /etc/openvpn/profile
  3. Modify .ovpn files

    Terminal window
    nano server1-tcp80.ovpn
    server1-tcp80.ovpn
    # Comment out the line below
    # setenv opt block-outside-dns
    # Add after `route 0.0.0.0 0.0.0.0`
    setenv PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    script-security 2
    up /etc/openvpn/update-resolv-conf
    down /etc/openvpn/update-resolv-conf
    down-pre
  4. Modify update-resolv-conf

    Terminal window
    nano /etc/openvpn/update-resolv-conf
    update-resolv-conf
    # Add after examples
    # Add as many as you like, replace ip address
    foreign_option_1='dhcp-option DNS 208.67.222.222'
    foreign_option_2='dhcp-option DNS 208.67.222.220'
    foreign_option_3='dhcp-option DNS 146.112.128.66'
  5. Create auth.txt

    Terminal window
    nano auth.txt
    auth.txt
    # Edit username and password
    username
    password
  6. Connect

    Terminal window
    sudo openvpn --config /etc/openvpn/profile/server1-tcp80.ovpn
  7. Kill

    Terminal window
    sudo killall openvpn