Linux setup

How to set up a VPN on Linux

WireGuard has been part of the Linux kernel since 5.6, so a MobileVPN tunnel is one config file and one command away on almost any distribution.

What you need

About 6 minutes, Any distribution with kernel 5.6 or later, or the WireGuard module installed

  • Kernel 5.6 or later, or the wireguard-dkms module on older kernels
  • sudo rights on the machine
  • An active MobileVPN plan with a free device slot
  • Outbound UDP 51820, or TCP 443 for OpenVPN

Pick a method

No MobileVPN software

Official WireGuard, OpenVPN or system clients only

Move city any time

Same slot, new file or code

Kill switch ready

Steps for this platform below

Recommended

WireGuard on Linux with wg-quick

wg-quick reads your file, sets up the interface, the routes and the DNS server in one step.

  1. Download the .conf

    Add the machine in Account, VPN, choose WireGuard and save the file, for example mv-tokyo.conf. Keep the name short with no spaces.

  2. Install the tools

    Ubuntu and Debian: sudo apt install wireguard. Fedora: sudo dnf install wireguard-tools. Arch: sudo pacman -S wireguard-tools.

  3. Place the file

    Copy it into /etc/wireguard with tight permissions.

    sudo install -m 600 mv-tokyo.conf /etc/wireguard/
  4. Bring the tunnel up

    Start it, then check for a recent handshake.

    sudo wg-quick up mv-tokyo
    sudo wg show
  5. Start at boot (optional)

    Let systemd start it on every boot.

    sudo systemctl enable --now wg-quick@mv-tokyo

Method 2

OpenVPN on Linux

Use OpenVPN on hosts behind firewalls that only allow outbound TCP 443.

  1. Download an .ovpn profile

    Choose OpenVPN when adding the device and pick UDP 1194 or TCP 443.

  2. Install OpenVPN

    sudo apt install openvpn, or the openvpn package of your distribution.

  3. Connect

    Run the client with your profile and leave the terminal open.

    sudo openvpn --config mv-tokyo.ovpn

Method 3

Import into NetworkManager (desktop)

On GNOME or KDE you can manage the WireGuard tunnel from the network menu instead of the terminal.

  1. Import the file

    NetworkManager 1.20 or later reads WireGuard configs directly.

    nmcli connection import type wireguard file mv-tokyo.conf
  2. Connect from the menu

    The tunnel now appears under VPN in the system network menu. Toggle it like any other connection.

Kill switch on your Linux machine

wg-quick can refuse any packet that does not leave through the tunnel. Add these two lines to the [Interface] section of your file.

  1. Edit the config

    Open /etc/wireguard/mv-tokyo.conf with sudo.

  2. Add the rules

    They insert a reject rule while the tunnel is up and remove it when you bring it down.

    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
  3. Restart the tunnel

    Run wg-quick down, then up. Repeat the rules with ip6tables if the machine has IPv6.

What the kill switch protects

Split tunneling on your Linux machine

On Linux the AllowedIPs line decides what enters the tunnel. Narrow it and only those ranges use MobileVPN.

  1. Edit AllowedIPs

    Replace 0.0.0.0/0, ::/0 with the ranges you want protected.

  2. Or route per user or process

    Advanced users can set Table = off and add policy routing rules by hand.

Split tunneling explained

Linux VPN not working? Fixes

"resolvconf: command not found"

wg-quick needs resolvconf to set DNS. Install openresolv (or systemd-resolved with resolvconf support), then bring the tunnel up again.

Handshake never happens

Check that the host firewall allows outbound UDP 51820 and that the system clock is correct.

DNS still goes to the router

Confirm that the DNS line in your file is present and that NetworkManager is not overriding it. A DNS leak test site then shows which resolver answers.

Linux VPN questions

Which Linux distributions does MobileVPN support?

Any distribution that runs WireGuard or OpenVPN: Ubuntu, Debian, Fedora, Arch, openSUSE, Mint and others.

Can I use MobileVPN on a headless server?

Yes. wg-quick works without a desktop and systemd keeps it running across reboots.

Does a Linux machine use a device slot?

Yes, like every device. Remove it in the dashboard when you no longer need it and the slot frees up.

VPN plans for your Linux machine

Go

$2.51 a month

6 devices, $60.29 for 24 months

Saver

$1.50 a month

10 devices, $40.50 for 27 months

Plus

$3.64 a month

10 devices, $87.29 for 24 months

Pro

$6.22 a month

12 devices, $149.39 for 24 months

Compare plans and lengths

Other device guides

Protect your Linux machine tonight

Top up in crypto, buy a plan, and your Linux machine gets its own slot, file and city.