Setup guide

How to set up a VPN on Linux

WireGuard is part of the Linux kernel, so you only need the userspace tools and one config file. Desktop users can do it all from NetworkManager.

Before you start

About 5 minutes

  • Kernel 5.6 or later (any current Ubuntu, Debian, Fedora, Arch or Mint)
  • sudo rights to install packages and bring up interfaces
  • wireguard-tools, plus resolvconf or systemd-resolved for the DNS line
  • An active plan with a slot free for this machine

SwitchVPN works with free official apps and built-in system clients, so there is no SwitchVPN software to install or update on Linux.

sv-de

Frankfurt

interface
sv-de
endpoint
de-frankfurt.edge.switchvpn.shop:51820
latest handshake
8 seconds ago
allowed ips
0.0.0.0/0, ::/0

REJECT rule active

Illustration: a working Linux connection in Frankfurt. Your own values appear in the dashboard.

Recommended

Set up WireGuard with wg-quick

Works the same on servers and desktops. Interface names are limited to 15 characters, so keep file names short.

  1. Download the config

    Add the machine under Dashboard, VPN with WireGuard as the protocol, save the .conf and give it a short name such as sv-de.conf.

  2. Install the tools

    Ubuntu and Debian:

    sudo apt install wireguard-tools resolvconf
  3. On Fedora

    The equivalent package:

    sudo dnf install wireguard-tools
  4. Place the file and lock it down

    sudo install -m 600 sv-de.conf /etc/wireguard/sv-de.conf
  5. Bring the tunnel up

    sudo wg-quick up sv-de
  6. Check the handshake

    A recent handshake time means the server answered.

    sudo wg show
  7. Start at boot (optional)

    sudo systemctl enable --now wg-quick@sv-de

Option 2

Import into NetworkManager

Use this on GNOME, KDE and other desktops to toggle the VPN from the system menu.

  1. Import the config

    nmcli connection import type wireguard file sv-de.conf
  2. Connect from the panel

    The connection appears in the network menu as sv-de. Turn it on there, or run:

    nmcli connection up sv-de

Option 3

Use OpenVPN on Linux

For networks that block UDP, download the TCP 443 .ovpn and run it with the openvpn package.

  1. Install and run

    sudo apt install openvpn
    sudo openvpn --config sv-de-tcp.ovpn
  2. Or import it on the desktop

    With network-manager-openvpn installed:

    nmcli connection import type openvpn file sv-de-tcp.ovpn

Kill switch on Linux

wg-quick can reject every packet that does not leave through the tunnel. Add these two lines to the [Interface] section of your config; they are the rule from the wg-quick manual.

  1. Add PostUp and PreDown rules

    PostUp = iptables -I OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT
    PreDown = iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT
  2. Repeat for IPv6

    Add the same two lines with ip6tables in place of iptables.

  3. Restart the tunnel

    sudo wg-quick down sv-de
    sudo wg-quick up sv-de

The rules are removed when the tunnel is brought down on purpose, so you get normal internet back with wg-quick down.

Split tunneling on Linux

On Linux, split tunneling is controlled by the AllowedIPs line.

  1. Let the dashboard write it

    Tick Skip local network, or paste your own bypass list when adding the device, and download the new file.

  2. Or edit AllowedIPs yourself

    List only the networks that should use SwitchVPN. Everything else uses your normal connection.

How split tunneling works

Switch city on Linux

Keep one file per city and switch with two commands.

  1. Bring down the current city

    sudo wg-quick down sv-de
  2. Bring up the next one

    sudo wg-quick up sv-jp

Each file you keep ready is a separate device in the dashboard. Alternatively, move one device to a new city and replace its file.

Browse every server city

Linux VPN troubleshooting

resolvconf: command not found

wg-quick needs resolvconf (or openresolv) to apply the DNS line. Install it, or on systemd-resolved systems link resolvectl as resolvconf.

No handshake after wg-quick up

Check that outbound UDP 51820 is allowed by your firewall or cloud provider. If not, use the OpenVPN TCP 443 profile.

Interface name too long

Rename the file so the part before .conf is 15 characters or fewer.

SSH to the server dropped after connecting

Full-tunnel configs route replies through the VPN. On a remote server, exclude your own IP from AllowedIPs or use a config without default routing.

Linux setup questions

Do I need to compile anything?

No. Every current distribution ships WireGuard in the kernel; you only install wireguard-tools.

Can I run SwitchVPN on a headless server?

Yes, with wg-quick and a systemd unit. Remember the SSH routing note in troubleshooting before you bring it up remotely.

Is IKEv2 available on Linux?

strongSwan supports it, but WireGuard is simpler and faster on Linux, so the dashboard focuses on WireGuard and OpenVPN files there.

Plans that cover Linux

Basic

$2.51 a month

6 devices at once, $60.29 for 24 months

Plus

$3.64 a month

10 devices at once, $87.29 for 24 months

Pro

$6.22 a month

12 devices at once, $149.39 for 24 months

Compare all plan lengths

Guides for your other devices

Protect your Linux today

Top up with crypto, pick Basic, Plus or Pro, and your Linux setup is a few minutes away.