How to Setup Surfshark on the Raspberry Pi?

Setting up a VPN on a Raspberry Pi is a great way to enhance your privacy and security when browsing the internet. Surfshark is a popular, user-friendly VPN service that offers fast connection speeds and Works on multiple devices. In this guide, we’ll walk through the entire process of installing and configuring Surfshark on a Raspberry Pi.

How to Setup Surfshark on the Raspberry Pi?


Before we get started, you’ll need the following:

  • A Raspberry Pi – any model will work. The instructions in this guide are based on the Raspberry Pi OS.
  • A microSD card with Raspberry Pi OS installed.
  • A monitor, keyboard, and mouse for initial setup.
  • A Surfshark subscription.
  • A strong broadband internet connection.

Step 1 – Configure Raspberry Pi OS

Once you have Raspberry Pi OS installed on your microSD card, insert it into the Pi and connect the keyboard, monitor, and mouse. Boot it up and run through the initial configuration prompts:

  • Set your locale, time zone and password.
  • Enable SSH so you can access the Pi remotely.
  • Connect the Pi to your wifi network.
  • Update the OS packages.

sudo apt update

sudo apt full-upgrade

  • Reboot the Pi to complete the setup.

At this point, you should now be able to SSH into your Pi from another device on the same network using its IP address.

Step 2 – Install Surfshark

Surfshark provides an official Debian package to simplify the installation process on Linux devices like the Raspberry Pi.

First, SSH into your Pi and import Surfshark’s GPG key:

wget -qO – | sudo apt-key add –

Next, add the Surfshark repository:

echo ‘deb stable main’ | sudo tee /etc/apt/sources.list.d/surfshark.list

Update and install the Surfshark package:

sudo apt update

sudo apt install surfshark

The installer will prompt you to enter your Surfshark credentials – the email and password for your Surfshark account.

Once the installation completes, Surfshark is ready to use on your Pi!

Step 3 – Connect to Surfshark

With Surfshark installed, connecting to the VPN is easy. Just run:

sudo surfshark connect

This will connect your Pi to the fastest Surfshark server based on your location.

To check your new IP address and confirm you’re connected:


The IP address shown should now match Surfshark’s server location.

By default, Surfshark will automatically connect on reboot. To disable this:

sudo surfshark autostart disable

You can also specify a particular server location instead of the fastest recommendation:

sudo surfshark connect -l Netherlands

See surfshark –help for additional connection options.

Step 4 – Set Up the Kill Switch (optional)

The Surfshark kill switch blocks all internet access if the VPN connection drops for any reason. This prevents accidental exposure of your real IP address.

To enable the kill switch, first install the iptables-persistent package:

sudo apt install iptables-persistent

Then run:

sudo surfshark killswitch enable

The kill switch will now activate when using the VPN. To disable it again in the future:

sudo surfshark killswitch disable

Using Surfshark on the Pi

With Surfshark installed and connected, all internet traffic from your Raspberry Pi will now be routed through the encrypted VPN tunnel.

Here are some tips for using Surfshark effectively on your Pi:

  • Setup Pi-hole to benefit from Surfshark’s ad-blocking capabilities.
  • Access geo-restricted streaming content by connecting to servers in other countries.
  • Enhance security for IoT devices by routing them through the Pi’s VPN connection.
  • Maintain privacy for P2P torrenting by binding torrent clients to the VPN.
  • Use it as a secure gateway for accessing your home network while away.

Adjust the auto-connect and kill switch options to suit your needs. Switch locations periodically if you need to access region-specific websites.

Overall, Surfshark provides an easy, fast and secure way to route all your Raspberry Pi’s internet traffic through an encrypted tunnel. With it properly configured, you can browse freely and privately from your Pi.

Troubleshooting Issues

In some cases, you may encounter issues getting Surfshark working properly on your Pi. Here are some troubleshooting steps to try:

Cannot connect: Verify your Surfshark credentials are correct. Check your internet connection. Restart the Surfshark service with sudo systemctl restart surfshark.

Slow speeds: Try different Surfshark server locations to find a faster one. Consider upgrading your Pi’s CPU and RAM. Set up the Pi with a wired ethernet connection if possible.

Webpages not loading: Ensure the kill switch is not blocking sites when disconnected. Add exceptions to the kill switch as needed.

Leak detected: Double check that the VPN connects on boot and the kill switch is enabled. Bind programs explicitly to the VPN interface.

Buffering when streaming: Change to a Surfshark server closer to the content provider. Adjust streaming quality settings. Add more RAM to handle higher throughput.

Cannot access RasPi config: Temporarily disable the VPN with sudo surfshark disconnect to access the Pi’s settings.

For additional troubleshooting tips, check Surfshark’s setup guides and help center.


Installing Surfshark on a Raspberry Pi provides an easy way to route all your network traffic through an encrypted VPN tunnel. Following this guide, you can get up and running with Surfshark on your Pi in just a few quick steps.

With Surfshark active on your Raspberry Pi, you can securely access the internet, connect to geo-restricted content, download torrents privately, and add encryption to your IoT devices. Combined with Pi-hole for ad-blocking, you have an excellent privacy package in just one tiny device!


  1. What are the benefits of using Surfshark on a Raspberry Pi?
    Some key benefits include enhanced privacy and security, access to geo-restricted content, secure remote access to your home network, and protecting IoT devices on your network.

  2. Does Surfshark slow down the Raspberry Pi?
    Surfshark is optimized to have minimal impact on performance. But connecting over VPNs will increase latency slightly. Using a wired ethernet connection can help maximize speeds.

  3. Can I automate connecting to different Surfshark locations?
    Yes, you can create scripts that connect to specified locations and switch servers automatically as needed.

  4. Do I need to keep my Pi powered on all the time to use Surfshark?
    Yes, your Pi needs to stay on to route traffic through Surfshark. Enabling auto-connect will ensure it starts on reboot.

  5. Can I use Surfshark on a Pi without a monitor attached?
    Absolutely! Once initial setup is complete, you can access and control your Pi entirely through SSH.

  6. Can I torrent safely using Surfshark on my Pi?
    Yes, binding your torrent client to the Surfshark VPN interface will encrypt all P2P activity and hide your IP address.

  7. Does Surfshark protect my Pi from malware and attacks?
    Surfshark encrypts your traffic but does not provide endpoint protection. Use a firewall and anti-virus software as well.

  8. How many devices can use one Surfshark account?
    Surfshark allows unlimited simultaneous device connections with one account.

  9. What troubleshooting can I try if Surfshark stops working?
    Restart the Surfshark service, verify credentials, check internet connection, switch server locations, and check the kill switch.

  10. Can I access my Pi’s GPIO pins with Surfshark enabled?
    Yes, Surfshark routes only internet traffic through the VPN. Local network access to the GPIO pins will still work normally.

  11. Is it safe to enable Surfshark’s kill switch feature?
    Yes, the kill switch is designed to only block external internet access, not local network services. But test first before relying on it.

  12. Does Surfshark offer split-tunneling on Linux?
    Unfortunately no, split tunneling is not currently supported on Linux clients. All traffic will be routed through the VPN.

  13. Can I have multiple VPNs installed on my Raspberry Pi?
    Yes, you can install and use multiple VPN services simultaneously on a Pi by configuring each in a separate profile.

  14. How can I monitor bandwidth usage through Surfshark on my Pi?
    You can use iftop or vnstat to monitor bandwidth. Surfshark’s apps also show connection data usage.

  15. Does using Surfshark on my Pi slow down gaming performance?
    Connecting over a VPN adds a small amount of latency which may impact gaming performance. Try connecting to gaming-optimized servers to reduce ping times.

  16. Can I access my Pi remotely over Surfshark?
    Yes, you can access your Pi over SSH while connected to Surfshark. Just port forward SSH on your router to your Pi.

  17. How do I uninstall or remove Surfshark from my Pi?
    Run sudo apt remove surfshark to uninstall. Then delete the repo file at /etc/apt/sources.list.d/surfshark.list.

  18. Does Surfshark work on a headless Raspberry Pi?
    Yes, Surfshark will work fine on a headless Pi as long as you can connect via SSH to install and configure it.

  19. Can I use WireGuard protocol on Surfshark for my Pi?
    Unfortunately no, the Linux Surfshark client currently only supports OpenVPN protocol, not the faster WireGuard.

  20. Is using Surfshark legal in my country?
    Check your local laws, as VPN legality varies by region. In general using VPNs is legal in most countries.

Leave a Comment