Your location: Your IP: Your status:ProtectedUnprotected · To the tests »

Cascading your VPN (Multi-Hop) with Linux

To download the updown.sh script using wget in a terminal use the following commands: cd /etc/openvpn/ and then sudo wget https://www.perfect-privacy.com/downloads/updown.sh, and afterwards make the file executable with chmod: sudo chmod +x /etc/openvpn/updown.sh.

Alternatively you can download the script here using the browser, save the file as updown.sh in your /etc/openvpn/ directory (requires root privileges, copy for example like sudo cp ~/Downloads/updown.sh /etc/openvpn/updown.sh) and then make it executable with sudo chmod +x /etc/openvpn/updown.sh.

If not done already, change into the /etc/openvpn/ directory and then issue the following command to establish the connection to the first hop. In this example a connection to london.perfect-privacy.com is established, hence the configuration file London.conf is used:

sudo openvpn --config London.conf --script-security 2 --route remote_host --persist-tun --up updown.sh --down updown.sh --route-noexec

If you haven’t configured the VPN configuration file to read your password from a file, as explained in the guide "OpenVPN in Linux Terminal", you will be asked to provide your Perfect Privacy username and password.
After the connection to the first hop has been established, the script will display the necessary command with all parameters to connect to the second hop. You can copy and paste this line but you have to prepend the sudo command to it and will need to exchange <config.conf> for the configuration file of the server desired for the next hop.
Adding a hop: Open a new terminal, change to the /etc/openvpn/ directory, type sudo   (followed by the SPACE key) and paste the connection line displayed by the script. Before you press the ENTER key though, make sure that you replace <config.conf> with the configuration of the location you want to connect to. In this example the second hop is rotterdam.perfect-privacy.com, so the configuration file Rotterdam.conf is used.
Once the connection is established you already have a cascaded VPN connection using two hops. The VPN connections are encrypted separately (tunnel in tunnel). The script will show the command for the next hop just like before.
To add a third hop, repeat the "Adding a hop" step in a new terminal window. Please note that every hop generates additional CPU load and possibly makes the connection more vulnerable regarding network instabilities (e.g. occurring routing issues).

In this example we’re continuing the cascade with reykjavik.perfect-privacy.com, so the configuration file Reykjavik.conf is used. If you want, you can add even more hops by repeating the "Adding a hop" step once more.

You can use our Check IP test also in the terminal to verify that the OpenVPN connection was established and is working correctly:

wget -q -O - https://checkip.perfect-privacy.com/csv
VPN
?!
This website uses cookies to analyze the traffic and to control our advertising. By using this site, you agree to the use of cookies. More information can be found in our privacy policy.