Connecting to IPVanish from your Raspberry Pi

In this guide, we will show you how to connect to the IPVanish VPN service from your Raspberry Pi.

Raspberry Pi IPVanish

IPVanish is one of the most popular VPN services and is considered one of the best alongside Surfshark, NordVPN, and ExpressVPN.

It is known for both its privacy and security. IPVanish has support for some of the latest VPN and encryption technologies.

Additionally, they have a strict zero-logs policy. This means that IPVanish will never store anything that could be used to identify you.

Using a service like IPVanish on your Raspberry Pi helps ensure that you can remain private on the internet.

The entirety of IPVanish’s stack is managed by themselves, from app development to customer support. This ensures that no outside vendor can somehow gain access to your information.

Additionally, IPVanish has committed to not throttling your connection through any of their 1,500+ VPN servers.

Affiliate link disclaimer: All the products I mention on this website I have personally purchased and used at least once. Some of the links on this website are affiliate links that earn me a small commission whenever a sale is made.

Equipment List

Below is the equipment that you will need to connect to the IPVanish VPN on your Raspberry Pi

Recommended

Optional

Before proceeding for this tutorial, make sure that you have signed up for an IPVanish account. You will need a username, password, and an active subscription to connect to their network.

Installing OpenVPN for IPVanish

To connect to IPVanish, we will make use of the OpenVPN software.

OpenVPN is a popular VPN client known for its robust security and has become an industry-standard alongside WireGuard.

1. Before we start setting up our Raspberry Pi to connect to IPVanish, we need to make sure our operating system is up to date.

As we are running Raspberry Pi OS, we can run the following two commands to update the system.

sudo apt update
sudo apt full-upgrade

2. With the system up to date, we can now proceed to install the OpenVPN client.

This client is what will allow us to connect to IPVanish’s VPN from our Raspberry Pi.

We will also be installing the unzip package. This package will allow us to extract all of the config files from IPVanish on to our device.

You can install these required packages by running the following command.

sudo apt install openvpn unzip

Setting up IPVanish on the Raspberry Pi

Now that we have the required OpenVPN client installed to our Raspberry Pi, we can now get the configuration files we need.

1. Our first task is to move into the openvpn directory on our Raspberry Pi by using the cd command.

This directory is where we will be downloading and extracting the required files shortly.

cd /etc/openvpn

2. To make the process easier, IPVanish has provided an easy way of getting all the required files.

We can download the IPVAnish OpenVPN files directly from the network’s website by running the following command on our Raspberry Pi.

sudo wget https://configs.ipvanish.com/simpleconf/configs.zip

3. With the IPVanish config files now saved to our Raspberry Pi, we need to extract them now.

We can extract the OpenVPN files by running the following command.

sudo unzip configs.zip

4. Now that we have extracted the config files to our Raspberry Pi, we can now delete the archive.

We can use the rm command to delete the file from our device.

sudo rm configs.zip

5. Now that we have all the files extracted, we can view them by using the ls command.

By using the ls command, we can list out all of the files in the present directory.

ls

Using the list of files provided from the command, you can see what IPVanish server you want your Raspberry Pi to connect to.

For example, if we wanted to connect to an Australian based server, we could select a file as we have below.

ipvanish-AU-Melbourne-mel-a01.ovpn

Whichever file you choose, make a note of its filename as you will use this to connect to that server.

6. Now that we have the OVPN files we need, we can now connect to the IPVanish VPN.

To connect to the VPN, we can run the following command to get OpenVPN to run our file.

Make sure that you replace IPVANISH_OVPN_FILE, with the name of the file that you got in the previous step.

sudo openvpn IPVANISH_OVPN_FILE

For example, to connect to our Melbourne based IPVanish server from our Raspberry Pi, we can use the following command.

sudo openvpn ipvanish-AU-Melbourne-mel-a01.ovpn

7. Upon connecting to the IPVanish VPN, you will be asked to enter your username and password.

OpenVPN requires these credentials to be able to connect to the IPVanish network.

8. At this point, you should now be successfully connected to the IPVanish VPN from your Raspberry Pi.

9. If you want to disconnect from IPVanish, then there are two different ways you can achieve this.

If you still have the terminal session open, you can kill the currently running application by pressing CTRL + C.

Alternatively, it is possible to kill all currently running OpenVPN processes by using the following command.

sudo killall openvpn

Connecting to IPVanish at Startup

Within this section, we will be showing you how to get your Raspberry Pi to connect to IPVanish when it powers on.

Before continuing you will need an IPVanish account to connect to their VPN.

1. For our Pi to connect to the IPVanish VPN on start-up we need to create an auth file.

This authentication file will store both the username and password for your account. We will modify the .ovpn file so that it uses the credentials stored in this file.

Run the following command to use the nano text editor to start creating an auth.txt file.

sudo nano /etc/openvpn/auth.txt

2. Within this file, you are required to enter both the username and password for your IPVanish account.

The username and password should be separated into two lines.

The first line needs to be your username.
The second line should be your account’s password.

USERNAME
PASSWORD

3. With the authentication details entered, save the file by pressing CTRL + X, followed by Y, then the ENTER key.

4. For this step, you will need to have an OVPN file ready. You should have gotten the name of one in the previous step.

You can always list out the available file again by using the ls command.

We will need to make a copy of this file as we need to change its filename slightly so that it ends with .conf.

For example, if we took the file earlier ipvanish-AU-Melbourne-mel-a01.ovpn we would name it, so the file is called ipvanish-melb.conf.

sudo cp /etc/openvpn/ipvanish-AU-Melbourne-mel-a01.ovpn /etc/openvpn/ipvanish-melb.conf

5. Once you have changed the files extension to .conf you can now edit it using nano by running the following command.

Make sure you replace the filename with whatever you set in the previous step.

sudo nano /etc/openvpn/ipvanish-melb.conf

6. Within this config file, you need to find and modify the following line.

You can find this line easier by using CTRL + W within nano.

auth-user-pass

You need to replace this line with the following text so that it references the auth file we created.

auth-user-pass auth.txt

7. With that line modified, save the file by pressing CTRL + X, then Y, followed by the ENTER key.

8. Now we need to modify OpenVPN’s default configuration so that it will connect to our IPVanish VPN.

Begin editing the config file by using the command below.

sudo nano /etc/default/openvpn

9. In this file, we need to modify the following line.

#AUTOSTART="all"

Replace that line with the following text. This text tells it to load in the file with the name ipvanish-melb (Without extention).

AUTOSTART="ipvanish-melb"

Make sure that you replace ipvanish-melb with the filename you used earlier. Make sure you don’t include the .conf part of the filename.

10. Once you have finished making changes to the file, save them by pressing CTRL + X, followed by Y, then ENTER.

11. Our next step is to enable the OpenVPN service by using the command below.

By enabling the service, it will start when the Raspberry Pi boots and will automatically begin connecting to IPVanish.

sudo systemctl enable openvpn

12. We can now confirm that everything is working by restarting our Raspberry Pi.

Restart the device by running the following command.

sudo reboot

Once you Raspberry Pi finishes restarting, it should now automatically try to connect to the IPVanish VPN.

12. You can check that the public IP address of your Raspberry Pi is now different by running the following command.

curl ifconfig.me

This command works by using curl to fetch the public IP address from the website ifconfig.me.

Preventing DNS Leaks with IPVanish

AN issue that can occur when using any VPN on a device like the Raspberry Pi is that the DNS servers leak your IP address.

ISP DNS servers are notorious for this behavior, so in this section, we are going to show you a solution.

1. To resolve this issue, we will change the DNS servers that our Raspberry Pi is using.

To do this, we need to modify the dhcpcd configuration file by using the following command.

sudo nano /etc/dhcpcd.conf

2. Within this file, we need to find the following line.

This line defines the domain name servers that the host should use for DNS lookups.

You can use CTRL + W to search for text within the file.

#static domain_name_servers=192.168.0.1

Replace this line with the following. This line will tell the host to lookup DNS requests using Cloudflare’s DNS service (1.1.1.1)

static domain_name_servers=1.1.1.1

3. With the DNS changes made, save the file by pressing CTRL + X, followed by Y, then ENTER.

4. The easiest way to ensure that all applications are using the new DNS server we should restart the Raspberry Pi.

To reboot the device, run the following command.

sudo reboot

5. When your Raspberry Pi finished rebooting, you can use a service like ipleak.net to check if your IP address is being leaked.

This service works by performing a few different tests to see if it can find a different IP using different protocols.

You should now have your Raspberry Pi successfully connected to the IPVanish VPN service.

Feel free to leave a comment below if you have any feedback or have found any issue with getting connected to IPVanish.

Be sure to also explore some of our Raspberry Pi torrent box tutorials, as well as our Raspberry Pi proxy guide, both pair well with IPVanish.

9 Comments

  1. Avatar for cora
    cora on

    Hi, thanks for this guide. One small update to the `sudo wget [url]` command for the configs.zip. I received 301 moved but navigating to a browser redirects automatically, so I was able to grab the updated URL and use `sudo wget [updatedUrl]`.

    As of this comment, the updated URL is `https://configs.ipvanish.com/simpleconf/configs.zip`

    Hope this helps, and thanks again for the guide.

    1. Avatar for cora
      cora on

      One other update: I received an error when trying to connect to one of the vpn servers.

      “`
      ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such device (errno=19)
      Exiting due to fatal error
      “`

      I resolved by running `sudo reboot` after installing the openVPN files and then retrying the `openvpn` command with one of the vpn files in /etc/openvpn.

    2. Avatar for Emmet
      Emmet on
      Editor

      Hi Cora,

      Thank you for pointing out these issues that you were running into and the solution for them.

      I have updated the wget command so that it points to the new corrected URL.

      Cheers,
      Emmet

  2. Avatar for Silviu Codreanu
    Silviu Codreanu on

    You were right ! Before typing Ctrl + C, I opened a web page and asked for the ip. It was different. OK. Thanks.

  3. Avatar for Silviu Codreanu
    Silviu Codreanu on

    Aha, ok, I get it. Thanks. Thank U & Best regards !

  4. Avatar for Silviu Codreanu
    Silviu Codreanu on

    Hello Emmet,
    Thank U for your answer.
    I did not know what to do. Your answer made me try again.
    I entered the command sudo openvpn ipvanish-RO-Bucharest-otp-c01.ovpn, it asked for my credentials, I entered them, “… Initialization Sequence Completed” appeared, then I gave Ctrl + C. I entered the httpl // ipinfo.io / ip curl command and received the same coordinates as when I was not using vpn. Something is not working. Anyway, thank you very much for the answer. If I think about it, it’s the first time I’ve received an answer like this (I didn’t specify but this is a hobby for me, I work as an economist). I think I’ll take a few hours from a programmer. Once again, thank you very much. Merry Christmas and Happy New Year !

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Silviu,

      When you press CTRL + C you are terminating the currently running program, so you would be shutting down the VPN tunnel.

      The best way to test this would be to open another terminal session without closing the original one then making use of the command to check the coordinates have in fact changed.

      You can also run the command and add an ampersand (&) to the end of it to cause the terminal to run it asynchronously. The problem with doing that is that until you modify the .ovpn file you will need to enter your authentication details every time you run the command and running it asynchronously won’t allow you to do that.

      The Connecting to IPVanish at Startup section of the tutorial will show you how you can modify the .ovpn file you downloaded so that you aren’t required to enter the credentials everytime you launch the VPN.

      I hope this helps you out with getting IPVanish running on your Raspberry Pi.

      Merry Christmas and Happy new year to you to!

      Cheers,
      Emmet

  5. Avatar for Silviu Codreanu
    Silviu Codreanu on

    Hello,
    I followed the instructions and here:
    ipvanish-RO-Bucharest-otp-c01.ovpn
    I received an error message:

    command not found !

    Could you give me a hint to overpass the issue ?
    Thank you and best regards,
    Silviu Codreanu

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Silviu,

      So it looks like you have just tried typing in the filename without the actual command.

      In your case you should end up running something like the following

      sudo openvpn ipvanish-RO-Bucharest-otp-c01.ovpn

      Cheers,
      Emmet

Leave a Reply

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