In this guide, we will show you how to connect to the IPVanish VPN service from your Raspberry Pi.
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.
Below is the equipment that you will need to connect to the IPVanish VPN on your Raspberry Pi
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.
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
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.
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://www.ipvanish.com/software/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.
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.
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
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.
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
We will need to make a copy of this file as we need to change its filename slightly so that it ends with
For example, if we took the file earlier
ipvanish-AU-Melbourne-mel-a01.ovpn we would name it, so the file is called
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.
You need to replace this line with the following text so that it references the auth file we created.
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/defaults/openvpn
9. In this file, we need to modify the following line.
Replace that line with the following text. This text tells it to load in the file with the name
ipvanish-melb (Without extention).
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.
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.
This command works by using curl to fetch the public IP address from the website
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.
Replace this line with the following. This line will tell the host to lookup DNS requests using Cloudflare’s DNS service (126.96.36.199)
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.
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.
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.