My travel VPN with WireGuard, OpenVPN, a GL.iNet router and Hetzner

My travel VPN with WireGuard, OpenVPN, a GL.iNet router and Hetzner

Travel VPN setup with a travel router, VPS and home network

My travel VPN has to work beyond my own Wi-Fi: hotels, mobile networks and places where the obvious connection fails.

Quick version

My travel setup uses a Hetzner VPS as the publicly reachable gateway, WireGuard for the fast everyday tunnel, OpenVPN over TCP as a fallback, and a GL.iNet travel router to connect multiple devices. A separate WireGuard tunnel links the VPS to my home network. Regular internet traffic exits through the VPS; only traffic bound for home goes through that second tunnel.

I built it with trips to China and unreliable hotel and mobile networks in mind. This isn't a magic censorship-bypass solution. Some networks will block both protocols, and I still keep an independently working eSIM and VPN on my phone. The travel router is convenient, but it shouldn't become my single point of failure.

Why not host everything at home?

Hosting WireGuard on my home server would usually be the obvious choice. The catch is my fiber connection: publicly reachable IPv6, but no public IPv4. Plenty of hotel and mobile networks are still awkward in that situation. A small VPS gives me stable public IPv4, predictable firewall rules and one clear place to troubleshoot.

The architecture

The VPS sits between my travel devices and the internet. The home network is an additional routed destination, not the exit point for every website I open.

Devices
  ↓
GL.iNet router
  ↓
WireGuard or OpenVPN
  ↓
Hetzner VPS
  ├── regular internet
  └── WireGuard tunnel home
        ↓
      Home LXC
        ↓
      home LAN

Example network ranges

These ranges are examples, not something to copy without thinking. Keep the travel WireGuard network, OpenVPN network and home-site tunnel on separate subnets.

Purpose Example
Travel WireGuard 10.66.66.0/24
WireGuard server 10.66.66.1
OpenVPN fallback 10.99.99.0/24
Site-to-site tunnel 10.200.200.0/24
Home LAN 192.168.1.0/22
Home LXC 192.168.1.50

Part 1: Install WireGuard on the VPS

WireGuard is my first choice: lightweight, fast, and well supported on GL.iNet routers. Install the package, generate a server key pair, and display the public key when you need it. Keep the private key private.

apt update && apt upgrade -y
apt install wireguard qrencode -y
mkdir -p /etc/wireguard
cd /etc/wireguard

wg genkey | tee server_private.key | wg pubkey > server_public.key
cat /etc/wireguard/server_public.key

Part 2: Configure the WireGuard server

My server listens on UDP port 8443 because port 443 was already occupied. Reorganizing a working reverse proxy just before a trip sounded like a terrible idea. Substitute real keys and your own network interface. Don't assume the public interface is called eth0; check it first. The example forwarding and NAT rules are IPv4-specific.

/etc/wireguard/wg0.conf
[Interface]
Address = 10.66.66.1/24
ListenPort = 8443
PrivateKey = SERVER_PRIVATE_KEY

PostUp = iptables -I FORWARD 1 -i wg0 -j ACCEPT
PostUp = iptables -I FORWARD 1 -o wg0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
PostUp = iptables -t nat -A POSTROUTING -s 10.66.66.0/24 -o eth0 -j MASQUERADE

PostDown = iptables -D FORWARD -i wg0 -j ACCEPT
PostDown = iptables -D FORWARD -o wg0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
PostDown = iptables -t nat -D POSTROUTING -s 10.66.66.0/24 -o eth0 -j MASQUERADE
ip route get 1.1.1.1

Part 3: Enable IP forwarding

The VPS must actually forward packets. Then bring up the tunnel, inspect its status, and allow its UDP port in both the operating-system firewall and any provider firewall. A successful handshake alone doesn't prove that forwarding works.

echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/99-wireguard.conf
sysctl --system
systemctl enable wg-quick@wg0
systemctl start wg-quick@wg0
wg
systemctl status wg-quick@wg0
ufw allow 8443/udp

Part 4: Automate WireGuard client creation

Typing a new peer configuration by hand for every phone or router gets old quickly. My helper looks for a free client address, generates keys, adds the peer to the server configuration, writes the client profile and can display a QR code. The script is an example: check the generated addresses, peer permissions and restart behavior before using it on a production server.

The helper creates client files below /etc/wireguard/clients/. Treat these as secrets: a client profile contains its private key.

/usr/local/bin/wg-add-client
#!/bin/bash
set -e

WG_IF="wg0"
WG_DIR="/etc/wireguard"
WG_CONF="$WG_DIR/$WG_IF.conf"
SERVER_IP="DEINE_SERVER_IP_ODER_DOMAIN"
SERVER_PORT="8443"
VPN_NET="10.66.66"
DNS="1.1.1.1"

if [ -z "$1" ]; then
  echo "Nutzung: wg-add-client CLIENTNAME"
  exit 1
fi

CLIENT="$1"
CLIENT_DIR="$WG_DIR/clients"
mkdir -p "$CLIENT_DIR"

if [ -f "$CLIENT_DIR/$CLIENT.conf" ]; then
  echo "Client existiert bereits: $CLIENT"
  exit 1
fi

LAST_IP=$(grep -oP 'AllowedIPs = 10\.66\.66\.\K[0-9]+' "$WG_CONF" | sort -n | tail -1)

if [ -z "$LAST_IP" ]; then
  NEXT_IP=2
else
  NEXT_IP=$((LAST_IP + 1))
fi

if [ "$NEXT_IP" -gt 254 ]; then
  echo "Keine freien IPs mehr"
  exit 1
fi

CLIENT_PRIV=$(wg genkey)
CLIENT_PUB=$(echo "$CLIENT_PRIV" | wg pubkey)
SERVER_PUB=$(wg show "$WG_IF" public-key)

CLIENT_IP="$VPN_NET.$NEXT_IP"

cat >> "$WG_CONF" <<EOF

# $CLIENT
[Peer]
PublicKey = $CLIENT_PUB
AllowedIPs = $CLIENT_IP/32
EOF

cat > "$CLIENT_DIR/$CLIENT.conf" <<EOF
[Interface]
PrivateKey = $CLIENT_PRIV
Address = $CLIENT_IP/24
DNS = $DNS

[Peer]
PublicKey = $SERVER_PUB
Endpoint = $SERVER_IP:$SERVER_PORT
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
EOF

systemctl restart wg-quick@"$WG_IF"

echo
echo "Client erstellt: $CLIENT"
echo "IP: $CLIENT_IP"
echo "Config: $CLIENT_DIR/$CLIENT.conf"
echo

qrencode -t ansiutf8 < "$CLIENT_DIR/$CLIENT.conf"
chmod +x /usr/local/bin/wg-add-client
wg-add-client iphone
wg-add-client tablet
wg-add-client glinet-router
/etc/wireguard/clients/
cat /etc/wireguard/clients/glinet-router.conf

Part 5: Configure the GL.iNet travel router

On the GL.iNet router, open the WireGuard client section, add a profile, and import the generated configuration. Activate it and check the apparent public IP from a device connected to the router. It should be the VPS IP. Keep a direct phone connection available in case the router or the uplink acts up.

VPN
→ WireGuard Client
→ Add New Profile
curl ifconfig.me

Part 6: OpenVPN as the fallback

WireGuard uses UDP, and some networks make UDP connections difficult. OpenVPN over TCP on port 9443 is my fallback. TCP doesn't guarantee access on restrictive networks either, but it gives me a genuinely different transport to try.

The example creates a certificate authority, server certificate and client certificate with Easy-RSA. Protect the CA private key; ideally, don't leave it on an internet-facing server. Check the outbound interface, NAT, certificate paths and firewall before starting the service.

apt install openvpn easy-rsa -y
make-cadir /etc/openvpn/easy-rsa
cd /etc/openvpn/easy-rsa

./easyrsa init-pki
./easyrsa build-ca nopass
./easyrsa build-server-full server nopass
./easyrsa build-client-full glinet nopass
./easyrsa gen-dh

openvpn --genkey secret ta.key
/etc/openvpn/server.conf
port 9443
proto tcp
dev tun

ca /etc/openvpn/easy-rsa/pki/ca.crt
cert /etc/openvpn/easy-rsa/pki/issued/server.crt
key /etc/openvpn/easy-rsa/pki/private/server.key
dh /etc/openvpn/easy-rsa/pki/dh.pem

tls-auth /etc/openvpn/easy-rsa/ta.key 0

server 10.99.99.0 255.255.255.0

push "redirect-gateway def1"
push "dhcp-option DNS 1.1.1.1"

keepalive 10 120

cipher AES-256-GCM
auth SHA256

persist-key
persist-tun

user nobody
group nogroup

verb 3
iptables -t nat -A POSTROUTING -s 10.99.99.0/24 -o eth0 -j MASQUERADE
systemctl enable openvpn@server
systemctl start openvpn@server
ufw allow 9443/tcp
systemctl status openvpn@server

Part 7: Build the OpenVPN profile for GL.iNet

The travel router needs a single .ovpn file with the client settings, certificates and key. The example assembles that file on the VPS, lets me inspect it, and copies it to my computer for upload.

Important: The profile includes a private client key. Don't publish it, email it casually or leave old copies lying around.

cat > /etc/openvpn/client-glinet.ovpn <<EOF
client
dev tun
proto tcp
remote DEINE_SERVER_IP_ODER_DOMAIN 9443

resolv-retry infinite
nobind
persist-key
persist-tun

remote-cert-tls server

cipher AES-256-GCM
auth SHA256

key-direction 1

verb 3

<ca>
$(cat /etc/openvpn/easy-rsa/pki/ca.crt)
</ca>

<cert>
$(sed -n '/BEGIN CERTIFICATE/,/END CERTIFICATE/p' /etc/openvpn/easy-rsa/pki/issued/glinet.crt)
</cert>

<key>
$(cat /etc/openvpn/easy-rsa/pki/private/glinet.key)
</key>

<tls-auth>
$(cat /etc/openvpn/easy-rsa/ta.key)
</tls-auth>
EOF
cat /etc/openvpn/client-glinet.ovpn
scp root@DEINE_SERVER_IP:/etc/openvpn/client-glinet.ovpn .
VPN
→ OpenVPN Client
→ Upload File

Part 8: Connect the home network

To reach the NAS, Home Assistant or other services at home, I use another WireGuard connection. This one runs between the VPS and a Linux container at home. It's separate from the normal travel tunnel.

My home-side example uses 192.168.1.0/22 for the LAN, 192.168.1.50 for the LXC, and 10.200.200.0/24 for the tunnel. The site-to-site peer needs the correct AllowedIPs and routing. On the home side, make sure forwarding/firewall policy permits only the traffic you intend.

Heimnetz:       192.168.1.0/22
Home LXC:       192.168.1.50
Tunnelnetz:     10.200.200.0/24
VPS Tunnel IP:  10.200.200.1
Home Tunnel IP: 10.200.200.2
apt update
apt install wireguard -y
/etc/wireguard/wg-home.conf
[Interface]
Address = 10.200.200.2/24
PrivateKey = HOME_PRIVATE_KEY

PostUp = sysctl -w net.ipv4.ip_forward=1
PostUp = iptables -A FORWARD -i wg-home -j ACCEPT
PostUp = iptables -A FORWARD -o wg-home -j ACCEPT

PostDown = iptables -D FORWARD -i wg-home -j ACCEPT
PostDown = iptables -D FORWARD -o wg-home -j ACCEPT

[Peer]
PublicKey = VPS_PUBLIC_KEY
Endpoint = VPS_IP_ODER_DOMAIN:51830
AllowedIPs = 10.200.200.1/32,10.66.66.0/24
PersistentKeepalive = 25
systemctl enable wg-quick@wg-home
systemctl start wg-quick@wg-home
wg
systemctl status wg-quick@wg-home

Part 9: Configure the home tunnel on the VPS

The other end of the site-to-site link lives on the VPS. It knows both the home tunnel peer and the home LAN route, so traffic addressed to the home network enters the correct tunnel.

Don't forget the firewall rules that allow forwarding between the travel tunnel and the home tunnel; the example peer configuration alone doesn't establish permission.

/etc/wireguard/wg-home.conf
[Interface]
Address = 10.200.200.1/24
ListenPort = 51830
PrivateKey = VPS_HOME_PRIVATE_KEY

[Peer]
PublicKey = HOME_PUBLIC_KEY
AllowedIPs = 10.200.200.2/32,192.168.1.0/22
PersistentKeepalive = 25
systemctl enable wg-quick@wg-home
systemctl start wg-quick@wg-home
wg
systemctl status wg-quick@wg-home

Part 10: Add a static route on the UniFi Dream Machine Pro

My UniFi Dream Machine Pro needs a route back to the travel VPN network. The destination is 10.66.66.0/24; the next hop is the home LXC at 192.168.1.50.

Destination Next hop
10.66.66.0/24 192.168.1.50

Without that return route, VPN handshakes can look healthy while connections to internal devices quietly fail.

Part 11: Test the entire route

I don't consider the setup finished just because a tunnel icon turns green. Check WireGuard and OpenVPN service state, the home-site tunnel, the route table, firewall/NAT rules, and finally the public exit address. Test from a different network, not only from home Wi-Fi.

wg
systemctl status wg-quick@wg0
systemctl status openvpn@server
systemctl status wg-quick@wg-home
wg
ip route
iptables -S
iptables -t nat -S
curl ifconfig.me

Troubleshooting

When something breaks, work through the layers:

  • WireGuard won't start: check logs, occupied ports, incorrect keys, malformed configuration and stale firewall rules.
  • Handshake but no internet: verify IPv4 forwarding, NAT, the real outbound interface and firewall policy.
  • No access to the home LAN: verify the UDM's static return route and the home subnet in the VPS peer's AllowedIPs.
  • Pages load only partially: investigate MTU; 1280 can be a useful diagnostic client setting on awkward hotel/mobile links.

The commands below are the diagnostics and specific settings from my setup.

journalctl -xeu wg-quick@wg0.service
systemctl status wg-quick@wg0
ss -tulpn
sysctl net.ipv4.ip_forward
ip route get 1.1.1.1
iptables -t nat -S
10.66.66.0/24 → 192.168.1.50
AllowedIPs = 10.200.200.2/32,192.168.1.0/22
MTU = 1280

Final thoughts

Yes, this is more work than installing a VPN app. In return, I control the endpoints, routes and fallback options. The real win is the architecture: one primary path, one alternative, and one deliberately routed connection back home. It's only robust if each of those paths has been tested before I leave.

All addresses, interfaces, keys and domain names shown here are illustrative. Adapt them to your environment before running any commands.