How to Set Up WireGuard VPN on a Swedish VPS
Run Your Own VPN Server with WireGuard
Instead of paying for a commercial VPN service, run your own WireGuard server on a VPS. You get full control, no third-party logs, and a dedicated Swedish IP address.
What You Need
- A VPS with Linux โ KVM VPS 1G (โฌ6/month) is plenty
- Root access (SSH)
- 10 minutes of your time
Step 1: Connect to Your VPS
ssh root@your-server-ip
Step 2: Install WireGuard
Debian/Ubuntu
apt update && apt install -y wireguard
Rocky Linux/AlmaLinux
dnf install -y epel-release && dnf install -y wireguard-tools
Step 3: Generate Keys
wg genkey | tee /etc/wireguard/server_private.key | wg pubkey > /etc/wireguard/server_public.key
chmod 600 /etc/wireguard/server_private.key
wg genkey | tee /etc/wireguard/client_private.key | wg pubkey > /etc/wireguard/client_public.key
Step 4: Server Configuration
cat > /etc/wireguard/wg0.conf << EOF
[Interface]
PrivateKey = $(cat /etc/wireguard/server_private.key)
Address = 10.0.0.1/24
ListenPort = 51820
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
[Peer]
PublicKey = $(cat /etc/wireguard/client_public.key)
AllowedIPs = 10.0.0.2/32
EOF
Step 5: Enable IP Forwarding
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p
Step 6: Start WireGuard
systemctl enable --now wg-quick@wg0
Step 7: Client Configuration
Create client.conf:
[Interface]
PrivateKey = CLIENT_PRIVATE_KEY
Address = 10.0.0.2/24
DNS = 1.1.1.1
[Peer]
PublicKey = SERVER_PUBLIC_KEY
Endpoint = YOUR_SERVER_IP:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
Replace the placeholder values with your actual keys and server IP.
Step 8: Connect
Import the config file into the WireGuard app on your device:
- Windows/macOS/Linux: wireguard.com/install
- iOS: App Store โ WireGuard
- Android: Play Store โ WireGuard
Verify
curl ifconfig.me
Your IP should now show your VPS server’s Swedish IP address.
Why Your Own VPN Is Better
| Self-hosted VPN | Commercial VPN | |
|---|---|---|
| Cost | โฌ6/month | โฌ5-10/month |
| IP address | Dedicated (yours only) | Shared with thousands |
| Logging | You control it | Trust the provider |
| Devices | Unlimited | Usually 5-6 |
| Blocked by services | Rarely | Often |
| Speed | Full VPS bandwidth | Variable |
Recommended VPS Plans
| Plan | RAM | Disk | Price | Capacity |
|---|---|---|---|---|
| KVM VPS 1G | 1 GB | 15 GB SSD | โฌ6/month | 5-10 devices |
| KVM VPS 2G | 2 GB | 20 GB SSD | โฌ10/month | 20+ devices |