🚀 Join Our Group For Free Backlinks! → Join Our WhatsApp Group

Setting Up a Private WireGuard VPN & Internal Tools on a VPS Spain

A support agent in Bogotá needs to look up an invoice on a Madrid server. The finance team in Valencia uses the same application to approve refunds. Both need a private connection, but only one team should see the approval button. WireGuard handles the connection from each device to the server. The invoice application still handles sign-in and decides what each person can do.

For a small team, a straightforward setup is to run WireGuard and the internal tool on the same Linux VPS. Give the server a private tunnel address and configure the tool to accept connections there. Each employee device gets its own key and address. Route only traffic for the internal tool through Madrid so a colleague in Latin America can keep using their normal internet connection for calls, email, and other work.

Choose the private address before installing anything

This example uses 10.77.40.1 for the Madrid server and 10.77.40.2 for the first laptop. Check the proposed range against the networks your team already uses. If the application’s address also belongs to a device on someone’s office network, a connection that works from home may behave differently at their desk. Record the chosen addresses alongside the device names so the next administrator can identify them.

For the VPS, check that you can administer Linux, allow inbound UDP traffic, and reach a recovery console if a firewall change interrupts access. Size memory and storage around the internal application and its database. For teams evaluating a Madrid deployment, Onlive Server lists its location, operating system options, and server access details here: https://onliveserver.com/vps-spain/.

Configure one server and one test laptop

Install the wireguard package on the Ubuntu VPS and a WireGuard client on the laptop. Generate a separate key pair on each device and exchange only the public keys. Keep the server’s private key and configuration readable only by the administrator. On a laptop, the WireGuard app can generate a key pair when you create a tunnel.

On the server, create /etc/wireguard/wg0.conf with the following settings. Replace the placeholders with the appropriate keys.

[Interface]
Address = 10.77.40.1/24
ListenPort = 51820
PrivateKey =

[Peer]
PublicKey =
AllowedIPs = 10.77.40.2/32

The laptop needs the server’s public key and its public endpoint. Replace vpn.example.com with a hostname that resolves to your VPS, or enter its public IP address directly.

[Interface]
Address = 10.77.40.2/32
PrivateKey = <laptop-private-key>

[Peer]
PublicKey = <server-public-key>
Endpoint = vpn.example.com:51820
AllowedIPs = 10.77.40.1/32

The two AllowedIPs values serve different purposes here. On the server, .2/32 associates one laptop address with that laptop’s key. On the laptop, .1/32 directs traffic for the Madrid tool through the tunnel. Because the application lives on the VPS itself, this setup needs neither IP forwarding nor a rule that sends the laptop’s general internet traffic through Spain.

Allow inbound UDP on port 51820 in the host firewall and any provider firewall. Keep your existing management connection open while testing. On Ubuntu with systemd, start the configured interface with sudo systemctl enable –now wg-quick@wg0. Activate the laptop tunnel and send a request to the server’s private address. Then run sudo wg show on the VPS to check for a recent handshake.

Put the application behind the tunnel

Suppose the invoice application already listens on 127.0.0.1:3000. Leave it there and configure an HTTPS reverse proxy to listen on 10.77.40.1:443. Give staff an internal hostname that resolves to that private address and use a certificate their devices trust. Check the proxy’s IPv4 and IPv6 listeners. A wildcard listener can expose the same service through a public interface.

Test from both sides. With the VPN connected, sign in as a support agent, open a sample invoice, and confirm that refund approval is unavailable. Then disconnect the tunnel and try the application again. Also test the VPS’s public address using the application hostname. Otherwise, a failed private DNS lookup could hide a publicly reachable copy of the dashboard.

Diagnose the first slow or failed connection

A recent WireGuard handshake confirms that the peers exchanged traffic. It does not tell you whether the invoice application can reach its database. If the handshake succeeds but the page fails, check the application listener, firewall rule for tunnel traffic, internal DNS answer, and certificate name. If there is no handshake after a connection attempt, start with the public endpoint, UDP port, and exchanged public keys.

Have a colleague in Spain and another in Latin America open the same invoice and save a test note. Record which action feels slow. If the page opens promptly but saving takes several seconds for both users, investigate the application and database before changing the VPN. If a device behind a router needs to remain reachable after sitting idle, WireGuard documents an optional persistent keepalive setting for that case.

Make access easy to revoke

Before onboarding the rest of the team, rehearse a lost-laptop report. Remove the test laptop’s public key from the running server configuration and its saved configuration, then verify that it cannot reconnect. Revoke its application sessions separately. Other employees should remain connected because each device has its own key. That test gives the team a concrete answer to an important operational question: who can cut off one missing device without interrupting the people still at work?

Leave a Reply

Your email address will not be published. Required fields are marked *

Design, Developed & Managed by: Next Media Marketing