How To Set Up and Use Surfshark on Raspberry Pi (Updated 2022)
The Raspberry Pi Foundation is in charge of making the Raspberry Pi. It is a series of single-board computers that you can use for all sorts of projects. It has all its components on a single circuit board, including the CPU, GPU, USB ports, RAM, and other necessary components. Using a VPN on the Raspberry Pi protects you from bad actors whenever you connect to the internet. This article dwells on how you can set up and use Surfshark, a premium VPN service, on Raspberry Pi.
Setting Up Surfshark on Raspberry Pi
There is no simple method to set up and use Surfshark on Rasberry Pi. Surfshark does not have a native application for the Raspberry Pi OS. However, you can use Surfshark’s application if you install an operating system it supports. Below, we look at two ways you can set up and use Surfshark on Raspberry Pi OS.
1. Setting it up manually with OpenVPN.
2. Setting it up through a router.
Get 81% off now
Setting Up a Connection Manually With OpenVPN
To set up a connection manually, you need to be familiar with the Linux CLI. Let’s look at the configuration process below.
1. First, you need a Surfshark subscription plan if you don’t have one. Go to Surfshark’s website and buy a subscription plan.
2. You also need to get your service credentials to log in to Surfshark from your Raspberry Pi. These credentials are different from your account credentials. Login to your Surfshark account, go to the setup section, find your service credentials under the “Credentials” tab, and note them.
3. Next, open a Terminal window and enter the commands below to ensure everything is up to date. Note that you need admin privileges to enter these commands.
sudo apt-get update
sudo apt-get upgrade
3. Now, you need to install the necessary packages needed to use OpenVPN to connect to a Surfshark server. Enter the command below to install OpenVPN and unzip.
sudo apt-get install openvpn unzip
4. Then, you need to go to the OpenVPN directory on the Terminal window. Enter the command below to change to the directory.
5. You can now download Surfshark’s OpenVPN configuration files into that directory. Enter the command below to download it.
6. The next thing you need to do is to unzip the OpenVPN configuration files you just downloaded on your Raspberry Pi. Enter the command below to extract the files.
sudo unzip configurations
7. Since you don’t need the zip file again, you can remove it. Enter the command below to do that.
sudo rm configurations
8. Next, enter the command below to see all the files you just extracted. These files are OpenVPN configuration files of the servers you can use. So you need to identify the server you want to use and note the name of the file.
For example, the file name will look like the one below. Note that you can use either UDP or TCP, so look out for that in the name of the files.
9. To connect to a server you intend to use, enter the command below (replace [Filename] with the name of the file)
sudo openvpn [Filename]
For example, sudo openvpn us-dal.prod.surfshark.com_udp.ovpn will open a connection to a Surfshark server in Dallas, US using UDP.
10. You will need to enter your Surfshark service credentials (check step 2 above) for the connection to be successful.
11. You should see an “Initialization Sequence Completed” message once the connection to the server is successful. Note that once you close the terminal window, your connection closes too.
Setting Up Surfshark to Start at Boot on Raspberry Pi
Configuring your Raspberry Pi to connect to Surfshark as soon as it boots up saves you the stress of having to open a terminal window each time you want to connect to a server. Let’s look at the configuration process below.
1. First, you need to create a file to store your Surfshark service credentials. Enter the command below to use nano (a text editor) to create and edit the file.
sudo nano /etc/openvpn/auth.txt
2. Enter your Surfshark service password on the first line and the username on the second line. Use CTRL + X, then Y, and Enter to save the file.
3. Next, you need to copy the contents of the OpenVPN configuration file of the server you intend to use and name the copy with a different extension. For example, we will use Surfshark’s Dallas server below.
sudo cp /etc/openvpn/us-dal.prod.surfshark.com_udp.ovpn /etc/openvpn/us-dal.conf
4. Then, you need to modify the contents of the .conf file to use the authentication file you created in step 1 above. Enter the command below to change it, look for the “auth-user-pass” line, and replace it with the auth file (auth.txt) in step 1 above. Then, use CTRL + X, then Y, and Enter to save the file.
sudo nano /etc/openvpn/us-dal.conf
5. Next, you need to change the OpenVPN default to connect to Surfshark. Enter the command below to edit the file.
sudo nano /etc/default/openvpn
6. Look for the line below.
7. Replace it with the line below and save the file using CTRL + X, then Y and Enter. Note that if your file name is different, it will end with a different parameter.
8. Next, you need to enable the OpenVPN service so that the system will start OpenVPN at boot. Enter the command below.
sudo systemctl enable openvpn
9. Finally, reboot your Raspberry Pi using the command below.
Note that we used Surfshark’s Dallas server in the configuration above. If you use a different server, the parameters will change.
Setting Up a Connection Through a Router
Another alternative to set up and use Surfshark on Raspberry Pi would be to connect to a VPN router. Surfshark has made provision for a pre-configured router that comes with Surfshark installed on it. You can purchase one here. However, if you cannot afford a pre-configured router, you can use an existing VPN-compatible router or buy a cheaper one and configure it. Let’s look at the steps below to configure a DD-WRT router.
1. You need to get your service credentials to log in to Surfshark from your router. Login to your Surfshark account, go to the setup section, find your service credentials under the “Credentials” tab, and note them.
2. Next, switch to the “Locations” tab beside the “Credentials” tab to copy the hostname of the server you intend to use.
3. Next, you need access to the configuration panel of your router. You can do this by inputting the IP address of the router on a web browser. If you don’t know the IP address, you can check your router’s user manual. The default for most routers is usually 192.168.1.1 or 192.168.0.1.
4. Then, you need to log in to the configuration panel using your administrative credentials. Normally, the default for most routers is “admin” as username and password.
5. Next, you need to use Surfshark’s DNS servers to avoid DNS leaks. Go to your configuration panel, and click on the “Setup” tab. Then move down to the “Network Address Server Settings (DHCP)” section and enter the information below in their respective fields.
Static DNS 1 = 22.214.171.124
Static DNS 2 = 149.254.259.92
Static DNS 3 = 0.0.0.0 (leave as it is)
Use DNSMasq for DHCP = Check this box
Use DNSMasq for DNS = Check this box
DHCP-Authoritative = Check this box
Then, click the “Save” and “Apply Settings” tabs.
6. Next, select the “Services” tab at the top. Below it, select the “VPN” tab. Under the “OpenVPN Client” section, select “Enable.”
7. Below the expanded “OpenVPN Client” section, enter the information below.
Server IP/Name: Input the server hostname you selected in step 3 above;
Tunnel Device: TUN;
Tunnel Protocol: UDP (or TCP);
Encryption Cipher: None;
Hash Algorithm: SHA-512;
User Pass Authentication: Enable;
Username: Input your Surfshark service username (check step 1 above);
Password: Input your Surfshark service password (check step 1 above);
Advanced Options: Enable;
TLS Cipher: None;
LZO Compression: Disabled;
Don’t change any other fields. In addition, if the Username and Password field is missing from the above settings, move on to the next step. Otherwise, jump to step 9.
8. Navigate to the “Administration” tab and input the commands below in the “Commands” section.
echo “USERNAME PASSWORD” > /tmp/openvpncl/user.conf/usr/bin/killall openvpn/usr/sbin/openvpn –config /tmp/openvpncl/openvpn.conf –route-up /tmp/openvpncl/route-up.sh –down-pre /tmp/openvpncl/route-down.sh –daemon
Note that you have to replace USERNAME and PASSWORD above with your Surfshark service username and password, respectively. Then, click “Save Startup” and go back to the VPN tab. Add the line below to the “Additional Config” field.
9. Enter the commands below in the “Additional Config” field.
10. Next, copy and paste the certificate below in the “CA Cert” field.
11. Next, copy and paste the Static key below to the “TLS Auth Key” field.
—–BEGIN OpenVPN Static key V1—–
—–END OpenVPN Static key V1—–
12. Now, click the “Save” button, then the “Apply Settings” button.
13. To verify the router is connected to a Surshark server, head over to the “Status” section and click on the “OpenVPN” tab. Under the “State” section, you should see a “CONNECTED SUCCESS” message.
14. Now, all you need to do on your Raspberry Pi is to connect to the router’s network and Surfshark protects you online.
Get 81% off now
Advantages of Using Surfshark on Raspberry Pi
Below, we look at the advantages of using Surfshark on Raspberry Pi.
1. Online Protection
Surfshark protects you online from all sorts of spying entities. It is essential you use this VPN to protect yourself, except you don’t intend to use your Raspberry Pi to access the internet. Its military-grade encryption, together with other security features, ensure a tight security perimeter.
2. Bypass Censorship and Geo-Restriction
With all sorts of restrictions on the internet, especially in areas of ongoing internet censorship, you need Surfshark to give you unregulated access. In addition, Surfshark does an excellent job of unblocking websites that use geo-restriction technology to keep you away.
As long as you connect the Raspberry Pi to the internet, you are at risk of being a target to malicious entities. While Surfshark does not have a custom application for the Raspberry Pi, its support for the OpenVPN protocol allows for manual configurations. We hope this article helps you set up Surfshark on your Raspberry Pi.