50% off your first hosting order, applied in your cart, on our upgraded infrastructure! Ends in: View Plans →
Türkiye · France · Northern Cyprus05372609483
Cloud VDS

Build a Company VPN on a VDS with WireGuard: Step by Step

  • 23 November 2026
  • 3 min read
Contents
    Share this post

    A VPN lets a remote team reach company systems securely, restricts a panel to a single fixed IP, and protects traffic on public Wi-Fi. When you run a VPN server on your own VDS instead of a ready-made VPN service, the exit IP is yours alone and you pay nothing extra per user. In this guide we build a company VPN with WireGuard on Ubuntu 24.04.

    Why WireGuard?

    WireGuard is a modern VPN protocol built into the Linux kernel, with a very small code base. It is much simpler to set up than OpenVPN, connects quickly and is battery-friendly on mobile devices. Official clients exist for Windows, macOS, Android and iOS. We compare business VPN options in general in business VPN solutions.

    What you need

    • A VDS running Ubuntu 24.04 (1 vCPU and 1 GB RAM is enough for dozens of users)
    • Root access and a server with basic hardening done; see the new VDS initial setup checklist

    1. Install and create keys

    apt update && apt install -y wireguard
    cd /etc/wireguard
    umask 077
    wg genkey | tee server.key | wg pubkey > server.pub
    wg genkey | tee ali.key | wg pubkey > ali.pub

    Create a separate key pair for each user or device. Private keys (.key) must never be shared.

    2. Server configuration

    First find the name of the server's internet-facing network interface:

    ip route show default

    The name after dev in the output (for example eth0 or ens18) is used below. Create /etc/wireguard/wg0.conf:

    [Interface]
    Address = 10.8.0.1/24
    ListenPort = 51820
    PrivateKey = (contents of server.key)
    PostUp = iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
    PostDown = iptables -t nat -D POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
    
    [Peer]
    # Ali - laptop
    PublicKey = (contents of ali.pub)
    AllowedIPs = 10.8.0.2/32

    Enable IP forwarding and start the service:

    echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/99-wireguard.conf
    sysctl --system
    systemctl enable --now wg-quick@wg0

    3. Firewall

    If you use UFW, open the WireGuard port and allow forwarding of traffic from the VPN:

    ufw allow 51820/udp
    ufw route allow in on wg0 out on eth0

    UFW details are in the UFW firewall guide.

    4. Client configuration

    Prepare this configuration for the user and import it into the WireGuard app:

    [Interface]
    PrivateKey = (contents of ali.key)
    Address = 10.8.0.2/32
    DNS = 1.1.1.1
    
    [Peer]
    PublicKey = (contents of server.pub)
    Endpoint = VDS_IP_ADDRESS:51820
    AllowedIPs = 0.0.0.0/0
    PersistentKeepalive = 25

    AllowedIPs = 0.0.0.0/0 sends all traffic through the VPN, so the user reaches the internet with the VDS's IP address. If you only want access to the company network, use 10.8.0.0/24 instead. If you save this configuration on the server as ali.conf, you can turn it into a QR code for phones:

    apt install -y qrencode
    qrencode -t ansiutf8 < ali.conf

    To add a user, add a [Peer] block to the server file and run systemctl restart wg-quick@wg0. wg show lists connected clients and their latest handshake.

    What a fixed IP gives you

    Everyone on the VPN reaches the internet through the same fixed IP. You can then open admin panels, databases or SSH to that IP only and close them to everyone else. If different teams need separate exit addresses, add extra IP addresses to the VDS.

    Which VDS?

    If your team is in Türkiye, a Türkiye VDS gives the lowest latency; for a European exit, choose a France VDS. Traffic is unlimited on Fiberserver VDS plans, so you pay nothing extra for data passing through the VPN.

    Comments0

    No Comments Yet

    Be the first to share your thoughts.

    Join the Discussion

    Please sign in or sign up to leave a comment.

    Never Miss a Post

    Get our latest tutorials, guides and product news in your inbox.

    You're subscribed to our newsletter.